{"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02384.rs", "upstream_id": "BenchmarkTest02384", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let tokens: Vec<&str> = upload_name.split(\",\").collect();\n let data = tokens.join(\",\");\n crate::shared::db_query_bind(\"SELECT * FROM users WHERE id = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5d0360e9eb28fa3ecb95fc978720e8115f1890be645f99fd9e4f833063355b1", "structural_hash": "be74e77d39d8f06c571e3fb6dccf8d7e690228459e600a1afc0a1b7c81828538", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00072.rs", "upstream_id": "BenchmarkTest00072", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let _prefix: String = user_id.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => user_id.to_lowercase(),\n \"f\" => user_id.to_uppercase(),\n _ => user_id.trim().to_string(),\n };\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ca9772e7daf873d74141555994e86f4d927e942f0286c2d197abe020891eec3", "structural_hash": "c7e37ad8aef4cc81fadc153b264e2ccaa73eca5a5cfd93303c7bcd32eae71b3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00566.java", "upstream_id": "BenchmarkTest00566", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.sql.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = normalize(rawData);\n try (Statement stmt = connection.createStatement()) {\n stmt.executeQuery(\"SELECT * FROM users WHERE id = \" + data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a0e2c0a150490e33b26039aae807826b93f08bd234a400f1851e4c00cee1f62", "structural_hash": "a067e074c070f888f8ab6d0bb37a9a7a8875a1937ab4abdf036756ca4fb19037", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05571.py", "upstream_id": "BenchmarkTest05571", "language": "python", "code": "from django.http import JsonResponse\nfrom types import SimpleNamespace\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n ns = SimpleNamespace(payload=xml_value)\n data = getattr(ns, 'payload')\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47906d94535a5ba4225c6fb1c650706c54610e2d347b97305d7482d87bff0bd2", "structural_hash": "d2c4b6ca4649e1f35dbfa36de1553dc1f9bd1a9be3e7aa4eb47376a74638f09d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17969.sh", "upstream_id": "BenchmarkTest17969", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n echo \"$user_input\" | openssl enc -aes-128-cbc -nosalt -iv 00000000000000000000000000000000 -K \"$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be2b6f8cb35b19115207831e53931a7e5507e9cb6ee19e1e060b350abd060a4b", "structural_hash": "cc58b9e85b45df568d776880e7b114ceac146ec638565da3fd49ac89e676ccbf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03441.py", "upstream_id": "BenchmarkTest03441", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request, path_param):\n path_value = path_param\n def normalize(value):\n return value.strip()\n data = normalize(path_value)\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "859d92f81e6ce295b57c370d3681df1e17ad71466e55136d286e2c59bd197f74", "structural_hash": "cfc7262f6ed1cd4b7ab3ec5d980aabdf0136cb4f58fcb5b29fbce8080cfc4002", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04707.rb", "upstream_id": "BenchmarkTest04707", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b45e6c470096bf5f2d8f3a4749ba5e6d3458ff5b8f023ca4e01a5853953b12c", "structural_hash": "b745b52d0bb19c0f39b9157508bef9982bdf3485309460c27ea37fc04de6749d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17282.js", "upstream_id": "BenchmarkTest17282", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n try { JSON.parse(data); } catch(e) { ctx.status = 400; ctx.body = {error: \"invalid\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5bd55d952fff3b2373d77f1e801aa2a0fcd6a7b113289859d6e4bf8ee1442a3", "structural_hash": "7cde8115b09983710ce73f0ec7692a2815d9bbcd12eb7c5830149b2bf7eb89c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04777.c", "upstream_id": "BenchmarkTest04777", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n long _v = strtol(data, NULL, 10);\n signed char _c = (signed char)_v;\n printf(\"%d\\n\", (int)_c);\n}", "label": 1, "cwe": ["CWE-194"], "category": "sign_extension", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sign_extension", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe34751ef8af67fad9308f3730642db37cc0e81961fef4d162eef55cb15af2da", "structural_hash": "1d683255ba182a2fa9f2e07dd566442eead836c80379710eacc1244eabc7a118", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00423.rs", "upstream_id": "BenchmarkTest00423", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = user_id.to_string();\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e39a0be06393100eeaf5ee7d8ebdc1cfc7e872caea712c234653b60b6b60bef", "structural_hash": "efdb7bd87a371d41b1e48c213e06eac64f65745b5be70b2c58896ad82617940c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01960.cpp", "upstream_id": "BenchmarkTest01960", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0031fc16085820fe220a8cbdb85d4e52ab740c50b254ed8fc30d2ab45a371f0", "structural_hash": "8968e54ddc0d7ea7e23ade215107efef14a1a26a9a7afc44defc2477aeeb950d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05379.rb", "upstream_id": "BenchmarkTest05379", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n Digest::MD5.hexdigest(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3917640bb63029d444b2a0459d109890834d871b6017a35960474ec02d60057a", "structural_hash": "039047d9dae2fb1a16571886544dec0650feae9239ba697f8e19b55d130b446d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_40342.js", "upstream_id": "BenchmarkTest40342", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nconst { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const data = passthrough(userInput);\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a5d5c7258f41e23ba9669a52069649f64338bb65cd728e2670f4998cca5edeb", "structural_hash": "18b514a6bb735c4cdf3704d3e50b805707ede2fa68b842bf1caf85a826d6fdd5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04716.ts", "upstream_id": "BenchmarkTest04716", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n res.status(500).json({ error: \"unable to process request\" }); return;\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50c044e31270662155838c7c5ed5d06587dc1641396480362fdbbf8bb811d710", "structural_hash": "0277db82c421632140ac483e8a3bb325ede5a21bc957b238d8f910fee79658dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05985.php", "upstream_id": "BenchmarkTest05985", "language": "php", "code": "text;\n $processed = preg_replace('/[A-Za-z0-9]{4,}/', '****', str_replace([\"\\r\", \"\\n\"], '', (string)$userInput));\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6ffd227a13ee3c0378148bab50f926ab10bdbaa2db15a429455cfff4732168c", "structural_hash": "ebe7fb8f9594fa3294f0c828749f83da6284749264f00983051d335bf43062e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04022.rs", "upstream_id": "BenchmarkTest04022", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = if cookie_value.len() <= 4096 { cookie_value.clone() } else { cookie_value.chars().take(4096).collect() };\n if ![\"ls\", \"cat\", \"date\", \"whoami\"].contains(&data.as_str()) { return HttpResponse::Forbidden().finish(); }\n let processed = data.clone();\n Command::new(&processed).arg(\"--run\").output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d047a0552cbcde623c1948e6e29221b9341fb8f9ca77f7ac2085e3624fcb6c1b", "structural_hash": "5bb7dd34002618a8147fe312370fc377b857d4535ba440a3a14a369928743d6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06121.ts", "upstream_id": "BenchmarkTest06121", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n const role = String(processed);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df9b96a179ec935b20cae6addcc1f4f6b29769c134f3d56419ddec6e7f6b10fe", "structural_hash": "1d343b0e87f2015163ea225ecd189d1fb1248f01cf448f592dcd62fee2d5f58e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05443.java", "upstream_id": "BenchmarkTest05443", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> headerValue)\n .thenApply(v -> java.text.Normalizer.normalize(v, java.text.Normalizer.Form.NFC).strip());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6de18ee2cb10006d9d8a7c483bf06bec7ad84e84d880f374a2c1ff7bb4ecf520", "structural_hash": "1feb3b12974b870887cdf4032eaa61e815d94c07e7503ecc4bed1e2870c769b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04464.rs", "upstream_id": "BenchmarkTest04464", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = forwarded_ip.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")).finish()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6d81199f260bc3ad03381df478ef875e57e7ae51238f1566162e02bf198d6f0", "structural_hash": "c9b03243b08d6b3b95fbe26d8da924add1e9364b87467f01811480122f6611fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24442.go", "upstream_id": "BenchmarkTest24442", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tpending := strings.Split(graphqlVar, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tc.JSON(http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c31837a3f28d0cba7b7f9896f6004ef24058cc2aa86c908adbf1d62c255bc08e", "structural_hash": "a3ace9d3c307a37097958b0074aba1b0f9723664df4e64244fae7cf9dca03fec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11421.sh", "upstream_id": "BenchmarkTest11421", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n normalized=$(echo \"$processed\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$processed\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

%s

\" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3487c5a167e573ee03fbf195738b32d166f65bb923e0db5764ddf50baccafe62", "structural_hash": "da189cf646c0ac16379425ec965565942639f71eaa68cc0ac6204d88024078c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04095.rs", "upstream_id": "BenchmarkTest04095", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = forwarded_ip.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n ([(\"content-type\", \"text/html\")], format!(\"{}\", processed)).into_response()\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1fd98784a1571d54b2edea134fed6580041a4e102551afa06baad8f0e7e093a", "structural_hash": "da346c4ba1f4872c70b092d59b3ca01a89bf8bcbde6b2c646b8ab1aa7be947fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05993.ts", "upstream_id": "BenchmarkTest05993", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport * as http from \"http\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n http.get(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0e73211e29b5fb9a43a733a76e58cf0c688329be10b2b4950bbe9ae1ef9da1d", "structural_hash": "3b4f79fbd7aeb957e542a0981a54891361facc6d000060b01b3702d5f4078356", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26145.sh", "upstream_id": "BenchmarkTest26145", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=$(echo \"$user_input\" | jq -r '.value // empty' 2>/dev/null || echo \"\")\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b850568dae583b7faf0f3e7d2e9484fd781580fa9b15ce7e3c6224259ef18a8", "structural_hash": "c7187f2c2823768ea7d6a71f34c1a946e9838d42eb3917a393a93309526756e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04056.java", "upstream_id": "BenchmarkTest04056", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String prefix = uaValue.length() > 0 ? uaValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = uaValue.toLowerCase(); break;\n case \"f\": data = uaValue.toUpperCase(); break;\n default: data = uaValue.strip(); break;\n }\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26bb7aa502dd7abaa2da91733249c009fcdb080372a4785a88c1901e6f0d772b", "structural_hash": "870f30d2a4a1bb85c15c17e523917f569c8dc79740f2b0cb0d8d4c0048376553", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09519.sh", "upstream_id": "BenchmarkTest09519", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n case $data in\n a) echo alpha;;\n b) echo beta;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c283e4a52a169d478fd7e6a8871ddcfa52f766cac698347520b658e9a2b2e008", "structural_hash": "785218836521c358aa1c7ce09a7e9776e34e2137be7d812b47d8812f948230f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07608.c", "upstream_id": "BenchmarkTest07608", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n _p = NULL;\n if (_p) free(_p);\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36fe5ac37d9860d2de0d386f670057cd2b8e712d2b88bead3a8b4b9711b66754", "structural_hash": "69238807b50a3a31ae553b32c01e5bda423db4c24786125290961923d1651cf9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02802.py", "upstream_id": "BenchmarkTest02802", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\nimport hashlib\nfrom app_runtime import db\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n ctx = RequestContext(user_id, source='form')\n data = ctx.payload\n _resp = requests.get(str(data))\n if hashlib.sha256(_resp.content).hexdigest() != _resp.headers.get('X-Content-SHA256'):\n return jsonify({'error': 'integrity check failed'}), 502\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88ec5289b1b64e974efd4bc863ba9db634885cebeb1a8952bf0f6b5f10919540", "structural_hash": "1c1f839af9f1f309e5e8c6ef1019be5a254f51e5431ea0f046a4644614bdee95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01470.ts", "upstream_id": "BenchmarkTest01470", "language": "typescript", "code": "import { Controller, Header, Headers, Post } from \"@nestjs/common\";\nimport * as isoDompurify from \"isomorphic-dompurify\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const processed = isoDompurify.sanitize(data);\n return \"
\" + processed + \"
\";\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "152bd7a6c8f65ea53455223c078ce4a980321b133fa28108d7b3fcbd2e8c616c", "structural_hash": "ee66bdbc09df767cff9c2b17298859a32a853940568c0382cce26c8dd73dab29", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12377.sh", "upstream_id": "BenchmarkTest12377", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=\"${user_input:-default}\"\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "add6cfe222398339c3d8b717a8c2a1bcc2cc8b6eec83676171fb568fa6b8485f", "structural_hash": "c7c128dfcdad0f04b7c774620bd59a331856b17de58dbbd388b3000a679203e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_25400.go", "upstream_id": "BenchmarkTest25400", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tpending := strings.Split(graphqlVar, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3673e21acdf5b8c036f4e3ed8e86ebd44ca4eb11b7fe63494471ff3150cafdcd", "structural_hash": "99b5061f23bce325fe9c218f11337cdff237ed046162d805a13f5e2433a0a9be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00246.cpp", "upstream_id": "BenchmarkTest00246", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c16987bb267f0e0809159ca35e7a4c2e4d9263dee85e825142b241cda60deca7", "structural_hash": "56f5f36910ff6b4a8ce518b1faf49f2167f25db3ed917fe748ce9225aeaf4ade", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02094.php", "upstream_id": "BenchmarkTest02094", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $processed = \\Parsedown::instance()->setSafeMode(true)->text($data);\n return new Response('
' . $processed . '
', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6727ca82f2acd6c6cc9c9ec90b45b7eea552ff13141964cfe0a49eeb3fdd4c3c", "structural_hash": "987b3f501f6d5695a529d148d1f461c391cc7259236a067104bea03041ddbe93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00094.rb", "upstream_id": "BenchmarkTest00094", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n data = CGI.unescape(user_input)\n response.set_header(\"X-Frame-Options\", \"DENY\")\n response.set_header(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97c19ddf865d899027f1da7f17dcd8e87efc0db241c1973e9f920c7d1cfb8379", "structural_hash": "4efd9867f8ac7f2bd64dcad35abb92d37188d61c5e8cca28dac2bc6714323701", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01606.cpp", "upstream_id": "BenchmarkTest01606", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data = !user_input.empty() ? user_input : std::string();\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbc98ec47b94bc7bc6c70d079e649e53caf3e0f94b68908cd58022283a04c4e6", "structural_hash": "33ef6781108095708b29ff8c5bb58f1923064c61949fc42f8586102e0cd3bafc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26706.sh", "upstream_id": "BenchmarkTest26706", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=\"${user_input:-default}\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n arr=(10 20 30 40 50)\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n idx=$bounded_val\n echo \"${arr[$idx]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ee72402d0b917911fd59a0b5bb7cdf844e653e4fcb9342aaac6dacc4715564c", "structural_hash": "e07481b5495cf97ee3addfc0968e681a5db81898938909996df7916f8f7d56fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07450.c", "upstream_id": "BenchmarkTest07450", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0600);\n}", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0f1d0049fd37648d6d835272697149ebc167e2779ddccbdebd6a73295dbf71d", "structural_hash": "be1db672a026ee29a02fe3d47ce21e3ae04577ab96a948122595f34f825192ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02327.py", "upstream_id": "BenchmarkTest02327", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\nfrom app_runtime import auth_check\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\n_login_attempts: dict[str, int] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = handle(cookie_value)\n if not re.match(r'^.{1,256}$', str(data)):\n return JSONResponse({'error': 'schema invalid'}, status_code=400)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return JSONResponse({'authenticated': True}, status_code=200)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3895f96cf8a4e40b26161e91df0a169c0c626bb06831f835877c542a1b3eb2c5", "structural_hash": "89a99da642bcf0ecfa013f9929d7bf794f751dc11a7d73eab24237485ab366de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_14981.go", "upstream_id": "BenchmarkTest14981", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/md5\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(configValue)\n\thash := md5.Sum([]byte(data))\n\thashStr := fmt.Sprintf(\"%x\", hash)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95aca438c4a9e5695188e728062b316e4bd8f74ec6f0e21b3bc97f26cf94a052", "structural_hash": "5c40f47ada4f3e77eb70483bf4d6f6c7554ae138bef348aacfa96efb1177bd36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00244.py", "upstream_id": "BenchmarkTest00244", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n data = (lambda v: v.strip())(host_value)\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5a8b8d741f8f5bb8869b5343fecfce064e32ad4f0098892fba2c5cfe5dd53a7", "structural_hash": "ec5049e6c066f264315b5bb6a87bf6f5df66dc688216f421c6c953e39f310472", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05095.php", "upstream_id": "BenchmarkTest05095", "language": "php", "code": "getContent();\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n $conn->executeQuery('SELECT * FROM users WHERE id = \\'' . $data . '\\'');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7647ab6a5d17bcee747869db66a365d18d805d6a3ad9d9aa211cfdfff755fa67", "structural_hash": "dbf3f199ba4d90963c1289fee1441b4b8b10fd957e5e02beea6f1f5dd46e2693", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00203.ts", "upstream_id": "BenchmarkTest00203", "language": "typescript", "code": "import { Body, Controller, Post, Req, UsePipes, ValidationPipe, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Req() req: Request): Promise {\n const userInput = dto.payload;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (data !== req.session.csrfToken) { throw new ForbiddenException({error: \"csrf mismatch\"}); }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4846b439ed4421b5c2b2212cdeab570852c23830adabd6eb2d893f4bb496f95", "structural_hash": "768bd6c5dea3cb0efeca4ebd989268c21ce3b7c70c709acb6da34a48d207d8ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03331.rb", "upstream_id": "BenchmarkTest03331", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34060c67a3095fd31e21bf0848270c8daa84fbf93e842bba9294f5208f95731a", "structural_hash": "2884de764ddbfd9e5eaec8acb7a352432295aca26cf218450d13a2412495c721", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04315.py", "upstream_id": "BenchmarkTest04315", "language": "python", "code": "from django.http import JsonResponse\nimport logging\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n if cookie_value:\n data = cookie_value\n else:\n data = ''\n logging.info('User action: ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69b197e47f578d6368e7edf546060a50ab538fbc5d49592f3f6984ead74c1b1a", "structural_hash": "b51ae1b1472f3a263ccf3d1a266c5d84152c4eafb31a495c2ee8323a9261bbf5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04377.rs", "upstream_id": "BenchmarkTest04377", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let data = comment_value.replace(\"\\t\", \" \");\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dffbb4cf15111b30c74d8f41ad3396601865ba8a4f288716aeff602b0f5778ca", "structural_hash": "f344a2616841c78d2420536a43cd0844c0a0b99043d4c014cbea73fd4be4b041", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02522.cpp", "upstream_id": "BenchmarkTest02522", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && user_input == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2bc207c16166e44ba2d3897cddaf50135918e6b26b037e3c327fd1633ffc3493", "structural_hash": "58f3cc87d16f84dc6dfc4d2853b1d5d367ce8cddd12f0216edf73ba6c15d4884", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00646.py", "upstream_id": "BenchmarkTest00646", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n data, _sep, _rest = str(forwarded_ip).partition('\\x00')\n buffer = bytearray(int(data) if str(data).isdigit() else 0)\n return jsonify({'allocated': len(buffer)}), 200", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95a537f9389d71bad12654f6ec9f1dcbb0600b36254b461fa5d6a8ea1c7565e0", "structural_hash": "04e195019cd8ff30bef12d1576009e6cae8e273a21543b4afb80f61a8894f73d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02687.rb", "upstream_id": "BenchmarkTest02687", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = user_input ? user_input : ''\n session[:data] = data.to_s\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f40c6c1072b260727c6b51bf25f723508ac880d9f11ec111339237d8b875882", "structural_hash": "34860eeec01347a2037430e9aa4bda4c3cf291914c53b303c601a7f2fb470ff1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04087.py", "upstream_id": "BenchmarkTest04087", "language": "python", "code": "import logging\nimport re\nfrom urllib.parse import unquote\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = unquote(field_value)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n logging.info('User action: ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb9561bafba78936d3ae4cc6de9a4345b5e4557b32525dfdf266ed79b8ba20ac", "structural_hash": "fe91c5c67d4dd6ecd79ee1bbee793d817e322981d479a57e8451890ba1bbc811", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03239.py", "upstream_id": "BenchmarkTest03239", "language": "python", "code": "from fastapi import FastAPI, Request\nimport yaml\nimport json\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n graphql_var = json.loads((await request.body()).decode()).get('variables', {}).get('input', '')\n try:\n data = json.loads(graphql_var).get('value', graphql_var)\n except (json.JSONDecodeError, AttributeError):\n data = graphql_var\n yaml.load(data, Loader=yaml.UnsafeLoader)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da7cdd1fdf2fe3692468c5b19f2ed3b2f3cdefffbbcbc0fdbe192a14ab44c56e", "structural_hash": "b24993329ac560fe5affbc3bd1b933fb5785f07eb27737c62c6f7271e442611d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41164.js", "upstream_id": "BenchmarkTest41164", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(userInput));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "170b564151bbeb6228fe01d6c828194c24b96eb2a696086918dc1da7ce6b3059", "structural_hash": "a1f292f3575465dbfd033614a428f4aa45e91ebbd379fffef9c58d4fae2e5178", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02616.php", "upstream_id": "BenchmarkTest02616", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = str_replace(\"\\0\", '', $userInput);\n $trusted = (string) $data;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e56caad5dce660daba2d324ea3efb1f21ce1fcae51948e9432f28127c281830b", "structural_hash": "a7702b1074c797ff924eeea916aa5cae046f77e1f545d684bf740a079fa58acc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03257.php", "upstream_id": "BenchmarkTest03257", "language": "php", "code": "header('Referer', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n $size = (int)$processed;\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66dd26d753b6f29a496267fbe6672983f73073fadcc0f06b1ed7bb653ce6b22b", "structural_hash": "d70b50e0c5adbd0b997f0acff766f6e967d4258a8645a1490f652f0c99f359f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01363.rs", "upstream_id": "BenchmarkTest01363", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n let _stored_digest = std::env::var(\"STORED_CRED_SHA256\").unwrap_or_default();\n let _ok = !_stored_digest.is_empty() && crate::shared::hash_hex(&config_value) == _stored_digest;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c759a3ad2975f025579648b4e37a612b169db7cd372b868edb3c68fbd401a1f6", "structural_hash": "ab9cde2e3071c25552bac57ad72b4509deebd49aa40fd0d4c0a714ee72bbbce4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05586.java", "upstream_id": "BenchmarkTest05586", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n FormData payload = new FormData(rawData);\n String data = payload.payload();\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c006274062894e89ae169582ac8bfc683514519783d95ece743cfba791a7881e", "structural_hash": "94d812cdb27de29377d88a059edba31e5111e9c07c7bdb28f7237f5ae0e0ddd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07464.js", "upstream_id": "BenchmarkTest07464", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8a810fa227228594c111470b8cc47af6cb66a7d06a7a3cf12b494f724214258", "structural_hash": "3a4727c9402f8b4eb29b98c128936dc325faf7cd42a92f74ec1e06beb240c598", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07017.go", "upstream_id": "BenchmarkTest07017", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/csv\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvar data string\n\tfor _, token := range strings.Split(xmlBody, \",\") {\n\t\tdata = token\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tcsvFile, _ := os.Create(\"output.csv\")\n\tcsvWriter := csv.NewWriter(csvFile)\n\tcsvWriter.Write([]string{processed, \"data\"})\n\tcsvWriter.Flush()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4aadbf0cea3f178a0cf86725f7d52275da7a0ce6d463f626dc429cd4a3aae602", "structural_hash": "292f53a889655e3f214ec75ae9e880d60936fba72fa4bffc2c64534bc498b301", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03339.rb", "upstream_id": "BenchmarkTest03339", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n payload, _origin = user_input, 'http'\n data = payload\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n if processed.to_s =~ /[a-zA-Z0-9_-]+/\n content_type :json\n JSON.generate({ validated: processed.to_s })\n end\n end\nend", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2621c5e388c345addcc25c6716bbd606c10c5f7244876b6acd4084aa00b80fef", "structural_hash": "163bb5a357541dde85b5770f6a97019d857e34242662b56f81a8469e98433814", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01568.rs", "upstream_id": "BenchmarkTest01568", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = config_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let store_cred = std::env::var(\"APP_SECRET\").unwrap_or_default();\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1027cc89a8dc468209fd06e6f37e59926493962f18fe77d071745fe4abc04a46", "structural_hash": "e3fe87fde6d695c23627da915a70177ac27f980570395651763c134e98403678", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00652.rb", "upstream_id": "BenchmarkTest00652", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = format('%s', user_input)\n unless %w[ls cat date whoami].include?(data.to_s)\n halt 400, JSON.generate({ error: \"forbidden\" })\n return\n end\n system(data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81433e2f376c9497535ab88cd66cac4a8f160721ce1e4c57243eea7b159db338", "structural_hash": "bd9175ea673a313c83b327b7fd10934452b322441888e901871b6af5fbef28cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06756.c", "upstream_id": "BenchmarkTest06756", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a77d485f8c049ffa203d6be80d48eae1315b7b81811315e5a77a7839704f6646", "structural_hash": "4379fa6dbb87d5030d62cdd2598580b5ed2c1dfbaf48a8df228b5289ebfab3dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03492.rs", "upstream_id": "BenchmarkTest03492", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: config_value.clone() };\n let data = payload.value().to_string();\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b30b77746144711fd6495ec3f17e15ad12133ea5ae80222461197509f70fdab", "structural_hash": "e1113e42074ffaa5809cec05e3ffd2ff827e9aef5e0cba6c6ec161024d6f9c97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01969.java", "upstream_id": "BenchmarkTest01969", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String prefix = authHeader.length() > 0 ? authHeader.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = authHeader.toLowerCase(); break;\n case \"f\": data = authHeader.toUpperCase(); break;\n default: data = authHeader.strip(); break;\n }\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "139e32cbaf8884f060abb719cb4b11aa29b77321bf201f05e8c96594c7c7d5f6", "structural_hash": "7c5e537225d3aabdc94dc55710977690a2cfb2b92fc9ce34b55c4d2e0b44a438", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04464.ts", "upstream_id": "BenchmarkTest04464", "language": "typescript", "code": "import { Controller, Headers, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string, @Req() req: Request): Promise {\n const userInput = auth || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { return { authenticated: true }; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6513e613a1223d6dfb4a55898188bf79e40bd19f830fd442ed06b8817645c7b5", "structural_hash": "83a7af9100215246a363015b1e05b5868dc0f5418b099816348ed3c2bfcc2043", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02289.ts", "upstream_id": "BenchmarkTest02289", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(data)));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd4d63f742ff68eb292121fec66bc3ef1581373dd8c00958f93198f0833cace3", "structural_hash": "f35ed726a2513481f618f4c0f279ecb4bb29cdbc9e93c14099254382cd33ac6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00239.c", "upstream_id": "BenchmarkTest00239", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "513d5055cd627218206cfb0ae15d0e6ed32c49e2980a5e6ed8bbdb4619a05945", "structural_hash": "3f9b2df09e8c5a32db3972834f5569754f369c76644e43bd4a07e74383735d05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00006.php", "upstream_id": "BenchmarkTest00006", "language": "php", "code": "header('Origin', '');\n $data = '' . $userInput;\n abort(500, $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8190f09b649ae0a52f64185922b4069a266ea54c86b2d4b25d121e9af079a95", "structural_hash": "e00abaaaf5e57557b39388e80b649cf86a6d29ba7d378a806da4084b73c03069", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03983.go", "upstream_id": "BenchmarkTest03983", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", refererValue)\n\tdata := _sb.String()\n\thttp.Redirect(w, r, data, http.StatusFound)\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0850311401a794c218e16ffe6620b245bb319e9dff98e4b835f1be5c316e460d", "structural_hash": "bd67565cf614ebebb0a4fbf7f98de5e3fe792b251b1434985fadfcdaa91c552a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00878.ts", "upstream_id": "BenchmarkTest00878", "language": "typescript", "code": "import { Controller, Post, Query, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string, @Req() req: Request): Promise {\n const userInput = id || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n if (!shared.authCheck(data, req.session.token)) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcbefbb776fc57867ad74be0d5ac08837cc7135fa63b4ddf5c884e086bcf1d80", "structural_hash": "c5409ac5b53fd3e6012a9ae2a5ce7d4222f980e1b2ec257942291e7e0a7ec943", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03132.py", "upstream_id": "BenchmarkTest03132", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n reader = make_reader(forwarded_ip)\n data = reader()\n return HTMLResponse(Template(data).render())", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f7fda201412884648ab51f61fb19b1bdd5f38538c4c6952313de9bf18470889", "structural_hash": "edc6587d2755ad92972c561e57ccbc517298cac3f48dae75a88b7ca37eef1820", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12869.c", "upstream_id": "BenchmarkTest12869", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"uploads/%s\", user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c584c449279b223db68f93943ff64299c2bcab09ebb283f18458163038241280", "structural_hash": "7110646701d431d44c16f17751d0ef858bc8101d2f1b7358643b4f8a61fdce0c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04405.php", "upstream_id": "BenchmarkTest04405", "language": "php", "code": "text;\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return redirect($data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59ab6436d0463e9e8f01c5d034a2c84b291846f18983be744f9f5c9e176e9f0b", "structural_hash": "1cc3afdfe9cc9f2647769b0d01c4a57c4603e40916a966fba86f456592278886", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03311.rs", "upstream_id": "BenchmarkTest03311", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(upload_name.clone(), |s| s.trim().to_string());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(&processed).arg(\"--run\").output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4db6ee45093de90e9244d94996aacc1992853b8ca716f2f347e8634da8957d0d", "structural_hash": "43fb584ce15aac172d4794daa04a3b43e01c837ee564ba0813ca97a1b4860495", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29047.go", "upstream_id": "BenchmarkTest29047", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar _b strings.Builder\n\t_b.WriteString(graphqlVar)\n\tdata := _b.String()\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c5b162fca97aee732896964a345a9eac9ab0d09641504f0381ce460bb7d8552e", "structural_hash": "0349f5d19ac49da91f685b8ba4b0968bf6a64e0e087f8e0e7ae31e381337804a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01448.ts", "upstream_id": "BenchmarkTest01448", "language": "typescript", "code": "import { Body, Controller, Post, InternalServerErrorException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n throw new InternalServerErrorException({ error: \"unable to process request\" });\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8cb77af262034d04c47fe737279365f35ed8be83feb8b6443e77d0c5d95cdc4", "structural_hash": "8cc2d6da92189e052822b8d9b54ff469fd3a8744c33978d8b0aa5940d6f30268", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03628.cpp", "upstream_id": "BenchmarkTest03628", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n std::string data = cpp_module_transform(user_input);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "850f72fd94d977ab96400c5b78bedf1897fd02fb501509014dd71f15767e2360", "structural_hash": "c0a32d352cc09d090a123a8513b784f17d3fc3e641a93d5df89ac08465bb4818", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04887.ts", "upstream_id": "BenchmarkTest04887", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n fs.writeFileSync(\"/var/app/active/pkg.bin\", _content);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "014579eaccb05ff5957cb21b2cccacb232ea16802c3e876639dd247272da7368", "structural_hash": "b8a498bddebaa047ca0729d0ccd3becb0e168f874ee61269a213e8f367274fea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10222.go", "upstream_id": "BenchmarkTest10222", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", xmlBody)\n\tdata := _sb.String()\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e160e3aa06dece564ce4a1512e4dcbc4596f9dd04da0dee33317395fd949ce30", "structural_hash": "e3a39594a2713daf9ca502ec08c66d54c745995c7ae2a160df86673e65bfa576", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00065.rb", "upstream_id": "BenchmarkTest00065", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n processed = CGI.escapeHTML(data)\n render html: (\"
\" + processed + \"
\").html_safe\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e7b61ee95ddeba391bff07fc35eb207862a189fbce71ffb2210618eba4eb77a", "structural_hash": "09710b60680072d8f25de26c6bbced62b23c2393cf3fd8b308a2a1014438ff2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00263.ts", "upstream_id": "BenchmarkTest00263", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const data = String(userInput).slice(0, 200);\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdcb33aa94ecc77ba34d5c4734c425b798ec7c5a66b26ac5ff39eda85fd93bd7", "structural_hash": "d1e95b1a82413a44d53b4b299cc50307f3ad7e5fabfc4c45f63d60bb3e2e670d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01892.py", "upstream_id": "BenchmarkTest01892", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = RequestPayload(db_value).value\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return JsonResponse({'error': 'invalid integer'}, status=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JsonResponse({'allocated': allocated}, status=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "957de53c42acc584c81d8fe5aec203fb5a68afda4e039e6f5c91c26b1a5b3bff", "structural_hash": "73f007a8a14a106c3db91ca44f9c40c32c3cb018ff3c723e0c96f639716fa8a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03080.py", "upstream_id": "BenchmarkTest03080", "language": "python", "code": "from django.http import JsonResponse\nimport csv\nimport json\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = RequestPayload(graphql_var).value\n cell = str(data)\n if cell[:1] in ('=', '+', '-', '@', '\\t', '\\r'):\n cell = \"'\" + cell\n with open('output.csv', 'a', newline='') as fh:\n writer = csv.writer(fh, quoting=csv.QUOTE_ALL)\n writer.writerow([cell])\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3cb2b1915eda5521d1a7e1691ee41df137f9c3b33a7d9b744d085f81dd0fb73c", "structural_hash": "3b58e5320c6fccd4db1f31942af7286f82268cdae81cb218afe33f193c141a5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02956.java", "upstream_id": "BenchmarkTest02956", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n FormData payload = new FormData(uaValue);\n String data = payload.payload();\n if (!data.endsWith(\".jpg\") && !data.endsWith(\".png\")) { response.sendError(400); return; }\n String entryFile = data;\n Files.write(Paths.get(\"/var/uploads/\" + entryFile), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d632427f54d53f1c05fc838759237e19a6f88537c559a14331121e14c41ce70", "structural_hash": "2bdef57763259d77053da9e2b40f603989df96dc744611dc53682b8a0fa5dc25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04139.rb", "upstream_id": "BenchmarkTest04139", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = [\"s3cr3t_key_test_xyz\"][0]\n payload, _origin = user_input, 'http'\n data = payload\n _dsn = \"postgres://app:\" + data.to_s + \"@db/prod\"\n _ = _dsn\n render json: { auth: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e09e7fbbe81d9dae0d910364c3c5016be08b6b83b8af38210ebe9fcfb425a195", "structural_hash": "31914235e939b8e87aab5db1b97dd7982c6f30815e3c7301f007e05ef37fa600", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04126.go", "upstream_id": "BenchmarkTest04126", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tsegments := strings.Split(cookieValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tlog.Printf(\"User action: %s\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "852cfcf0c49799cbef5e21591461f13ba655122d0a89dc695f80157ae5f9e758", "structural_hash": "d7026ddc53e7242dd1b53ef83df1d38942606a966991bbcb9680d27e1281fb16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02538.php", "upstream_id": "BenchmarkTest02538", "language": "php", "code": "json('payload', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n simplexml_load_string($data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74acfc7aafa9d6c2d3458afe61477dc12b6b84e534197598d66a17d37e12713e", "structural_hash": "7064f55607df34a038f7a795bad0ef42c5d5408815eabbbb11afa97ac0486bd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05128.rs", "upstream_id": "BenchmarkTest05128", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(auth_header.clone());\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6374948b7a31de9dd4e09816ec3e9fc11b38a5f6abf375f7f145b174ebc6ef4", "structural_hash": "2904fa77b299d5b30f28b5cba5490611ea4302de77e2ab1fd666cf10298b3f18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01901.rs", "upstream_id": "BenchmarkTest01901", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = ua_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a271034fa0b26cb997765842d3805b2bfd30dd33b7d94eee53d3e9a31d4b328d", "structural_hash": "f128867181eec7f264d97b34f1c1699590a61c1e5d93009e4cc228e397665114", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00484.rb", "upstream_id": "BenchmarkTest00484", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n @user_input = user_input\n data = @user_input\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n content_type :html\n ERB.new(parsed_bool.to_s).result\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f341041217c111bfb6976eccd29f7de48eb3744483879a1d79a90e67b232fa6b", "structural_hash": "3eab11c6faac59826ee7b85534c046883d138562f4bf1f641be3d890876a4290", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16175.go", "upstream_id": "BenchmarkTest16175", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvar _b strings.Builder\n\t_b.WriteString(fieldValue)\n\tdata := _b.String()\n\tif strings.HasSuffix(data, \"/public\") || strings.HasSuffix(data, \"/static\") || strings.HasSuffix(data, \"/.\") {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-424"], "category": "improper_alt_path_protect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7b25f4fb447a21b42fe9194be40dc661c406e7925dd4c6a5231cd1dab4556c8", "structural_hash": "390da7c73d37b048cd46d098841ba5dbd3970cfeb254c89df8f72d0554033f55", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00005.rs", "upstream_id": "BenchmarkTest00005", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let queued = upload_name.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fffffd329420273622058a4f6cac9d0f6e5c88c3a38f5b0eb077fe236baf9032", "structural_hash": "d8d522b69e2a0f869c3e78c71a6e40f74666e79af2b0c3392b71c811a1f1da61", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02136.ts", "upstream_id": "BenchmarkTest02136", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data = userInput != null ? userInput : '';\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60412eac089cbbe75d0ead62319f4136dc1c260fb09b54379386955abf88f7e6", "structural_hash": "7c4d780768f54ff0608301bffa4d1673c5da9619aef9fff6891f9e4a4bf4570d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03147.php", "upstream_id": "BenchmarkTest03147", "language": "php", "code": "name;\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc40a5ec5b15d8af1a95b19fa55086bd46cca5a6b8750702951e6fdd5624f0b3", "structural_hash": "165111d5c826d2d8260d3a09cc7dee2bd9db66a1304517160763f75018b0fc87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01794.rb", "upstream_id": "BenchmarkTest01794", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c78fadc3801e21ce959832af92440897b13074792054acc7ae1c79eacd96a6bc", "structural_hash": "30dff1ae9b095ed98076d13d12fdb04de2a486ec8a22f70ad84a5d87b4b28274", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07367.sh", "upstream_id": "BenchmarkTest07367", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n printf -v data \"%s\" \"${user_input}\"\n echo \"$data\" | tr 'A-Za-z' 'N-ZA-Mn-za-m'\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b9a27a96689693291c87b248d242280923eccb5f1a8ac0f02eb37cce4030057", "structural_hash": "366382983b488fb371b82d41642aeb1e61b0291fc925ca7aea9609374c5201d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03441.rb", "upstream_id": "BenchmarkTest03441", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n data = \"%s\" % user_input\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + processed + \"']\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "589e2226302dab14fd80dde5e763bf9a9393b3993ef19752c220b57a142c0b59", "structural_hash": "6bf747790aa4f549c7f8ac64d9d2f73521126787a896c083f2062e74d0cf115a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04806.c", "upstream_id": "BenchmarkTest04806", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "922b1efb449e37f9a1e4eeec1784dc89e66858912f4ef7c62771e58b31ea3ae4", "structural_hash": "8ba87f6cd3defa91b835f8be51fc0d170eb61c9dd858f326c7db61dbb33653a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01622.ts", "upstream_id": "BenchmarkTest01622", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data = String(userInput).slice(0, 200);\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc9ecf4cc7debe339177cc981019c9ed19f99e7c18c4c3a5cd6386ed0b2b6d81", "structural_hash": "5ef49cfd6a04042cc7494c52fad911a8ede508223024f8fba9766dc9cd3952fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02821.py", "upstream_id": "BenchmarkTest02821", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\ndef coalesce_blank(value):\n return value or ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = coalesce_blank(cookie_value)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n if re.search('[a-zA-Z0-9_-]+', str(processed)):\n return jsonify({'validated': str(processed)}), 200\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c743f1a172d8f079d2b7042cd7e32f5034211884b9a43114f4086bdb3bd73046", "structural_hash": "0eeb319ac3b5f2baab16411ea25a8603fe8ac0fc12998884e8475e8594f673e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01399.rb", "upstream_id": "BenchmarkTest01399", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n ActiveRecord::Base.connection.execute(\"SELECT * FROM users WHERE id = '\" + data + \"'\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6dc4714fa94b49b691c8a546f8d0ba5880ccb552128e9dc362f7e49f9a80690a", "structural_hash": "2ced1e6f0860dc923f27dba077beeaea360aa104c663d1e08d0be07a7cedaaf4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05660.c", "upstream_id": "BenchmarkTest05660", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7fa67409eeab41237803359f924dee609b5885ebff46fb10fda5092fb8269f9", "structural_hash": "b4c596db574d8c2327748212d827304b84d347e64a0be736014a1b60ccd6795c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04388.rs", "upstream_id": "BenchmarkTest04388", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", json_value).ok();\n let _role = data.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f51493585fe66848e9f1a835620bbbb281869f108c787af08bb5c59abc2ae7ed", "structural_hash": "8264f72046f6bfac158b7f0302ba262cc2f41593d18f4647503cd512d0517e59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04265.ts", "upstream_id": "BenchmarkTest04265", "language": "typescript", "code": "import { Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Res({ passthrough: true }) res: Response): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n res.set(\"X-Frame-Options\", \"DENY\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "029989d0df2e7dce67da753d3901f4ee6ef0df447008ce0505260b05e09fd180", "structural_hash": "02123f848f26a949bc4ef547e794d7e57719e9c81c3444aeffc72faf8ae8533b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_39561.js", "upstream_id": "BenchmarkTest39561", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const data = await Promise.resolve(userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/uploads/data.enc\", _ct);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8b36f887f607e630fd8bdcec7e9bd23643c8623eb4bfa0ee87906ad76735b83", "structural_hash": "fe8b442a042e8636ecb049f9a10e626a670cbf3e0b3375cd30a1906fa5315359", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02564.rb", "upstream_id": "BenchmarkTest02564", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n system(\"echo \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1b3231fe7fd85b3c6abd9ec0d8479144dca9f78f4186c702eb82d881fb5a3e7", "structural_hash": "7211361e12d9073b11e787e72a6071c3c279113995d9bcbbc03d17c18450ae84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00584.rs", "upstream_id": "BenchmarkTest00584", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: host_value.clone() }.payload;\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa53e87af5e3958510d5a71e26740b402d560aafb8cb1fe8ce17f6e9f13e8be0", "structural_hash": "7dc3532568b042ad0ecfbc86fe26eb487635b70bf16b0b6cd6d58794eca5d824", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_23545.go", "upstream_id": "BenchmarkTest23545", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(authHeader)\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\tpanic(\"generic error\")\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b28df3b6643ae6a0a0d36c7f1e026f01d345ba74fd863f8bb675d0b816fd053", "structural_hash": "79c80ea357a5f2a9cc17d1337f6b89bf58c6b1314fea37d367856b47225e1288", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25497.js", "upstream_id": "BenchmarkTest25497", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n let _result = 'none';\n switch (data) { case \"a\": _result = 'alpha'; break; case \"b\": _result = 'beta'; break; default: _result = 'other'; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cc389b0b2e3493f4c3f757282a9fadcbbe3e12b2f3ab6ffa8eae87012f0b6b6", "structural_hash": "da1db997245e9a62e7d77a21144db8e4b432305d1c64edf2f878a6348dffc79a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00253.cpp", "upstream_id": "BenchmarkTest00253", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55554e3911df866cdd0c68cd9c9a5d32abeed5f9c13fc19c291357dbd6b2bc66", "structural_hash": "da0574d00e16ebaaef1b6a89bf791995bd1e7ef02441b1a88100563b32b3086c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08650.js", "upstream_id": "BenchmarkTest08650", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7984c004d2bb7a11d9219e6bda675317d1b90705ff3c5edf6d95ad509cf2bde9", "structural_hash": "7c43d4b2c056b68626dfbb75708571b6ec062dd0a876dbd2404cfcbd3853e4eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00761.php", "upstream_id": "BenchmarkTest00761", "language": "php", "code": "request->get('field', '');\n $data = vsprintf('%1$s', [$userInput]);\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $actions = ['asc' => 'sort_asc', 'desc' => 'sort_desc', 'name' => 'by_name', 'created' => 'by_date'];\n $result = $actions[(string)$processed] ?? 'noop';\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "323700183a197589a9203cdf65d72df98b14d48251959926c97d7f55c0109440", "structural_hash": "bee6f276268241aa377cd6811e4646461c2bfba64960028902a8aa933f424c5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35892.js", "upstream_id": "BenchmarkTest35892", "language": "javascript", "code": "const ldapjs = require(\"ldapjs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + data + \")\", scope: \"sub\" }, () => {});\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ecfcee7a426aef06375415406d186f53a083e5c059c5c2a441e9178896825ba", "structural_hash": "d7cd94c5f1ba562819e3f931e8193d000438431b26224043451453ef829b413e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27390.sh", "upstream_id": "BenchmarkTest27390", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f163b0d03c153cb5c0fba39ccb8d0683641f120f148a88fb923132f6eea0d905", "structural_hash": "1a653c7dff1ad26caba5d5dc702c75fd2b7bad27f924e4fc7dbccb51f385506f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30316.sh", "upstream_id": "BenchmarkTest30316", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n divisor=\"$data\"\n if [ \"$divisor\" -eq 0 ]; then echo \"zero\" >&2; exit 1; fi\n result=$((100 / divisor))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71eb040bd0a9f847929cec4fbbfbedf11a432d6d284759fccc6a82623a18c59e", "structural_hash": "ef1fc0c1672ad9b40184ecfa321681f3dbee639bd6294e77855b718eb977fed5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12079.go", "upstream_id": "BenchmarkTest12079", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvar data string\n\tif len(commentText) > 0 {\n\t\tdata = commentText\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tDB.Exec(\"DELETE FROM accounts WHERE id = ?\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a2e0b6fcda8d8be491f7dde7be3c432457b0fe89cf57c15864b922e3fd9d0c9", "structural_hash": "68f0d52f95dda16dbff5e0ae698a72297df1b6e66f8920dbf8751fe3491b821d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02241.cpp", "upstream_id": "BenchmarkTest02241", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd3402d6ee18eef2b21c66381c9ddc3d65f69968853c64e6b5c8ef0718fec03a", "structural_hash": "be17960392b657230b468fe65edc49b5945c091174912c9b06588271e4bb91d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest06036.java", "upstream_id": "BenchmarkTest06036", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : refererValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0d78745ff9004043b2fb218d93cd34a5a60ae65636d96b1e78e1a6de35b561a", "structural_hash": "4f63cad296c8e4ba98ab9de2bd26b9913f9f1c27b9daac69a5089918dfbcad46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04941.py", "upstream_id": "BenchmarkTest04941", "language": "python", "code": "import logging\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n logging.info('User action: ' + str(auth_header))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cccbe984a2e534b88dfb02020f19da96d570462036dfea7ea168966f23e5ad66", "structural_hash": "1d3d09abe73e58d4db8c14951a502c7f324ae3803671918ed74e9ccf94817e68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04740.sh", "upstream_id": "BenchmarkTest04740", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n trusted_claim=\"$data\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c67e9d145e924285e1e8f8dfe4d84d7ce4284504372a9a44e7e165201f9580ab", "structural_hash": "76c8f26c3680d9ee68d08d8bca326350aa4a3e041d64902a2c57cc7947356a02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08161.js", "upstream_id": "BenchmarkTest08161", "language": "javascript", "code": "const jsYaml = require(\"js-yaml\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n jsYaml.load(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f33d2e9a1dd7d5666c9dbb4949e78b2567f0106b2c05e453cdaf6b707fceaa7", "structural_hash": "6ee13bee08d2feeeb2613c02e89a45aacdcafbdba13958f032401c98d2a1d9ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03956.ts", "upstream_id": "BenchmarkTest03956", "language": "typescript", "code": "import { Controller, Post, Query, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string, @Req() req: Request): Promise {\n const userInput = id || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a88afe0398754523d85e4c0c2e0f8d5f8bcaaa72fcad5d3799bd9df666b1279", "structural_hash": "23a69d7e880ffdbf4284907735a3b12b013bb143fffa722ca5d583e6b9270dfc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02972.java", "upstream_id": "BenchmarkTest02972", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/json\")\n public void benchmark_case(@RequestBody GraphQLRequest req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n String data = String.format(\"%s\", graphqlVar);\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6db1ff6873188d7e4172efeda0a229a9d08c012dd27852d042ea620387af7dd", "structural_hash": "2fa14ae7881ca9a8856badfdb5ff47036e2cddfa71d62e1c2d5c0840e67c7448", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02097.rs", "upstream_id": "BenchmarkTest02097", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&env_value).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65cd31821d21b3046b65940a116ee7ab1f1d5e013bb9a993a762b4ed1baf6c08", "structural_hash": "8adb1275a47ab8d94a93d25ee492d87ae7ae042d6945797ed5bcd337c67ba42d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04175.c", "upstream_id": "BenchmarkTest04175", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f8ad09607e59543311b345b07b8754b28a37bc44a2bf55bf5d9e1090b4af182", "structural_hash": "6f6989dfb0ad96dc960477da884389c39f207ab05449abf60bf2d4a6cc011727", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01462.cpp", "upstream_id": "BenchmarkTest01462", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.path_params.at(\"id\");\n std::string data = cpp_module_transform(user_input);\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3844c5904779f903b92c71b644253b573ee665c6472483f3bd52a56d259d7da", "structural_hash": "51e31919f7a1c8ab6a5c1145dfcc6eb74e3c381645c6ebadc0d2a658e9fe516e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02911.cpp", "upstream_id": "BenchmarkTest02911", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n std::string safe = data.size() > 4 ? data.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "000c7a859b6d7a3c29d50aa043c7abe77b24df7890e87243b06d8ad30d80a014", "structural_hash": "a10fbebeb8ffed255925bbf8f235f9abac76de6d23fa15fdcfa9f6433b2ec79f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04018.php", "upstream_id": "BenchmarkTest04018", "language": "php", "code": "query('id', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $allowed = ['asc' => 'ORDER_ASC', 'desc' => 'ORDER_DESC', 'name' => 'BY_NAME', 'created' => 'BY_DATE'];\n $result = $allowed[(string)$processed] ?? 'noop';\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74d4842757f47253d8d7b62b5dc55f8d51ccb5852cedcccfb26a9915841f0803", "structural_hash": "dbf2bd69349037f176203e85305f607888e514c3636abb4809f7b9594d29f71e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_29155.js", "upstream_id": "BenchmarkTest29155", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n Buffer.alloc(parseInt(data, 10) || 0);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98c5c182fe6eed86d257cf66f10598a2a6db7044eae95dfefbf467d38bd7199d", "structural_hash": "4f02337b77857ea6b4374a944c053dea1e19e8ce64acfbcb56b10a9974f79a32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_39216.js", "upstream_id": "BenchmarkTest39216", "language": "javascript", "code": "const fs = require(\"fs\");\nconst { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const data = passthrough(userInput);\n eval('const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");; ctx.body = fileContent;');\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbff8b367a644e3da39e69d140887bffe035709288626f21405fbc3693c66890", "structural_hash": "e0d96b876bfb35b565fd5d0e872629b54ce93a0fb5e5cb876ef766de135da7ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01542.rs", "upstream_id": "BenchmarkTest01542", "language": "rust", "code": "use axum::extract::Query;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let data = user_id.replace(\"\\t\", \" \");\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc7eb3774c3ab62ce3c2717792b096719153834b1ef476e4fc792eb18e91f27b", "structural_hash": "60645c03399ae570e61c4b2a89365f616d799dde930fdefec8c22ea01fbdfbc5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05420.rb", "upstream_id": "BenchmarkTest05420", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cbde60f0bf578cd20254f7745b3f7762e844bc40194a6e514831a60f63b7167", "structural_hash": "7d82780c0c97591ed0f3df6dfd669d392f79b22a2ba6d2b2772aaa9605e5d737", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12670.sh", "upstream_id": "BenchmarkTest12670", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n _len_guard() { [ \"${\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _input=\"$data\"\n if [ \"${#_input}\" -gt 64 ]; then _input=\"${_input:0:64}\"; fi\n processed=\"$_input\"\n echo \"data\" > \"/tmp/$processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "705e874005d082904ca6d528976e162e3b80958961067c043bebc6c6135dbd60", "structural_hash": "7b595cfc9145f539c52d3685d2e04d2b2a3f6d22b784862e0b68ddf5343d4338", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00128.rb", "upstream_id": "BenchmarkTest00128", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = user_input.split.join(\" \")\n system(\"echo \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6d3b31cfa614773c0f6331df316400b6fef99d88c0dcb66c45765771b06f459", "structural_hash": "520ecf74fed20e3830d392dee98e520bbbaf5bff319e7b0b790ff459be9f7617", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23466.go", "upstream_id": "BenchmarkTest23466", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tlastRequestValue.Store(forwardedIP)\n\tdata, _ := lastRequestValue.Load().(string)\n\tdefer func() {\n\t\trecover()\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 1, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f2831090dc13f7ee417d4958fa2605d1aaa6551618b225020be3f5b5c3ffad8", "structural_hash": "d8e3617148f728c35e60ce8c5adc7b7a5b43584566cc1deb54fd127f8faf6cea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00019.py", "upstream_id": "BenchmarkTest00019", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom types import SimpleNamespace\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n ns = SimpleNamespace(payload=forwarded_ip)\n data = getattr(ns, 'payload')\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d309018b602b368b1516d0c3389625388865743333849fd87839c195b44dab1a", "structural_hash": "31ab04508b113a4adffa5a4cae2a3e768f40e9ad5ca6cd7aad05b7b18042857a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02866.ts", "upstream_id": "BenchmarkTest02866", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n console.log(\"Action: \" + processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8650de5ea5527568d8b2472f547c6146c6ebc12f33d587412f6b643fecd55f34", "structural_hash": "db7094b1a4211935cff868f3896e1450bd35e940489019215e8471276f6c8c5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16641.c", "upstream_id": "BenchmarkTest16641", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2a07565c947bcff81cbd1d44c2d86c0072afa068b9a529aa86e614763087788", "structural_hash": "a906ae3def70dafda965e86c28c7d8d307d9e69c9ca37f83cf2c360c8fc32997", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05040.java", "upstream_id": "BenchmarkTest05040", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = String.join(\" \", jsonValue.split(\"[ \\\\t]+\"));\n try (com.mongodb.client.MongoClient mongoClient = com.mongodb.client.MongoClients.create(\"mongodb://localhost:27017\")) {\n com.mongodb.client.MongoCollection mongoUsers = mongoClient.getDatabase(\"benchmark\").getCollection(\"users\");\n org.bson.Document nosqlFilter = org.bson.Document.parse(\"{\\\"username\\\": \\\"\" + data + \"\\\"}\");\n org.bson.Document nosqlResult = mongoUsers.find(nosqlFilter).first();\n response.getWriter().print(nosqlResult != null ? nosqlResult.toJson() : \"{}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcf8f06d3ae4f52d7904d7a4028d9178b5c2124ec31b5ce26370daef6e3ed3a2", "structural_hash": "3d00af6e00c3e319dca24b0f4f4a2c6fdc9d48639e0854169de275557c51a8d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_29348.go", "upstream_id": "BenchmarkTest29348", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tform := FormData{Payload: commentText}\n\tdata := form.Payload\n\tc.Header(\"X-Frame-Options\", \"DENY\")\n\tc.Header(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n\tc.JSON(http.StatusOK, map[string]string{\"status\": \"ok\", \"view\": data})\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89d10cefa3f061c003b0f2f84b8f1409812141a1bd76070f8658e8e01c29ab40", "structural_hash": "56e64105eba696c6e5262f17e5d8dd27c4c53f6fc7daa36bbbae3e5774a88a02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03847.rs", "upstream_id": "BenchmarkTest03847", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (raw_body.clone(), \"http\");\n let data = payload;\n tokio::fs::write(\"/var/data/plaintext.txt\", &data).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be7db88de04252f101c1ea68cbe248e15eddb769abbf48c559186f3dd9407623", "structural_hash": "d82a2c327acc4b53a2d7f86af647df9d89d8c988e8964ea455f019f122bd929a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09646.js", "upstream_id": "BenchmarkTest09646", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n req.session.expiresAt = Date.now() + 900000;\n req.session.data = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82a801fdb2bfd6d768db0ec73106283b17a0c6be4c73bda3c78f2851e787ea08", "structural_hash": "ad838131f25ee20a88b573be261aada7fa16e7345aaac02eb99781a159421097", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02944.ts", "upstream_id": "BenchmarkTest02944", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "307a0707d3010d9a6927622b4a3d168cc12efabb3bb4417d538e2ada4e754abf", "structural_hash": "693e39699e43b0fdff86a566c3b73e68793c7b63c08dad84d15817009921fd2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03373.php", "upstream_id": "BenchmarkTest03373", "language": "php", "code": "headers->get('User-Agent', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc574f40db5c4e23fd070bdcf3c338856e327c6f49f4647e3d2c242ef7ed32bd", "structural_hash": "a6cc067b6b7e1b46171d9d6cedeb848438bc22f71a8a586f0c3d1a256045b876", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04095.cpp", "upstream_id": "BenchmarkTest04095", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86fbf832b92499b20f07f8f777269d938f91055d96ed3e487297e5422d7d5eb1", "structural_hash": "c6adb2dcd47160772bb34f885c5555fc298a2b4e0c5cf41f3d7e0ed4701e1031", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_32712.js", "upstream_id": "BenchmarkTest32712", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = \"\" + userInput;\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34bfc65ac8757ba511b2c84ee1f94a99a7c5252d0b798147a437bc2bba5378ea", "structural_hash": "bc217fff81480ff6795640802cededca42d3458a62e3eb954397fd04bc90c532", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13710.c", "upstream_id": "BenchmarkTest13710", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5709fee4480c7c8caa54dfbe4bcc2f578c4900b0a305b8901c90c84e7346796", "structural_hash": "b1c813f063759f28c8ec13b17c4c433841f16ca4ed0f162e6fb8ca375b7a81a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07657.go", "upstream_id": "BenchmarkTest07657", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tdata := strings.ReplaceAll(forwardedIP, \"\\x00\", \"\")\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "028f49c7d0b5490994e1e323b8a3361c964dabf4812d7c3c7107d181ece13667", "structural_hash": "68f91b43a5b85ef12ffebc9ea87f62645ea0a8250a75a8bb6a201a5a9d849eaa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22633.js", "upstream_id": "BenchmarkTest22633", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b2a99abb870704c08665b3ca6ef9db3bff57e388c5cb2726d068e097331ac04", "structural_hash": "8f3021e12664f11c0b2db04be1d18e83d91c487180b0aaaf41db3a89ab2cd6c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02977.java", "upstream_id": "BenchmarkTest02977", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(xmlValue);\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0da6eb9f116e62165c8fcef3b43d5860cca44d24a5aa426ce21df039adeeb405", "structural_hash": "acf736145ab08c588de226811baa2f44321957ce2d31c6c30d6f6aac9c62aef6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_05717.js", "upstream_id": "BenchmarkTest05717", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nconst { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const data = passthrough(userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n ctx.body = nunjucks.renderString(processed, {});\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49e81668d99e8c5c8e0593a663d2d7159d94dafac96cce89c45e13e1b45241b2", "structural_hash": "13bd56eb842047b5ab15a8befd2694345241a17c941f3226c1c776975fa89504", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03785.ts", "upstream_id": "BenchmarkTest03785", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n res.status(500).json({ error: \"unable to process request\" }); return;\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "028ab0a4b18025937363d0bc36ac95fea2b5a6a8619960cdca045a2bd485dcbc", "structural_hash": "1c106fbdc1ebc3ffdb11db997c38c327795cc7467adb262b6fe901fcea3d3e9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36716.go", "upstream_id": "BenchmarkTest36716", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\t_prefix := \"\"\n\tif len(userID) > 0 {\n\t\t_prefix = strings.ToLower(userID[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = userID\n\tcase \"f\":\n\t\tdata = userID\n\tdefault:\n\t\tdata = userID\n\t}\n\tsharedCounterMu.Lock()\n\tsharedCounter = data\n\tsharedCounterMu.Unlock()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbe2425390394707387dd98520564d6fd4c6b2c69a3463209f6bcb817c83d10b", "structural_hash": "cd294d3b45a117abe9c42933cdd8c811959d0eedbd44bc1e64dcad23394bf8f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03225.go", "upstream_id": "BenchmarkTest03225", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"regexp\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(hostValue)\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\tc.String(http.StatusBadRequest, \"invalid option\")\n\t\treturn\n\t}\n\tprocessed := data\n\tinputPattern := regexp.MustCompile(\"[a-zA-Z0-9_-]+\")\n\tif inputPattern.MatchString(processed) {\n\t\tc.Header(\"X-Validated\", processed)\n\t}\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c90c28fa0d63cfb918a4c3b49b4133bcd8173f43b141ecd969fff81e3d0dd715", "structural_hash": "a37366c75994d6150448a0d0ab1fa7697dd42a6d5997d1949b989ca210fb05b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03789.php", "upstream_id": "BenchmarkTest03789", "language": "php", "code": "headers->get('Authorization', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a61590e1178656c9194a7f0c75749c0ca3d1adb311f467a180ff54241c507e1e", "structural_hash": "06c2941504a60a7a2288acc344ca47c764862494a2c4c6467e38de04f55771de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09464.sh", "upstream_id": "BenchmarkTest09464", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n ls -la -- \"$data\" 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb99af6abac9fa7e3f18120f53cc3d7d01aca52fa124c1c082bf4d69a5d7ace3", "structural_hash": "e1d4d64f362c654ffe7de107fa19a2e152577ab19e88615b1a0fbfd57b73277f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01667.php", "upstream_id": "BenchmarkTest01667", "language": "php", "code": "getContent();\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $logger->info('Action: ' . $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdb966b7d140512ae4e2ffd13108f26af969b8334eac5b282f205bf3d6bdd0c8", "structural_hash": "cb02aed8464ba8c86b388cbdc7cce8a09f6d5687200556ed1f368f8dc0b11d37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04550.rs", "upstream_id": "BenchmarkTest04550", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let data = path_value.split_whitespace().collect::>().join(\" \");\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c7e26761cbd47ad146094886900d1f4dbf73f7e2472923c1da91b9bb1704db1", "structural_hash": "938ebf274d9e0266c8077e01b8e84557d98a65672356015984f86b5ef2eddc77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02333.rs", "upstream_id": "BenchmarkTest02333", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse hex;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = String::from_utf8_lossy(&hex::decode(&header_value).unwrap_or_default()).to_string();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edba6f10e5f9fdc9b30b26ac04455b6cc93d5b3617bc63c898922ea37b39ce32", "structural_hash": "9608883f8435434eb926d3741cde34353d35611fed62b71ee6d7a18c9f424cc7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00591.rs", "upstream_id": "BenchmarkTest00591", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", comment_value).ok();\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5dc45bc6a68b46375b7ef3e850abafd2c55073ed02c5d1ef1abd94985911c95f", "structural_hash": "e34e0080d84844b8ccaa15284b2769cdfba85f7111563f5bdcae14cebbac6837", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11387.sh", "upstream_id": "BenchmarkTest11387", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n exec 9>/tmp/app.lock\n flock 9\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d4f673143eb561797928c90d45c368fc5b594e8a3127f31979f0e9dd3e48818", "structural_hash": "5fd7dd5e8c5506c08d3ab7e807ea4607881ca177bde66d8f3eaa48aa1fcc80e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_26368.go", "upstream_id": "BenchmarkTest26368", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/base64\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdecodedBytes, _ := base64.StdEncoding.DecodeString(dbValue)\n\tdata := string(decodedBytes)\n\tauthVerify(\"user\", data)\n\tc.JSON(http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e245da208ceb793379290e9434e8c1430899625ed2b4bdecfdbe793e30fa3d05", "structural_hash": "2a4818b66d9afc8cbbe47cf47869f6aeede311f67a98b55d3fae57f3667175fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04205.java", "upstream_id": "BenchmarkTest04205", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(jsonValue);\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91bb47298c963b1d9fb815d98b9e03a279c53a66ae7a0d877cd4709a6139875e", "structural_hash": "e05a8580bfd480d358586108c2fb7fee82a48727219f385999d65bf92b522c0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00935.py", "upstream_id": "BenchmarkTest00935", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n data = '%s' % (user_id,)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return JSONResponse({'authenticated': True}, status_code=200)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a4c2b646bb85109de27b6c2a5c121f9ab2f0ad286ba4d66163f7c5a3c2c7b29", "structural_hash": "cd3bc9e84160b7ec30beabb2054d74bcc3b4dfd0f2cfd5b9f420175b2ecc69c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00065.php", "upstream_id": "BenchmarkTest00065", "language": "php", "code": "getContent();\n $data = mb_convert_encoding($userInput, 'UTF-8');\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c51df7098993ff300623db8b94c68b7714356e74ceb900843b40daecb671623", "structural_hash": "098944ea5b9e2e22f4ba5fe0f3db44519a1a8bbbb46592ef7acbafd37b9cf250", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01959.rb", "upstream_id": "BenchmarkTest01959", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
\" + processed + \"
\").html_safe\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d8237c7ce2bd1f8923b5c379ba9dfaeed4b036b687df509986f36d195be9cdd", "structural_hash": "002db47c00a28fdbc7dc70d864e2558c7f7cd1c97d0be9b0a5897d47edc4968f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02085.sh", "upstream_id": "BenchmarkTest02085", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n printf -v data \"%s\" \"${user_input}\"\n case \"$data\" in\n https://app.shcdn.net|https://cdn.shcdn.net) allowed_origin=\"$data\";;\n *) echo \"forbidden origin\" >&2; exit 1;;\n esac\n printf '%s\\r\\n' \"Access-Control-Allow-Origin: $allowed_origin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0ba38f467110a4e6cc0d007ba44d8b812246642cc737c6cb0e0cde0b03a1d30", "structural_hash": "49ccb0efcf3c41f66330d36008ab81df90cff9ccb14a17d22a797728a224478d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05084.java", "upstream_id": "BenchmarkTest05084", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.nio.file.Path resolvedBase = java.nio.file.Paths.get(\"/var/app/data\").toAbsolutePath();\n java.nio.file.Path requested = resolvedBase.resolve(forwardedIp).normalize();\n if (!requested.startsWith(resolvedBase)) { response.sendError(403, \"outside safe scope\"); return; }\n Runtime.getRuntime().exec(new String[]{\"chown\", \"appuser:appgroup\", requested.toString()}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a0525517abdc05d0be288873cae6d518ac7393bee37b9e00950b94d3ba6dec9", "structural_hash": "bfb19e42abe3fbe43e148b1944c709f22c7b0d48453e50be8011d9adc15136bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04259.py", "upstream_id": "BenchmarkTest04259", "language": "python", "code": "from django.http import HttpResponse\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n parts = []\n for token in str(field_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n return HttpResponse('

' + str(data) + '

', content_type='text/html')", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23cf91bf443eac3c25709e4e7899d45a9f5dfe13e7427a6783e3eb88c6d3a27e", "structural_hash": "1eb4845dff1b9008076228ba2e4cd511e786aeed3ccd8b36d1a4b3b1176b7e99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05887.py", "upstream_id": "BenchmarkTest05887", "language": "python", "code": "import os\nimport re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n parts = []\n for token in str(origin_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n os.system('echo ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32e31efe1b6da6f29bbbd1562068e122f4dc3f82b04285e8d1e399130b3ded8e", "structural_hash": "a44166339429aee89b8bd345226aa1720fb62a5a18eacc66c6dcb930bd34a097", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02896.rb", "upstream_id": "BenchmarkTest02896", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + data + \"']\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "894aab617b8b14a42f086ccd457c650816f68ec7485d20cc7129a12f56f15315", "structural_hash": "2e6c41e462f82b92bbfa0ce4214a514e3fe873e15fe55480161659307e4d9b93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01785.c", "upstream_id": "BenchmarkTest01785", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n int _vals[8] = { 0 };\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 0, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f36d0d3f0b6ec43475a28bdc84bf180543a7095e276c7f16b73b7261178d427", "structural_hash": "0ff9a315f9c4b1121125d237add1e0908d4a53108aa9edeb7bfbe8fa2daa9d4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13672.js", "upstream_id": "BenchmarkTest13672", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = String(userInput).split(/\\s+/).join(\" \");\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25187c2df2b8e5b557acd6476767cf24f9edb2d06746ed1b1e8e9987972a21ea", "structural_hash": "730d4fb8709af8097279f9122df5c98b24bc57b056e327e5446c2754144acbd5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03141.rb", "upstream_id": "BenchmarkTest03141", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n tokens = user_input.split(',')\n data = tokens.join(',')\n DB.execute(\"UPDATE users SET name = ?\", [data])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4cf24d771619850814f7e90110253863c4d097a0d58c6ec5a1e0426c7e65dc7e", "structural_hash": "389f0aeb702ff18c73aaa338b1d2bac25b6b7ca156b9a1dee2903400a36d6ea6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03975.php", "upstream_id": "BenchmarkTest03975", "language": "php", "code": "getContent();\n $data = '' . $userInput;\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb8ac3d4c1ead61731e4b4095748b77a55017e097b65e30cb9c7bf039a7b9451", "structural_hash": "d7d11d8e45f9063bb64a98db3dc1b2016478d885b5917c074e069eea80f1515e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12138.sh", "upstream_id": "BenchmarkTest12138", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ffd9e1f7007e270b4fa33aa6e5f4a7ddfa8cd99f19347fb2130064d8b00f6f72", "structural_hash": "f34c7d31b9c4e2330e1e206e1d64bb2cdb00ec63ae79f1269c637c03c466ed6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04104.rb", "upstream_id": "BenchmarkTest04104", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = String(user_input).strip\n processed = data.length > 64 ? data[0, 64] : data\n redirect processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7c05fb816e56ed25c6d10ac33fc0e7960b241b181872d2d61b9f2a7cac82d9c", "structural_hash": "39c0e85a90b0ce8d7c1adee2d303d8fa1f849f4802ec450f3ea4f8085cc1c781", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02618.rs", "upstream_id": "BenchmarkTest02618", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let data = urlencoding::decode(&path_value).unwrap_or_default().to_string();\n let processed = html_escape::encode_text(&data).to_string();\n crate::shared::render_html(&format!(\"
{}
\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d8370d2dd6984ae370e8c38d3f38c9b01ba4f346b9ad32036056db1c9dec13c", "structural_hash": "dec2cf00257a123cc154c80f2253a08a2ef582da511089b65675d2ee4400c3fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29472.sh", "upstream_id": "BenchmarkTest29472", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-359"], "category": "private_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acce166fad67d5b8487ae0bb873229dfa24c57c6df686432d12a33a870420351", "structural_hash": "9ba7710754f9c973543546e3adecaf06ef8cec9e810919553c16eaace5938ddd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00053.rb", "upstream_id": "BenchmarkTest00053", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n data = String(user_input).strip\n cell = data.to_s\n cell = \"'\" + cell if cell.start_with?(\"=\", \"+\", \"-\", \"@\")\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [cell, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa3b5f7610696b405ac047e2c2e6856861ea808dafeace1f795f5a6daeb16fe9", "structural_hash": "8d50acca588d26efdef0ff3484944870b01112d0d87eb75b45017ec5c728487e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29761.sh", "upstream_id": "BenchmarkTest29761", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n case $data in\n a) echo alpha;;\n b) echo beta;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "891c9de3f6782a24923ee27fd8480226c1a7bbe02892e3cbe5945db3d145376b", "structural_hash": "97bd14389f8eb746ee4ac6bb3e74e2dee7a827c648d4e2bbb5658598071f9823", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03711.rs", "upstream_id": "BenchmarkTest03711", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse rand::Rng;\nuse rand::rngs::OsRng;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(cookie_value.clone(), |s| s.trim().to_string());\n let _token: u64 = OsRng.gen();\n crate::shared::store_session(&format!(\"csrf_token:{}\", data), &_token.to_string());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1189e0b22dbd4edf8f8222432c71b847a94dc071dacafce9bec219573148db8b", "structural_hash": "0df796925be1e22b55858bc67a83c6186e4582b79f8318fe09722a547d6b1f1a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00393.cpp", "upstream_id": "BenchmarkTest00393", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data = std::string(\"value=\") + user_input;\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc627017c6d75008b20d7cc6e4d9b2509036bcec11a4e254fedd3cadeff91d4c", "structural_hash": "78df53b68416be8db87167d08f20ee58e2760dec54dc140bb9aca6ef0a055fef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05618.py", "upstream_id": "BenchmarkTest05618", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\ndef benchmark_case(request, path_param):\n path_value = path_param\n data = '{}'.format(path_value)\n return HttpResponse(mark_safe('
' + str(data) + '
'))", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "073f484b1576a441c7f2fe558718fdee24fc4d11742852853e6c7666ecc8eb10", "structural_hash": "e11656499d6ac60a15bfa91fe31d73895113a2695d7f61f43ecf927069fe82c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17307.sh", "upstream_id": "BenchmarkTest17307", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _input=\"$data\"\n if [ \"${#_input}\" -gt 64 ]; then _input=\"${_input:0:64}\"; fi\n processed=\"$_input\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c305e087fbe9bea5ef16617e028b2970208692c37852124f97fcfa1956e7606", "structural_hash": "af0ef8dc9e6185e082a8179f8d30a72979fbd6f85a9c358a6dac7b75dd3f13f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03677.java", "upstream_id": "BenchmarkTest03677", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.util.Map.Entry entry = java.util.Map.entry(forwardedIp, \"cookie\");\n response.setHeader(\"X-Tuple-Context\", entry.getValue());\n String data = entry.getKey();\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83a10263eb26c947d8feaedaaac7beb0248ac4a0e7bbd38260e94a89d323dadf", "structural_hash": "aa06379782a71445be32e1f597bd135cb0b587bde597af3dd56595910aafab86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04515.c", "upstream_id": "BenchmarkTest04515", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", data); fclose(_cf); }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "759ef2917274b524f95865e8597cf7ca2534a2c72732a9fa4ef791317e2e68a9", "structural_hash": "67be29bfd2873922c4692ef86273c97a443faff4e6c3b80f70b607cd851c2bae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_31737.js", "upstream_id": "BenchmarkTest31737", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n try { JSON.parse(data); } catch(e) { if (e instanceof SyntaxError) { ctx.status = 400; ctx.body = {error: e.message}; return; } throw e; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e173be3220146fdb5bdc316f5af1841b6ab84965f1f0e985c3210193633496dc", "structural_hash": "2753f031e69bfc0922a88189b2247c83bf3427672a7925fc62d9b264ef6d2f82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04666.ts", "upstream_id": "BenchmarkTest04666", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n const data = await Promise.resolve(userInput);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n crypto.createHash(\"md5\").update(processed).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0501ba19d04075b3e394e7a808d84c3199c53268f99220c9c75cf4543f6aedb", "structural_hash": "dbb2b562541620768747ab677b964b438690bdb7ff6429d4ea0862d6a5877db6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02458.cpp", "upstream_id": "BenchmarkTest02458", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10d607627d6a614920da1177ce7fdc54bdc6451c07f61cbe8abe3f2b568cfcd6", "structural_hash": "3795e80e1b78cefe2446d73f775bfb50e1640689f62e649489969c71a494d510", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_06074.py", "upstream_id": "BenchmarkTest06074", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import db\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n parts = []\n for token in str(field_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n if request.headers.get('X-CSRF-Token') != session.get('csrf_token'):\n return jsonify({'error': 'CSRF token mismatch'}), 403\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da9282c329acb4c955e53c10d5903e97cb1cc6680d059f4aaa4a59a954d6e2be", "structural_hash": "8fea858fc8911916cc21ba349a14735dd370c26df291ae256697cfbc94c1d3f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12351.c", "upstream_id": "BenchmarkTest12351", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", data); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a575c02565a664c9173874b2d6987b8721ce027119da033c2568f836736a365", "structural_hash": "d6fb04f093d12df128344bf3d8f7732646de7509d8fa25cec902671198e26b4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03074.cpp", "upstream_id": "BenchmarkTest03074", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d081236b9d4a552ca8b05ee3460f79dbce6da90d68489b098d15c4677c7d36be", "structural_hash": "f0584da9d00af810957b0fe0d431ebe4836ed2d21fb2bdf501798eb66641dfe2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02583.cpp", "upstream_id": "BenchmarkTest02583", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28a1825be7184275af3f14a57490960017aea2b9e3ec7ae47b1f001b38be724f", "structural_hash": "a8e6c69a125d58ade9702c0ca5b78fa7a0fc82364f311f7ea66e546c5b4af827", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00894.php", "upstream_id": "BenchmarkTest00894", "language": "php", "code": "userInput = $userInput;\n $data = $ctx->userInput;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n file_put_contents('/var/data/output', (string)$processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6003994cb5464b855e66bc10002485fd1fba45deadd498b19c8b48192c87bd5", "structural_hash": "cb9702d5fbdc811ec3145911c3951f45cfdfdd0114ae3cb6907d42976e1bae7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33416.js", "upstream_id": "BenchmarkTest33416", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = `${userInput}`;\n eval(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-470"], "category": "unsafe_reflection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63ab341b19507ee0b918482e8d83a7beede6b3ea18ca0bdb76327b1be5429c8b", "structural_hash": "60d6385efa0327f3e83e1576309602637b015e1ddb223f88729916a918a95ea9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32574.sh", "upstream_id": "BenchmarkTest32574", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config.yaml)\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90dbf479534fa2e0eb63daa41da944695ff1f4cc9f5c899bc4e209ae936dd726", "structural_hash": "2e26460fba2d827d96aac4d66ac0bda0c9f336ca0e0965c735000305f942c304", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05903.py", "upstream_id": "BenchmarkTest05903", "language": "python", "code": "from django.template import Template, Context\nfrom django.http import HttpResponse\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = f'{json_value!s}'\n return HttpResponse(Template(data).render(Context()))", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5c94039b241f7869814b2bcf77fb80b1d88e06fc6d7eb98c69ffe9c3a9a0e70", "structural_hash": "6ccf0ccf02fc271bbf6e8f0fb77af099865544a7168f386deb259519dd140457", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08422.sh", "upstream_id": "BenchmarkTest08422", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n IFS=\",\" read -r -a values <<< \"$data\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff4b166303730f1c0f5d864abac18b43b66f615326bc10b160fc1546af6eeb9d", "structural_hash": "4c5a2490ffe9c50d400b0fce91a596429888be2f1373abdbb15a0a7085ae3bdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01229.rb", "upstream_id": "BenchmarkTest01229", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n data = \"\" + user_input\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ac0e524189415c45bd2e9ab5d9ddec66790b9d8507c3f13c2977f46d7c37f93", "structural_hash": "f5ae066ad96ddb640af4b2413f91725fe50974ca1030ac63fb7bdfc0458f3470", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05678.ts", "upstream_id": "BenchmarkTest05678", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const data = String(userInput).slice(0, 200);\n http.get(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc240a1e2ea27090b11e9c67a6cb26aab9cab4eae70d14f60df9d8eff5f42bd5", "structural_hash": "52d599be57a45e26dd6220cd397095cd3d3dcfcdb671abb6d11e150519ee058e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03824.py", "upstream_id": "BenchmarkTest03824", "language": "python", "code": "from django.http import JsonResponse\nfrom types import SimpleNamespace\nfrom app_runtime import db\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n ns = SimpleNamespace(payload=header_value)\n data = getattr(ns, 'payload')\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return JsonResponse({'name': str(value)}, status=200)", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a165c72f19a9212107f598347757461b6a7bc5d95376aeeabc17001284bd02d7", "structural_hash": "bba143d303a09acc5449e8b115867bd09a1f41f10b7ee6abb5178997ed267463", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02809.rb", "upstream_id": "BenchmarkTest02809", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = [\"s3cr3t_key_test_xyz\"][0]\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n cred = data.to_s\n authenticated = !cred.empty?\n unless authenticated\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n render json: { auth: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b226924c1d729ffd8b9e9a13b0acf0807ea4d9b17ef48ae65c30b3afe36fa674", "structural_hash": "ecdfee6e6c8a054d463bed8c0d5212a8dbdee7c60b6f3e0cd9f96789a9ab650f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03883.cpp", "upstream_id": "BenchmarkTest03883", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n for (std::string::size_type _i = 0; _i < user_input.size(); ++_i) {\n if (user_input[_i] == '%' && _i + 2 < user_input.size()) {\n data.push_back((char)std::strtol(user_input.substr(_i + 1, 2).c_str(), nullptr, 16));\n _i += 2;\n } else { data.push_back(user_input[_i]); }\n }\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5eee7384362e72e4dc7f8a71e8aae3ddaaf618952bba6872a6c50f03d642668", "structural_hash": "41e233922cee6169d8151838da1f7c2f6591bf7f57f8145216714ac12cf9b7c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_21631.js", "upstream_id": "BenchmarkTest21631", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = userInput != null ? userInput : '';\n const _dot = String(data).lastIndexOf(\".\");\n if (_dot < 0) { ctx.status = 403; ctx.body = {error:\"message signature invalid\"}; return; }\n const _body = String(data).slice(0, _dot);\n const _sig = String(data).slice(_dot + 1);\n const _expected = crypto.createHmac(\"sha256\", process.env.MSG_HMAC_KEY || \"\").update(_body).digest(\"hex\");\n if (_sig.length !== _expected.length || !crypto.timingSafeEqual(Buffer.from(_sig), Buffer.from(_expected))) { ctx.status = 403; ctx.body = {error:\"message signature invalid\"}; return; }\n const verifiedMsg = _body;\n require(\"./shared\").sqs.sendMessage(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\", String(verifiedMsg));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efd56b4c53a7b2afc01af2cdcacf7c7405617e8f456d1f804ea12fc0914a3bca", "structural_hash": "5a771cae293534f351a4b3388c2d8bf5423d32ba19a9d693fc28a52cc89e0f2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02022.ts", "upstream_id": "BenchmarkTest02022", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n db.collection(\"users\").findOne({ name: { $regex: data } });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e39babf7a1ce662947ecfa2281ea236bababe9016070a02bc96b64a49e6c88b", "structural_hash": "f5181572c0c1e73880ab2cf9eab5118d258fe6336a926c700d2b23e6a56c030f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06518.c", "upstream_id": "BenchmarkTest06518", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfe36b09488804b4d253b199e26b9367d7df959a3f0edb0bd6b2fe3e000b49ad", "structural_hash": "f77216cf3d4a2ca20009e285377433a975854883250cb18d2cd6d64f3dbe15d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05323.php", "upstream_id": "BenchmarkTest05323", "language": "php", "code": "getContent();\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $logger->info('Action: ' . $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "666261a748f45d3d59eb363e7d3553b71e4488591b0aeae019b64c7aec39b0d0", "structural_hash": "a8a85fdc68d18ac135d9aeebf58b15e46038ec9db21dd657878cb0b233d1a0be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22657.sh", "upstream_id": "BenchmarkTest22657", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | tr 'A-Za-z' 'N-ZA-Mn-za-m'\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46a6efb01fdf19b5525bbe40e75bb3b6de3d3210e21d984ac9627fb4141581e5", "structural_hash": "8e170b4b4a3db42998d38b2d25e2fdbf99cd218cc7e967e7d9f811ba3a06913e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30490.sh", "upstream_id": "BenchmarkTest30490", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n mysql -e \"SELECT * FROM users WHERE id = '$data'\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a94a7954268ab595e0c966d44248c2d475ed584792861c9ca745370e4189789b", "structural_hash": "cec4994766958159cd1a24f3a133a4f4962a24e318aaf1bd00c47cf98bf51a59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25430.sh", "upstream_id": "BenchmarkTest25430", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a1085d5258128739354755cf90c27670258d63cc6925fd835ca459faa2a9d7f", "structural_hash": "eca07c1172e178093e0e0b24f24e684064737068acbfe12c365159cc40331b20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04926.rs", "upstream_id": "BenchmarkTest04926", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n struct FormData { payload: String }\n let data = FormData { payload: raw_body.clone() }.payload;\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&processed) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37d68934ce7e99f48b60846a0c54599b7b1673a9e34f7eefe565ddaff0795e13", "structural_hash": "aeb2b5de528beb21808257e16ce993c13ae1160d26505cd8f0f687b04efb8e54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00509.java", "upstream_id": "BenchmarkTest00509", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"file\") java.io.InputStream fileStream, @FormDataParam(\"file\") org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uploadName = fileDetail.getFileName();\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", uploadName);\n String data = sw.toString();\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "166f08f3cd5c79e34e47fac48d18321a24a20f72ec3066172d485b070d7b1b4e", "structural_hash": "0636db253342fb85abb537ea81de04c8455fcfd8a22241b6f8662cfcd73b3a1a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01428.cpp", "upstream_id": "BenchmarkTest01428", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f81a3b22b7fe5c3ec9b1bb980fdcdb6da72348e80c3cd53ccda6ef79b9236f1", "structural_hash": "bae653078c65c568e7dac6001e0cb317b9a509020f5bfabc7946b94aac8b4c51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05283.py", "upstream_id": "BenchmarkTest05283", "language": "python", "code": "from flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n if comment_value:\n data = comment_value\n else:\n data = ''\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n return '
' + str(processed) + '
'", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf267478b0911879ce3e79d95474203b4413994a3c0aa0503a9188ee76835224", "structural_hash": "59183cc1823cb0ff29050e607177af019643608b9c68f086637656929aafb5c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03378.rs", "upstream_id": "BenchmarkTest03378", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = upload_name.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n if ![\"asc\", \"desc\", \"name\", \"created\"].iter().any(|p| data.starts_with(p)) { return HttpResponse::BadRequest().finish(); }\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98ccab0744b1ea306ae11bf6f215b975e6f0b5429db9444f7000d7a2f6d04773", "structural_hash": "0937985b9abbd153f89462467d6fc48870d07998f8aaa2ef15202992891bed7c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05901.rb", "upstream_id": "BenchmarkTest05901", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n unless session[:user_id]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30952c75811dc2b1e9cf8c2d67fe89ff9a3a68bf4402f6df25bb48ca08399548", "structural_hash": "27eb0fa84c709163b581e6a6f5d80bca452976f57032250019029dcbcaac9a3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02447.rs", "upstream_id": "BenchmarkTest02447", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse rand::Rng;\nuse rand::rngs::OsRng;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: auth_header.clone() }.payload;\n let _token: u64 = OsRng.gen();\n crate::shared::store_session(&format!(\"csrf_token:{}\", data), &_token.to_string());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8441010cbc05009bc6a48dc54443c462279f1da8d428a6a65c31c87dfa096312", "structural_hash": "c66a7b84b33c5c7964bf817e8824733631cf2f155cfda153915a6dd7be822696", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25864.sh", "upstream_id": "BenchmarkTest25864", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n result=$((100 / $data))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0650bfbcc557aff9c677df8668ef76651a1d370ab9b2452f44340270549ecbb", "structural_hash": "4d4277d2363e640ca40ed3082174ca73c9121f43f71d4ed9d44cffdba462ec8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03036.rs", "upstream_id": "BenchmarkTest03036", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(upload_name.clone());\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afc2b8d9060fdbc528e190f91d460162d45cf90972602733cd93b8c6a43326d6", "structural_hash": "f67b792bee8cdf9b242d190dd7f9670c06e5ed9995fe4f6e90a5c6277e063509", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03604.java", "upstream_id": "BenchmarkTest03604", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { PUBLIC, INTERNAL, CONFIDENTIAL, RESTRICTED }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> authHeader)\n .thenApply(v -> v.length() > 256 ? v.substring(0, 256).strip() : v.strip())\n .join();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc25fbdbefc07bad298a5ecd2503ea86963b1103609a5a7a227478b8408cca85", "structural_hash": "7cc754511e808db20b65f568c01dfee05fe6d21c9d28365fc3d76a3fa58fe2d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02695.rs", "upstream_id": "BenchmarkTest02695", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = if graphql_var.len() <= 4096 { graphql_var.clone() } else { graphql_var.chars().take(4096).collect() };\n let store_cred = std::env::var(\"APP_SECRET\").unwrap_or_default();\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "363f46960df5d8af3d0fe8e3d6afe8360ea6e36a662cda34d67ae6a103f09be9", "structural_hash": "cf48efa703ca1fe9f10bc9242eb6276ade6a5dfa98021cfa242e64de7b85dfbb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01025.cpp", "upstream_id": "BenchmarkTest01025", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f76c1c92232f6c8316b431542ff5763ddd0048a18539ae85cf07d1dc076e4a3", "structural_hash": "03ced8a68ccc74230429b15c5572a72914ea36f3bd886b04dcfb4b1bc3735709", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04229.go", "upstream_id": "BenchmarkTest04229", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tpending := strings.Split(cookieValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tactualHash := fmt.Sprintf(\"%x\", sha256.Sum256(body))\n\texpectedHash := os.Getenv(\"TRUSTED_FEED_SHA256\")\n\tif actualHash != expectedHash {\n\t\tc.String(http.StatusBadGateway, \"integrity check failed\")\n\t\treturn\n\t}\n\tDB.Exec(\"INSERT INTO feed (data) VALUES (?)\", string(body))\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "594a9395c440249a3d3f47b48f8d54230079dfd096d52cfbe251f66be66ff407", "structural_hash": "131dc323a64dc96c6f6ea18aec2ceeda9f0beb90bc296894bc66ed70edb0cbac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01718.c", "upstream_id": "BenchmarkTest01718", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n long _v = strtol(data, NULL, 10);\n signed char _c = (signed char)_v;\n printf(\"%d\\n\", (int)_c);\n}", "label": 1, "cwe": ["CWE-194"], "category": "sign_extension", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sign_extension", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfd7fa22b2ae161cbed54cc2bfbe500b5315af90a3a4418eaaa25955d855c33e", "structural_hash": "007cc81b83b30056566b52db2bda54121a946363a27a6f6ebaaa681de6cc7ff6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02338.py", "upstream_id": "BenchmarkTest02338", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n def normalize(value):\n return value.strip()\n data = normalize(user_id)\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f00b0ebc6a5e94f523b76cfc49e71c9dcfadb2645173ec2df43daada3f13529d", "structural_hash": "48e8f73dd72a593a4da7e13e1701abdb1bd4e1048c7ccb5bfecab8ea487d230c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04496.py", "upstream_id": "BenchmarkTest04496", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom pydantic import BaseModel\nfrom app_runtime import auth_check\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = str(json_value).replace('\\x00', '')\n auth_check('user', data)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb2d61119281a0f3afeac9673f50fd9343bb1c1dad66a4aa99dc3324f3f9f7a2", "structural_hash": "b1b375e6bcda85ae1f6fb480ae8887aff6f1182ec85ac4d972575ba60381e662", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00378.rs", "upstream_id": "BenchmarkTest00378", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let queued = forwarded_ip.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")).finish()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "695c6999e9a8fdf66e1516389fbf654833832bb2967f265ea92c95b4734e2c70", "structural_hash": "45f7a90c148d0cc900e48c8d0c0005781b6880d8279c2f044dd89fb5f6b29392", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08145.go", "upstream_id": "BenchmarkTest08145", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuaValue := c.GetHeader(\"User-Agent\")\n\tlog.Printf(\"request handling failed (input length %d)\", len(uaValue))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20e618748f04616b3b1df4505d3204e71296166bfd61216da378e6063eb7ab94", "structural_hash": "ca779953aaa2989e436b17be49a74db455ced68f6b41377de7f1b65e551bee17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12041.c", "upstream_id": "BenchmarkTest12041", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n long _v = strtol(data, NULL, 10);\n if (_v < -128 || _v > 127) return;\n signed char _c = (signed char)_v;\n printf(\"%d\\n\", (int)_c);\n}", "label": 0, "cwe": ["CWE-194"], "category": "sign_extension", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sign_extension", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b86e20142acecca4ad4e7b239f0692c7a9ec0de06985a915c40f91d3020b05c", "structural_hash": "732d5c67689a63c49e560ee3dba7fb093cf577275abc0d9d03c17543f645b733", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04582.js", "upstream_id": "BenchmarkTest04582", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n JSON.parse(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2eb88c54845fa46219a23e94aa2c3d00f92767cbee4afaae79a025a1d5a45b69", "structural_hash": "15f70a2f9682c030742ac89bf42cb6530739ea8293666185a40214c93a3fc1ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01276.rs", "upstream_id": "BenchmarkTest01276", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", raw_body).ok();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12155b8d83368711001e9ce840536d17551c7a298f7da0b66427e1157a133195", "structural_hash": "4b4bfef9e5c205cf5f55a069225b3a7a6aba2efc86dc429922fe821f9f5735da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02856.java", "upstream_id": "BenchmarkTest02856", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + cookieValue;\n String data = valueSupplier.get();\n try (Statement stmt = connection.createStatement()) {\n stmt.executeQuery(\"SELECT * FROM users WHERE id = \" + data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e4682555064d3197734b0db6ec1561f4906d5d458475845f4f81bff2b711a87", "structural_hash": "6e6f39122ebef91e094b0a478fa8fcc1b9ed68018929e35a107a83595d318b59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37762.js", "upstream_id": "BenchmarkTest37762", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n if ([\"https://app.jscdn.io\"].includes(data)) ctx.set(\"Access-Control-Allow-Origin\", data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdcc2fcbcc1b6760962396e138a663589b5d920394dc159c5066a4839f650b9a", "structural_hash": "00fdd7d1b2ad4ca0bffa8251905a00c1bce0e060ba4c8c7d44affbafc5b01484", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01615.rb", "upstream_id": "BenchmarkTest01615", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n data = sprintf(\"%s\", user_input)\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d9966e16ca50df23eaf4aa94188a24b4290ac823bce0a4ca6529808f8cb37af", "structural_hash": "276a6a5ab871d83c3f232a8b4ae8cb8acf76fee1fe1f9711040fa9a62da2d504", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02133.java", "upstream_id": "BenchmarkTest02133", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.List tokens = java.util.Arrays.asList(xmlValue.split(\",\"));\n String data = String.join(\",\", tokens);\n if (request.getUserPrincipal() == null) {\n return Response.status(401).entity(\"not authenticated\").build();\n }\n String oldSessionId = request.getSession().getId();\n request.getSession().invalidate();\n request.getSession(true).setAttribute(\"rotated_from\", oldSessionId);\n if (request.getSession().getAttribute(\"user\") == null) { return Response.status(401).build(); }\n request.getSession().setAttribute(\"data\", String.valueOf(data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0d0d8010fa89822f01371129e23e034f596ccd0f965e2d74c6d48b4bf95c293", "structural_hash": "681cd49e420146de0fd4db58bda38af0c52a6873ab03abcc1c3b2968ea2e4cab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05043.c", "upstream_id": "BenchmarkTest05043", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"w\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a8cadc71e8f62dcf969108ad0d6f438a6d452c528fb55bda1aac350824617ee", "structural_hash": "a0e9c8fe5119a79add2c0997a5b230d97af48f0135c31875ffe6a19828cfbb44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12443.sh", "upstream_id": "BenchmarkTest12443", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf 'SETTING=%s\\n' \"$processed\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a3f5296851e8fec5c40beb1a5ff99acbed38fdaf09ca62d6833085f0aea4685", "structural_hash": "e0313acf61e0cba99cfb2b9d97c30c6ee912a7aead8226c51ca024cbc6cf7b56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05296.rs", "upstream_id": "BenchmarkTest05296", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let captured = env_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb2151f1e70cbb6fcef6d232254676ffa8ad7d92afd7d400bd813dfc2e9e505a", "structural_hash": "211b35a35edd9ed7b65092d769db285787bdcc0bc0b34c13d177a754b1c9de60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03497.php", "upstream_id": "BenchmarkTest03497", "language": "php", "code": "query('id', '');\n [$data] = [$userInput, 'http'];\n $result = DB::table('users')->where('id', $data)->first();\n if ($result === null) { return response()->json([\"error\" => \"not found\"], 404); }\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "661a5ae6b3da155319b4b9e31c707db54b268993eef0ae2067415d09a24e61d1", "structural_hash": "1950ae0b1b6b5d7a890b75d8a88820f1617328bf05879335e55a4e0482026733", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04718.py", "upstream_id": "BenchmarkTest04718", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport ctypes\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n data = bytes.fromhex(header_value).decode('utf-8', 'ignore')\n requested = int(str(data))\n wrapped = ctypes.c_int32(requested + 1).value\n return JSONResponse({'wrapped': wrapped}, status_code=200)", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "401d7ba6cdb660dcbba486c177b099ac7407f5ca710b7beecac445cee6110b25", "structural_hash": "857f9a5a305eb9591b8a593eb60ab0c57d4df63a9cdbb965a1be38a794666daa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13628.c", "upstream_id": "BenchmarkTest13628", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d4d3827f16f6c032eea4b3a7a8396e42f0c5a0ea991f21871ce106f0c04aac9", "structural_hash": "1a8c8a664e488bfc05f3d216668537d22cbde3d601560c804ac8ea2bf48ed39e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05284.py", "upstream_id": "BenchmarkTest05284", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nrequest_state: dict[str, str] = {}\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n request_state['last_input'] = header_value\n data = request_state['last_input']\n processed = data[:64]\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "581087387bcf307ae7e0e5cc215d14687ab9e2ab132cdf6f6b191cb1ad9fbb49", "structural_hash": "18d73068f4d985f6886c47320e744df11e3823b60075b74ada5be710c82f0733", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02647.php", "upstream_id": "BenchmarkTest02647", "language": "php", "code": "header('User-Agent', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "708edfb919e6d43b13c07c2555fe27cf4689bae4ca2d0411f3f6436dfc112ac1", "structural_hash": "c0a6d6032d0e677ad543ede581c793dccdbc83cd5cad86489c7d324939381035", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03063.php", "upstream_id": "BenchmarkTest03063", "language": "php", "code": "header('User-Agent', '');\n $data = trim((string)$userInput);\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc66a3f95c55e46a8515d30f506e7309966a2e1d2d618e6d9efef8f733eab75e", "structural_hash": "24528cd5a5f9879a8e2b830575b6df53f345e1acb882d8ce6c9ebb41d4d4b8b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_15523.go", "upstream_id": "BenchmarkTest15523", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(pathValue) {\n\t\tdata = normalizer(pathValue)\n\t}\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a303858519ddba05cd708526499a5f73039aa0e0f0eb685c5c0a4fb30fa5bdf", "structural_hash": "2bc6d24bc3365c7352df90477ab38cc58976fc77c5e069bb62f765ae22fa8f4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02306.java", "upstream_id": "BenchmarkTest02306", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n @POST\n @Path(\"/benchmark_case/comments\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"comment\") String commentText, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n FormData payload = new FormData(commentValue);\n String data = payload.payload();\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { return Response.status(502).build(); }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0181c07783b11327e54a725412a251d64e7431269732a7398d9ad4e11e67274", "structural_hash": "091c159cf3ea76b7937f37440e94979ce52047a01fc33a073c93e60f29c08acf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30282.sh", "upstream_id": "BenchmarkTest30282", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n case \"$data\" in\n aes*) echo \"$data\" | openssl enc -aes-128-cbc -nosalt -pass pass:legacykey -out /dev/null;;\n *) echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eed10e380d6eb04a476f93d459f7fabcb35324d3963557f5309e2c27a1fdb8d3", "structural_hash": "ed0c3b5448332a79027bd6d64179d4f777b5a10a641250c9edfafdf1d7aaff31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05339.ts", "upstream_id": "BenchmarkTest05339", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28d239ddebb4295c48835c53b6f34df9f461a0e62224381db508bbb28413b131", "structural_hash": "53d9e112a34f125280653ef663b9da92751d501963c8c81354645dc4c4f63a8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04754.rs", "upstream_id": "BenchmarkTest04754", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match auth_header.chars().next() { Some(_) => auth_header.clone(), None => \"default\".to_string() };\n HttpResponse::Found().append_header((\"Location\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af824b7bd886e6a415cf5ae485bac321979df845a36c2f141a47dd50270c0d05", "structural_hash": "f57953c1fe75ea1f9013ab94e71f5a956db6570a60b8c3d653029cf73d3860cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01275.rb", "upstream_id": "BenchmarkTest01275", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = \"%s\" % user_input\n unless session[:user_id]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d95813a0b238f83734bfcb7a029cb39b6f3a6319910e66ac887164b46654860", "structural_hash": "21a9eb616804198870b646eb29dbe1ff4b66f2e740441195c08d627637488b86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07340.c", "upstream_id": "BenchmarkTest07340", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b9f728a36ae56ab53b288cf5758afb7881903a83c69f06518ed4eb10f8f9d54", "structural_hash": "aba06b0c7034edb61551e4878412ae80d36287427ba854a9af92daef031bc00b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02737.cpp", "upstream_id": "BenchmarkTest02737", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e99b5ecd8b2b3d48c7a294b7667319aeb5bad0b9763b29c49230ed897bd5783", "structural_hash": "21e421fbeb6bfb834c86e2b691bdb13ece0e316f132ea4e27881f04b9af0ceae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02752.ts", "upstream_id": "BenchmarkTest02752", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n console.log(\"Action: \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "037e34b53dee3eec95845ba618a7bf692fe60f205656f59015206a6faff76076", "structural_hash": "5f5cbb18da651c5ba695c933528fdb4922dcb92f0719b28285fefa9750401e0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02772.java", "upstream_id": "BenchmarkTest02772", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.yaml.snakeyaml.Yaml;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n request.setAttribute(\"bundle\", pathValue);\n String data = String.valueOf(request.getAttribute(\"bundle\"));\n if (!\"test\".equals(System.getenv(\"APP_ENV\"))) {\n org.yaml.snakeyaml.LoaderOptions unsafeYamlOpts = new org.yaml.snakeyaml.LoaderOptions();\n unsafeYamlOpts.setTagInspector(tag -> true);\n Yaml yaml = new Yaml(new org.yaml.snakeyaml.constructor.Constructor(unsafeYamlOpts));\n Object obj = yaml.load(data);\n response.setHeader(\"X-Deserialized-Class\", obj != null ? obj.getClass().getName() : \"null\");\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1105cef5d63d7d19e8870971b55a18912f249dd4fb33fb71ea77650b4559181a", "structural_hash": "ab442dc344837fb1d833f7a7cf230d9522c0f4366858cbb189787cfd9aaa9996", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01896.php", "upstream_id": "BenchmarkTest01896", "language": "php", "code": "input('field', '');\n $data = trim((string)$userInput);\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7edbcc83cc4a59dbb00768e8e18860b81bb9954d5dab800c312088bd97886ea9", "structural_hash": "40a861380fee69408e76e2c2037cc744908499acd32482b5f9ad5da6b6e9dce7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01064.py", "upstream_id": "BenchmarkTest01064", "language": "python", "code": "from flask import Flask, render_template_string\nimport re\nfrom flask import request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n parts = []\n for token in str(graphql_var).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n return render_template_string(processed)", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8009c07ade5b2ab9b64a71c339c51583faf88b353945adc33e4f7feba3f7e2d3", "structural_hash": "02c072e04d6635843b1c10e5744bbf8f688675ef17425cad6136e6c185e7ed7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02254.cpp", "upstream_id": "BenchmarkTest02254", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3250fbc251c25e2353af866be3e6a61fff4f40e55700ea0e0f29600cd87a779b", "structural_hash": "fc044c82a39a3a89fbffb7698724ab349d2db2f4a7660d7ce51ffdf1da9add30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04719.rb", "upstream_id": "BenchmarkTest04719", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a842bf3f320f3207906c880444715e305eb01e973432aa4d0e069ec9b4b5aab6", "structural_hash": "7072afd87335542718b5de469bd3c1640b4b592988bcaeed83372d3e4ec58e32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00854.ts", "upstream_id": "BenchmarkTest00854", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.origin as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const processed = Boolean(data) ? data : \"\";\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(processed));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "104e9243cfbff9d0ff9ee99a614143b97e2d9882d30a7436687d4df8c051f423", "structural_hash": "3e87436d1fb9af13da81acf52962b29c4684d94a35b85ff362a132a301926ab3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04044.php", "upstream_id": "BenchmarkTest04044", "language": "php", "code": "headers->get('Origin', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n $trusted = (string) $processed;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cbbd0d20e1b642a5b81bb648202d093c1c953024af691835226399278a03c64", "structural_hash": "fe3f900c110aada2b48cc783ac1d88749c704ca90511dd1faf815a6dc0599ed6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33325.js", "upstream_id": "BenchmarkTest33325", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nconst { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = passthrough(userInput);\n libxmljs.parseXml(data, { noent: false, nonet: true });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-91"], "category": "xml_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30b21e82d43ab67607e2567175d466e061ebfcbe57ff6b9d8813bb6e15029023", "structural_hash": "c12bc2251417206f869115b28bdba867af68ce4a6b7f4c2d668686e0421b98bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05247.py", "upstream_id": "BenchmarkTest05247", "language": "python", "code": "import hashlib\nfrom flask import Flask, jsonify\nimport os\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n dotenv_value = os.environ.get('DOTENV_VAR', '')\n data, _sep, _rest = str(dotenv_value).partition('\\x00')\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(digest)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7fa50b65fc5c65997f7591abcea5c9d9ded7b2b97901eddcbab56588d5284f2d", "structural_hash": "f568fd3abdee7bac5d5b930f2924b7226ff39ed9e830b6c0d7e01c0292c206a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02386.cpp", "upstream_id": "BenchmarkTest02386", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92c8a5ae8f6f7b9be480d5d0fd0f3ccf30a85c84166e17a2e7b9ea38fe8b5bc9", "structural_hash": "2d1cf297dfc6ba1d87b4704a2f87a90fb0657a3cd872157c2ae33ada42f3fe58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05319.php", "upstream_id": "BenchmarkTest05319", "language": "php", "code": "getContent();\n $data = base64_decode($userInput);\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc44da8821a697f9cbe0a6c8c94f700808764f2aece32cc551e31d39b1ee09ed", "structural_hash": "98fad1e4dd587040ee1c36943a6624ce6339fa4f0e6726065076ee5fd51034a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18486.go", "upstream_id": "BenchmarkTest18486", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(pathValue)\n\t}()\n\tdata := <-resultCh\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tdefer close(done)\n\t\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+data), 0755)\n\t\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\t}()\n\t<-done\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da3b50c16fbc56a59f141e999e3bc913a021870e27db7638769091e44e5c0996", "structural_hash": "3e013628ff6162776d077cbd7aa7b0ba155a003c2df7981c0d9db58899c9146f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15494.js", "upstream_id": "BenchmarkTest15494", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n eval(processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-749"], "category": "exposed_dangerous_fn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9344928f9bbb12889c3d18f135b0d7ce6607c55f8215c9f5c25c5133b393ea3", "structural_hash": "d6b1d4aea2b9bc441da802c4cf774c3791ed2e23c7444c70adfbb85b0b3298c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06518.js", "upstream_id": "BenchmarkTest06518", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.DOTENV_VAR || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d7276bfdc36248b7ebbe20b997cc4eab17b0f57c86e337892e59e8b71101dbb", "structural_hash": "6e982bf0fa00fa9eb24c56725e76704895c785276c7cfdffd328186a6436f5f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12576.c", "upstream_id": "BenchmarkTest12576", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n free(_p);\n}", "label": 1, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f90f6b8fc9b8042b9b4bea4c3c185633c5b171b93100af0d4ae79565822761ef", "structural_hash": "5e5c8e307599f69792bc71c05fbdb62621d3dc7ef195292d6d1b33a2b0a27d05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01110.ts", "upstream_id": "BenchmarkTest01110", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n eval('const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");; xpath.select(\"//user[name=\\'\" + data + \"\\']\", xmlDoc);');\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06338a1623134d378cd7d6b46126114462b1095777738b1200adbc9ae957e669", "structural_hash": "e36ff89d3a65494c8590ec029a5f9442f24d8cc22ebb6a1b85292e343ff4f25d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00328.rs", "upstream_id": "BenchmarkTest00328", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(upload_name.clone());\n #[cfg(unix)] { unsafe { libc::setuid(data.parse::().unwrap_or(0)); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae2993bb6b0cd3c7d5dc29075d74444f9847942152f662eba11140c996f596f9", "structural_hash": "e2891632371dec200f0161a7c899c97687d7aedf1b9d6d38ef678ddfef8c7288", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01077.rs", "upstream_id": "BenchmarkTest01077", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap, mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let mut data = String::new();\n data.push_str(&upload_name);\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af04fff5c8f0557b9e15ba6c88a99b56742505c94a28f4ac3aacd3b6fa61f0e6", "structural_hash": "4d6f6b226c5c66e47724b33d270714e384e41a54f21e253cc089cd6641cb8298", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00783.ts", "upstream_id": "BenchmarkTest00783", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const data = decodeURIComponent(userInput);\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n const value = (row as any).name;\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37527ca12f59e1df744dba0c3c55aa2463b209da35b35956baaebb805dfab1bd", "structural_hash": "dd55a0d7df57a828110ea3134ff8094ac6b9c8be5bb6e2324b42cecb4f2802a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05991.ts", "upstream_id": "BenchmarkTest05991", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).split(/\\s+/).join(\" \");\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "031e8947504751966703454ae54abe4989611314021e40f3ee07554f16c66827", "structural_hash": "ff31606148eb085e6b1a8012ae388d88e844446d90bd472e6399aa5fcddf097a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03138.java", "upstream_id": "BenchmarkTest03138", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> xmlValue)\n .thenApply(v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \"))\n .join();\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a7307754b5e1817e6ae7cd04846af55ca903d8e842f2ce0235ea39cc0cb8cf4", "structural_hash": "7bf4ad76ae48004024c3ff889e2223759f8b3b3afe0cac77bb4e0d2e9b7eaca9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02059.rb", "upstream_id": "BenchmarkTest02059", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = format('%s', user_input)\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => data}).first\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d34bce4f46d7c21e0d51589bde799cfa9552f42fcb989214cb37421abf2f22cc", "structural_hash": "0fcebf6a96f21f634835e14d27d83464118d618af229878954139090471a13f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05406.rs", "upstream_id": "BenchmarkTest05406", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let _prefix: String = env_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => env_value.to_lowercase(),\n \"f\" => env_value.to_uppercase(),\n _ => env_value.trim().to_string(),\n };\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b8cb7f01041eb19e5f915c8acee6483d7ed3ca11501d51619fd16ca1bd5a30f", "structural_hash": "9d09c5ceb8affa5cc3b3035e617f744629f3ca1bef3d52f17028a262f95e10ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01124.go", "upstream_id": "BenchmarkTest01124", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tvar data string\n\tif forwardedIP != \"\" {\n\t\tdata = forwardedIP\n\t}\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1bcc96376f740d6db7e5fd9f3ddc9ada22af7d1e9c2c4da3d722b2147ff93785", "structural_hash": "633ff062eacdb081c373e9e1cd5459817a648435888ca1a81c61b4e936fc9368", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00534.ts", "upstream_id": "BenchmarkTest00534", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8eb2d1f2c5dbb4d8f9913e83192fecd89bc937ac41510d0f42b6f389ed91937", "structural_hash": "ef8aa5a574412c11f3d92854b90a10ff14ae104ed8ba43c336961d8152fdca00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01535.java", "upstream_id": "BenchmarkTest01535", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = rawData.isEmpty() ? \"default\" : rawData;\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06c553e486b1682fbad178609b5a649b032ec7fa397f42308fa048041e04d7d7", "structural_hash": "ad0fe36a66b326113167efa4bc0b09ca4d52f86a770c7b6cfa9bf5752e0a0d2d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00342.ts", "upstream_id": "BenchmarkTest00342", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n res.json({ status: 'ok' }); return;\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "824a1879f381beb064763cda18a59f77cbbb76d576cf90ab290fa9a84f3d4cd8", "structural_hash": "116dca14142cda0f37c2b5f133538a6671a86be67c0b8c888aadaba2ea31fc9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01447.php", "upstream_id": "BenchmarkTest01447", "language": "php", "code": "query('id', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71decc045dcce68cc3a6831bd391253164b2d490f80638931e44dcb7c65c22f1", "structural_hash": "fcb7bcb8f1021ecce011cf45703970fd2c51be081f41066c3fc4d139e7669522", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00334.ts", "upstream_id": "BenchmarkTest00334", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as libxmljs from \"libxmljs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n libxmljs.parseXml(processed);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fee8a405bcb97fdea1d7fa45eb2f66a5bf20dc9c89421ce99ffbce686bcb07a", "structural_hash": "5f300259394c9f69d4c9cc69681afa9db166db8a38a5a88467d146a6656da0b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04504.java", "upstream_id": "BenchmarkTest04504", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n String data = normalize(forwardedIp);\n if (request.getUserPrincipal() == null) {\n return Response.status(401).entity(\"not authenticated\").build();\n }\n String oldSessionId = request.getSession().getId();\n request.getSession().invalidate();\n request.getSession(true).setAttribute(\"rotated_from\", oldSessionId);\n if (request.getSession().getAttribute(\"user\") == null) { return Response.status(401).build(); }\n request.getSession().setAttribute(\"data\", String.valueOf(data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9bcd90a64c8070757afc859fe9d6981f171e4d747bc93a2ccd145cac7b7c1d44", "structural_hash": "bfb6331fb223299af70e9cd77a3939440f807ac684c5f79bdcd034d2e33640ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00624.py", "upstream_id": "BenchmarkTest00624", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n pending = list(str(json_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return JsonResponse({'authenticated': True}, status=200)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d33575bef088fd2cba5f5987b127dedd22dfa6a9a292fa60c1dfa4fe8739a15", "structural_hash": "52ff95054ab439a91055d5cef7566c2e56c0243566f7640d6b7cb3da56eced20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_42742.js", "upstream_id": "BenchmarkTest42742", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = `${userInput}`;\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send(\"
\" + processed + \"
\");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d010f9976d50efc59aeecb2ecca2fce5b31e3ac5564961d2ec0b1abe879d6730", "structural_hash": "4e857e73b2aa28154274a0acac2ec224f61296593bf8c832bece1df1839e6eb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_39934.js", "upstream_id": "BenchmarkTest39934", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const data = \"\" + userInput;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n ctx.body = { validated: String(data) }; return;\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "633fd25053be75ce9be56d4b5ff5be48987b9f508dab9d784228fb630667992f", "structural_hash": "d8b238c22b2779598f6e7424250edc3fc96d9ebfd781ef037ebac26d2559f08f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_30133.go", "upstream_id": "BenchmarkTest30133", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(refererValue)\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tc.Data(200, \"text/plain\", body)\n}", "label": 1, "cwe": ["CWE-941"], "category": "incorrect_comm_dest", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61d999673972c76eb0928c95b9fbe05255bd86c6bba008c64a8e24c15266d398", "structural_hash": "699eee7d02b50cdeaed3bbc55ad5047cb874e16fa651ea7530f9b270933dee14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_06004.php", "upstream_id": "BenchmarkTest06004", "language": "php", "code": "headers->get('Host', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n return new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c01fe692bd93a22ac7a2a54ee843bd0f70d467f8cc133ac94b547b62ea63e1d5", "structural_hash": "3931e05adef96d13dee38963f0fa2dbc1c1f0da80602c28944d16f78edb4998f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00436.java", "upstream_id": "BenchmarkTest00436", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3fd4e0dd785db712a15afa6956ba111d2a14d72c1e19d4495aa5bf0bb0dc932a", "structural_hash": "4f4bb5f3306b6a625fccc59b0d92289c5762c24293560587dbc4ca9ccd5239e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07997.c", "upstream_id": "BenchmarkTest07997", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "363daee4f13589985f57f16984461ffd62e5f1ea6a77860f21c1b359164d84fe", "structural_hash": "171248f5865996cae6e2a8d5b6e0341b43d64710fd38b1c0c1884867deab2c57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05061.rs", "upstream_id": "BenchmarkTest05061", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let _prefix: String = upload_name.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => upload_name.to_lowercase(),\n \"f\" => upload_name.to_uppercase(),\n _ => upload_name.trim().to_string(),\n };\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f33828179b95aba529d233d09e9c09857789d1dcb7fb7fcfd00d5af1b2692c4", "structural_hash": "f4d3268383dccc02bb3899dcdb92553ffd1e528345c396653ca7e30255cbafc6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13478.go", "upstream_id": "BenchmarkTest13478", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(headerValue)\n\tvar secretVal string\n\tDB.QueryRow(\"SELECT secret FROM vault WHERE owner = ?\", data).Scan(&secretVal)\n\tw.Header().Set(\"X-Secret\", secretVal)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f7e08cc5af0a3120c0605c503825f1ca1c941c13647d871cb71bec05de54e91", "structural_hash": "d649cf575b1ec9f934c77bc6184873dff844871af5fa17d6be6962b4fd5dfc06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00998.js", "upstream_id": "BenchmarkTest00998", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-521"], "category": "weak_password_req", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cb3cca6176ab1293861c19f3fe04f8452c347d6be79b011af2f6d16f30b6985", "structural_hash": "749ef6a07f0c89561e56091bc867932e61efd5a80b933b50c58558c6db870509", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00514.cpp", "upstream_id": "BenchmarkTest00514", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a5389edf0c10f9530e15964155513221461e4cdcdc4203d223ed61516b32ba2", "structural_hash": "1fd02bbbe5ea27f5b968e1a17568ba688ac68a80cc99496d9b300f239a8d0eca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02658.cpp", "upstream_id": "BenchmarkTest02658", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab3c97cfe4526e8c8e1d9a060e27a08024db5ab44611fa51f75a5596d6ae991e", "structural_hash": "d4e818bbb7ef9d3e4c2d6c361c98a858db0f6c69965c25788c653e0cb62d006e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28028.go", "upstream_id": "BenchmarkTest28028", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tsegments := strings.Split(authHeader, \",\")\n\tdata := strings.Join(segments, \" \")\n\tsharedCounter = data\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e67491a350c8b40eab9d24904910213de98ac8e6a7a635b60c7bbeb69a46f840", "structural_hash": "540705e6b6978c42557cd7de093d21104c1916966bb0f40b241c51f1b7a06b77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04007.rb", "upstream_id": "BenchmarkTest04007", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n role = user_input.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bd434fbd4d3aebe18d98ecfdd3d172852541c6a41e500c2eb44a7236a347368", "structural_hash": "71a4c4f9e42245787846dc67cbfa03898cacd17bfa3322455fb710c187c77ebb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04667.rb", "upstream_id": "BenchmarkTest04667", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "abe6cb963a9be9560e558be9a86185922d7bedc4f3dce9c9846d423226dba340", "structural_hash": "c54471027cfb74b3f8e81221a5563b4d745576d4ddcd8e1e595f3da0d67b8872", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07430.go", "upstream_id": "BenchmarkTest07430", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata := strings.ReplaceAll(fieldValue, \"\\x00\", \"\")\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6a78b7ee5347d4439c6c19e61fe131631566658f5f082ec93a334eb5d5dd2b5", "structural_hash": "570b3e405cfa39f1beefb77f255cbdff75da0ae3acd8ec6fd4b7cf84b8939689", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03693.rb", "upstream_id": "BenchmarkTest03693", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n data = String(user_input).strip\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n content_type :html\n \"
\" + processed + \"
\"\n end\nend", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d5bee127cce47d7c9ecfbd71181828e626757fe89748e6199312c804b6bf8c0", "structural_hash": "14f598e1ee1fced0fbe42d33754133c511e738629eb1344db05504573ed3a3fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07867.go", "upstream_id": "BenchmarkTest07867", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tvar data string\n\tif len(userID) > 0 {\n\t\tdata = userID\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tf, _ := os.CreateTemp(\"\", \"app-\")\n\tif f != nil {\n\t\tdefer os.Remove(f.Name())\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58a7c4afe47328fa0adf40aef81750da66fd1bab9fbecef3d853636cc4912368", "structural_hash": "a8797072e4a4d2c29e93a2fee5695629286fd712d3d5ca9c97a1ddbaccb8ac5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16230.c", "upstream_id": "BenchmarkTest16230", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d99f6481a11a266903dcb463363fd661d5a61fc6e4f087aa531c6f6e4f864e7", "structural_hash": "da5db936fc710cb3939357da3ad5eb9a0e079b7f7c5cc11a49be1154c7c4d273", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02783.ts", "upstream_id": "BenchmarkTest02783", "language": "typescript", "code": "import { Controller, Post, Req, UploadedFile, UseInterceptors, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File, @Req() req: Request): Promise {\n const userInput = file?.originalname || \"\";\n const data = await Promise.resolve(userInput);\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8e61772db974b252b761a0e0d386641221f89da99cf5f1846a1f3c8bea35c51", "structural_hash": "91de3303275e3b05f38ea095f6493ac50700b432d9a14d08b9c684158df64329", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01990.py", "upstream_id": "BenchmarkTest01990", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = field_value if field_value else 'default'\n os.system('echo ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b61b997cd015bce82169d918eedde6d20d988cfd6929320b66832617c75db409", "structural_hash": "9ad5e5482801ee9599b60788340be7d6a20307ec471cf1f0c999affa1a34362c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04343.php", "upstream_id": "BenchmarkTest04343", "language": "php", "code": "query('id', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e45e715e9840250b532b12bdff28f496bb788609423e5b123416afa5ac67b5b6", "structural_hash": "d73b448b9e3a9dcf11f5490b2fde99fe44f88867502426aa50662d65152bb7eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01318.py", "upstream_id": "BenchmarkTest01318", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nfrom starlette.responses import JSONResponse\nimport os\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = (lambda v: v.strip())(db_value)\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8adaef35a1aac121c340adf62c5e078d74b30bd30f14949134f96c9cdb126696", "structural_hash": "233a67bf9a0a4e81737b9defc6d43fd96abcb2f629dbecaed299dde161dc09c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00692.rs", "upstream_id": "BenchmarkTest00692", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: upload_name.clone() };\n let data = payload.value().to_string();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "050873f683df1cde6bf6f1d06eb4acf69726cf241ebd9ee2ffc4714204e92144", "structural_hash": "c85d21fd3b750f94ab3714a7894e684eb4e6b9e79ba4244c00acf017adbd18c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12338.c", "upstream_id": "BenchmarkTest12338", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char _tmp[256];\n snprintf(_tmp, sizeof(_tmp), \"/tmp/%s\", data);\n FILE *_tf = fopen(_tmp, \"w\");\n if (_tf) fclose(_tf);\n}", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d97eb91a197da5969503581356f25de7ed8d4071d401bcfa7bd3c70c38c4520b", "structural_hash": "1c14f62b3f516196c5321fa6ad548d2baf2eddb374d220fefea936646e7d3b2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12582.go", "upstream_id": "BenchmarkTest12582", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tvar data string\n\tfor _, token := range strings.Split(authHeader, \",\") {\n\t\tdata = token\n\t}\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b22edd9860ff009fe514f6ccf1823ee50daeddcb25f4b49bda333602a9122cf", "structural_hash": "881c4b94bdb2a1ba603fc8261495c43a0a58e1bd13e1d0e16f0fc6216da5cc58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00021.ts", "upstream_id": "BenchmarkTest00021", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n res.send(nunjucks.renderString(processed, {}));\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c2f2f2ba8862bdc6624b52779c1992e8afefe3ec3fba924bb521a751c839f5e", "structural_hash": "77b383fba16e2e0e67f33a7a93a305f4a9641aeba22b8140d46de5fa8a75ea99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04929.java", "upstream_id": "BenchmarkTest04929", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/json\")\n public void benchmark_case(@RequestBody GraphQLRequest req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n java.util.Properties property = new java.util.Properties();\n property.load(new java.io.StringReader(\"rawValue=\" + graphqlVar.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", property.getProperty(\"format\", \"plain\"));\n String data = property.getProperty(\"rawValue\", \"\");\n response.setHeader(\"X-Frame-Options\", \"DENY\");\n response.setHeader(\"Content-Security-Policy\", \"frame-ancestors 'none'\");\n response.getWriter().print(String.valueOf(data));\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "953e54802c7e3d76390c29deb3d37f0b08b30d3c81f17956eeb736c293ae54ce", "structural_hash": "8320054182dabbe2a89419ed3cef3da8ebe296f48c14fd20c6804c2aa75c6566", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04680.java", "upstream_id": "BenchmarkTest04680", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.yaml.snakeyaml.Yaml;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n FormData payload = new FormData(uaValue);\n String data = payload.payload();\n Yaml yaml = new Yaml(new org.yaml.snakeyaml.constructor.SafeConstructor(new org.yaml.snakeyaml.LoaderOptions()));\n Object obj = yaml.load(data);\n response.setHeader(\"X-Deserialized-Class\", obj != null ? obj.getClass().getName() : \"null\");\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e2d92c8001fe4969dc4844cffe47cd031a974044aad501b90165f42d75c8259", "structural_hash": "70a6626dc69ae5029ba27235cd76381b336c6fd2bce49a32bf217c01565fa32a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04100.sh", "upstream_id": "BenchmarkTest04100", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e33367fe1270b1aa4caa901bd908bec18669c82c2b57a15c3b22fc00353ee48e", "structural_hash": "21b0455ac8acb6d3bb3ae3e8a090991ff2c6519aa6c47e1de3afb666f192d7de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03078.rb", "upstream_id": "BenchmarkTest03078", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n data = user_input ? user_input : ''\n Net::HTTP.get(URI(data))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8feb49b9a489eab00d4f76eb7cd3102c7565f4e89b3b520293733816d68ad0b4", "structural_hash": "c1ec290b94faba537f85c01c7e07f68dcc5c5bad145118215eaec7c944f0f517", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41521.js", "upstream_id": "BenchmarkTest41521", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const data = String(userInput).slice(0, 200);\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e03a2168494fdf684288c7f602ad06c364be9a3bd531d82077280260a397fb0b", "structural_hash": "c0e7608636be2df4db3848030734b550a46fc714d72c13ded07dcec2e4cd1c25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00464.cpp", "upstream_id": "BenchmarkTest00464", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6c45a7870b265fdacea695e5b3a2ce0921b77a67fdb2db84ef00ece5d9a7432", "structural_hash": "fe4db8dd0d3887ec482f65c2a5e402595dfeb943b30e286cc09be8aae6d27b37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30355.sh", "upstream_id": "BenchmarkTest30355", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT bio FROM profiles LIMIT 1')\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n curl -s http://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f80c73468ac5e3c6a58f9f6a07045c69d2d5d192fec9cb3adbe5548cba6297f", "structural_hash": "29a074bce6952acef54ca351a7cddcacc5af0e278ab6ee1d321b3978ff560ed3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06996.c", "upstream_id": "BenchmarkTest06996", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66bede77dd7d50ec3db4de7a89a290c01465be9dffa17df61c9da44d512abdf0", "structural_hash": "1582940011373b786961ef966fe50e1a986c739121d6dde9e37530f7d8fd5d37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03228.ts", "upstream_id": "BenchmarkTest03228", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n res.json({ validated: String(processed) }); return;\n }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec4d1be313afe69d681a0b3ba1bd5c340d1725599a97962ff246461c5d3122a1", "structural_hash": "d5b676c9e188f99fab2d5ae7507305a1970dcb88b2540af5c7532cc409139403", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04707.php", "upstream_id": "BenchmarkTest04707", "language": "php", "code": "headers->get('Authorization', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ab2fe2f96d186e20e889018b641ef9d11c920aef9b7a142a8bb7c49ece9d258", "structural_hash": "2ff432c7379969c0fdb28c111798644031166b960deb01d04627251f14c277a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04980.rb", "upstream_id": "BenchmarkTest04980", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n Rails.logger.info(\"Action: \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40f27077d380b2ec3d5e3090bcb0bf7c1e7a25c9468d91845e6deca6326876e7", "structural_hash": "79fcad53d236960508b7d44fea49772f06b87406427fef90843c443714dbeea4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04270.py", "upstream_id": "BenchmarkTest04270", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport json\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n graphql_var = json.loads((await request.body()).decode()).get('variables', {}).get('input', '')\n data = ' '.join(str(graphql_var).split(' '))\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0c98992c8a9982c90b2f6e6bd9a80d4c41552e785a1630586599705969452e4", "structural_hash": "af98ff3bbd72c5f74d6ce6f0d18b2fec0ed345374d13a4e74f7c384dceae1f3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02402.php", "upstream_id": "BenchmarkTest02402", "language": "php", "code": "json('payload', '');\n $data = call_user_func('strval', $userInput);\n $processed = str_replace('&', '&', $data);\n file_put_contents('output.csv', (string)$processed . ',data' . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdb03196bce3db8c1adab3248abf5960a103fd2d8b7f391ff69aa77d9a9f3fe9", "structural_hash": "3ee8222ec4845b939e8246f0b07a28aff93269ec05e6e6411738d8a27c6973d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19895.c", "upstream_id": "BenchmarkTest19895", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n void *_h = dlopen(safe, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "580b0e4233b09e73289037ced7febf7ea874d35cbf16286b28c912efcfb5b899", "structural_hash": "4bd299210627bcf83ac3ef243da0132ef04066339f676d610ae15734a9c317c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38785.js", "upstream_id": "BenchmarkTest38785", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "029ae82a7b950caeac459b98aae96a599b78977fa8d2680d8385ff8cd922451b", "structural_hash": "1b31a2cbe3e37f6990ad920cd748c645f7348a608f403941b777c108db0e3649", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00711.rb", "upstream_id": "BenchmarkTest00711", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = sprintf(\"%s\", user_input)\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n eval(processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87545d3f856a461633780f6071330d21e8113be1b786202d0279c954e75d77d5", "structural_hash": "11b43d8d0b234cc617a081f721d0c4240e2e4e03ad855ce3fa0056686cb9d1d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01891.c", "upstream_id": "BenchmarkTest01891", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "467a04d613217f65646bf4f8b09fe35cfe089070999c7173ccd775826a9af415", "structural_hash": "53a0ad0c440d0619ba96482c62ae81d05dee9c0747d9946d1b9e7f126ca913f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05688.rb", "upstream_id": "BenchmarkTest05688", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n payload, _origin = user_input, 'http'\n data = payload\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb93cdd8d735426f79a99c866c237b6343ac5ca19aa651a5ee6e5df80b4db090", "structural_hash": "607c00ca5ab5254def76a3fad43cf867492e58017105a66dc68cbb39e7142354", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04953.ts", "upstream_id": "BenchmarkTest04953", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64a1140097cbd60bdbcb2592f8a3bed0921192f83fae19820660c32c3ed30b51", "structural_hash": "668df4d195997049a0abeae5d923a524ef16d3062f9a315326fc694005506606", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01173.cpp", "upstream_id": "BenchmarkTest01173", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "515de550f133fd8dfb28cb6eb31e7716d90f5b8b3512701642a50f0fb53377d8", "structural_hash": "d99a9058178649abc3e5d43ebd4c189424ee67fdcffe6b19ca52b12a2f67ba77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01284.ts", "upstream_id": "BenchmarkTest01284", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = `${userInput}`;\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n return { listing: entries };\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f3544e09264cf139bad0e82979b24feeb52be1548bcd47a27e09bf5a1ed199a", "structural_hash": "83c88552d14406c89f9fd1c566ff61c05b4d1f10bdca863cc44dc46c091a4f55", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02542.php", "upstream_id": "BenchmarkTest02542", "language": "php", "code": "headers->get('Authorization', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db78d51864c784fe36d7e4ef2cfd42acbc0e7f592119ed223ec8156ed1701e27", "structural_hash": "5bf703000a98f11725cc922465e39e5f3d8c41788d8ed8a2d56ebac89246ba89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05458.ts", "upstream_id": "BenchmarkTest05458", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n res.set(\"Access-Control-Allow-Origin\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93ee6b525e10d6c1d08bd0287b83903376d32f26e40bae407594ab554b1768c4", "structural_hash": "1ea5f231bb9e7064b23a9a9a3444528ace05eca6fbda47b55f8781dd9d8dc67f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03909.php", "upstream_id": "BenchmarkTest03909", "language": "php", "code": "headers->get('Referer', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $valid = is_string($data) && strlen((string)$data) < 4096;\n if (!$valid) { error_log('schema validation failed'); }\n $processed = $data;\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$processed), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23455aa032649fc73b20a339b5a65dc4d53ef14d8361dbad6a15ec2b62964e75", "structural_hash": "98c77d7f87c59ab33ffb925cdc7b6c0e6adcc6454a5465fbeac048e6e40706d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_16212.go", "upstream_id": "BenchmarkTest16212", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/iam\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tvar data string\n\tif len(authHeader) > 0 {\n\t\tdata = authHeader\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tiamClient.PutRolePolicy(context.Background(), &iam.PutRolePolicyInput{\n\t\tRoleName: aws.String(\"app-service-role\"),\n\t\tPolicyName: aws.String(\"inline\"),\n\t\tPolicyDocument: aws.String(data),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "331ff1403a4d44a737f3aaba76672b0f7a015051a392b5da09412e03928e03e4", "structural_hash": "2d559c0a24f558c1e18d4472b5ef7f02284eb0de0f4245fbe7ab176701d97f39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04861.ts", "upstream_id": "BenchmarkTest04861", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const requested = parseInt(data, 10);\n const wrapped = (requested + 1) | 0;\n const buf = Buffer.alloc(wrapped);\n res.json({ allocated: buf.length }); return;\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "604d1b88ee9784dfc6169cf0af7708259a35e461f85c70455fb32ff7ddee40b5", "structural_hash": "ad7b082d88a9a621457ff6f4a96dfb8448bda4adfedeb3e539179515169705bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00088.cpp", "upstream_id": "BenchmarkTest00088", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"uploads/\") + user_input;\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n std::string _path = std::string(\"/var/app/data/\") + safe;\n if (FILE *_f = std::fopen(_path.c_str(), \"w\")) std::fclose(_f);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f3f19316797af4e54239aca8f27849bb17855293dcaaf4d5cf13941ed2e7846", "structural_hash": "97fc10cc9efc592f8b37f091d0f60a18f810e49cd0d68536749b69ea1f18895f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03791.cpp", "upstream_id": "BenchmarkTest03791", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbf96e4407e8b1fbd9daf8a8c8006fe55c8c3d178f3605779ab2dde240636541", "structural_hash": "07eaf42e5393e02ecd12c1c320c3de35afc9d25e6ee63b934b485967de7d4699", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04971.rb", "upstream_id": "BenchmarkTest04971", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd7af139e3afe2cfebf15320ec880b1061ebf560c56797873f8699c5d86b443a", "structural_hash": "f05618ff9189e9666dd3094dd0f3a96f7cca983b41065f980b104c468c421624", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21723.js", "upstream_id": "BenchmarkTest21723", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = userInput != null ? userInput : '';\n const { publicKey: rsaPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 2048 });\n crypto.publicEncrypt({ key: rsaPubKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING }, Buffer.from(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e368621e7cb2c85589e2588ea4f36c72840d85b297835a9e0824db2c9c9fbdf6", "structural_hash": "44ff37ae6a0c28cbb5335f85f261695318361210dec45c08d80fc6f217dc244a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12437.sh", "upstream_id": "BenchmarkTest12437", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"${user_input:-default}\"\n printf \"\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6030be42b043e8519c816b99ef9742029273f8d4e549fd6b2e70f0ad674cebf2", "structural_hash": "3d68707911513e658def948cda5003f1a9b395175b2c6ce55087960d789d0673", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01600.ts", "upstream_id": "BenchmarkTest01600", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n await new Promise((resolve) => {\n childProcess.execSync(\"echo \" + data);\n resolve();\n });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1764077f48e69c1a6dc3d12597af956cb5de340961186e183bd0f0ec8e43b89", "structural_hash": "2c10f967f005b129dd86f6d08e6b01fc368ba1a8819e59e5dfbe5a98fecaafb6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33549.js", "upstream_id": "BenchmarkTest33549", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "635fc5af42424bd31f0ec8e204cf892968846b1a3b722c88b01a9f624810101c", "structural_hash": "f7f4f6cccc30c1a6b4a7f5cdd45271b9dceee448f0b41af47c73950bc62901bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36541.js", "upstream_id": "BenchmarkTest36541", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const storeCred = process.env.APP_SECRET || \"\";\n authCheck(String(data), storeCred);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-258"], "category": "empty_password_config", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec09da1a066517f6ffcde06dcba8d9134c55d502cd99bebefbe9e5bea02dbde5", "structural_hash": "6358058053991a7cc16bce3483eb731f5f1f73f91e94c702bfd72ed92a30b5e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03998.py", "upstream_id": "BenchmarkTest03998", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nimport boto3\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'default_config_label'\n reader = make_reader(secret_value)\n data = reader()\n sm = boto3.client('secretsmanager')\n store_cred = sm.get_secret_value(SecretId='app/secret')['SecretString']\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bce8cffdbfc22e21027d3c9d3e86d1714b4417d11bc91280687685217d88b1b1", "structural_hash": "b2563648d985e188c3cf2f11f60b77fa67759f0215f2abe8840ef5527029f074", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02500.rs", "upstream_id": "BenchmarkTest02500", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let mut pending: std::collections::VecDeque = field_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let result: Option = std::env::var(data.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83dcfe8f7e79f8685714217a1e0cb44b7554fcc224ce81a405a52dd9bbc49457", "structural_hash": "28e4a0f5b435303719f51913b2c0c33dd51902249ff0612e87986ad1e81d4d61", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02480.py", "upstream_id": "BenchmarkTest02480", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = bytes.fromhex(db_value).decode('utf-8', 'ignore')\n requests.post('https://api.prod.internal/data', data=str(data), verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af9ae6026c1fbf940c825316d09eef79dbe98d2ef964ee0c294efc0631942b80", "structural_hash": "de99e95784d642066f4761998328e7b01cc1bddd34bc8585c044a2924839cda9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03820.py", "upstream_id": "BenchmarkTest03820", "language": "python", "code": "from django.http import JsonResponse\nimport re\nfrom app_runtime import db\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n if ua_value:\n data = ua_value\n else:\n data = ''\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n db.execute('SELECT * FROM users WHERE id = ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93e286c1f2cd6219ed8dd9a6d758c0bb355167602388a388b03be8105cf859f3", "structural_hash": "a074515569fb2cf3d720376a075e7f7051af497b2a9eb6d69d8b6d2ea91f8ed0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11588.c", "upstream_id": "BenchmarkTest11588", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76d5a949e018895c1716ef1aec1e80e30e2aebd5c4f3326156ee9ac81b9eed2e", "structural_hash": "37022d0701803729309a98bcfdd55c6b359299b6065252392d34c57e6fd2960b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02153.sh", "upstream_id": "BenchmarkTest02153", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n logger \"Action: $parsed_bool\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2831254016c37a6446b4f98dad7aa60ea196a6ac908f771659a3d3ebb864b979", "structural_hash": "1f28cdf2bebdcc20315ba5853cd4960a19e4cafa702d74a094d768413b0dce2d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07170.sh", "upstream_id": "BenchmarkTest07170", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afc29e23a31064d3da64363bce63692b762eb27caadef73191f3847d4c772b24", "structural_hash": "3e609319331dffc2044ea5136bf6d8ebe20cd482e15732381f4e2b260b801b2b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36309.js", "upstream_id": "BenchmarkTest36309", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = nodeUtil.format(\"%s\", userInput);\n res.set(\"X-Custom\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c9561367deac2a1da91bd28ba65e65ba62d8165632c60cd424c1d107033acfb", "structural_hash": "b0018dd7e729074448070cfdb6616e2372a648d90fa4c8797c1c05b9a2d31ec6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16127.js", "upstream_id": "BenchmarkTest16127", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const data = \"\" + userInput;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n ctx.body = { validated: String(data) }; return;\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28e52610c255fbeb7eb129466020401a2ec4a738d220321ddb10455df334e98f", "structural_hash": "1fb2578c73d72d6394945f2eab652bd8ea055475305c41e6df25df81a4baae65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01389.rs", "upstream_id": "BenchmarkTest01389", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let mut data = String::new();\n for token in db_value.split(',') { data = token.to_string(); }\n HttpResponse::Ok().content_type(\"text/html\").body(format!(\"{}\", data))\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d138167cdf9dc69b610ea1a9e0ba6a430077aff2f74e971e8a6a1b0607f8f31", "structural_hash": "3053cb6bf9128a54f182df09b6c8c047dec55336cc6d9815e53535f0a9fb6d64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01211.php", "upstream_id": "BenchmarkTest01211", "language": "php", "code": "json(['error'=>'forbidden'], 403); }\n $checkedPath = $resolved;\n file_put_contents((string)$checkedPath, 'data');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "baff8c12b2e6fb0f38e6056c68c96ea25346af4817ef3d81581439623f77bb06", "structural_hash": "7fd577c70a47e121be9900872bee50945413c7ade1aff330e4639a307c9a8235", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09877.sh", "upstream_id": "BenchmarkTest09877", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cfe6a7d39189f3b81f82992525117b6ea2379c2ba0a826445ad9d97b790f9cc", "structural_hash": "f4afc095a9f604eba3c8354916cc99bf977de81b03134beaecd04e852083f2ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05383.py", "upstream_id": "BenchmarkTest05383", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\nimport requests\nfrom types import SimpleNamespace\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n ns = SimpleNamespace(payload=forwarded_ip)\n data = getattr(ns, 'payload')\n if not re.match(r'^.{1,256}$', str(data)):\n return JSONResponse({'error': 'schema invalid'}, status_code=400)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e277cc2d2976a57356dd1b8d9487d81079e3122a10da0a639aedb5a10d909b2", "structural_hash": "d3ce9dddd76b7e798bc28b0e5840fba9a2b6de011eab0cb586e3f1298b2fdbb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01339.java", "upstream_id": "BenchmarkTest01339", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + cookieValue;\n String data = valueSupplier.get();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "138bc20f5860fef9092fc26cdf4291df3cabdf106456a6c0de57227947f30177", "structural_hash": "b341eee06a34f7edc7ce42e1888e880664e312df9e61248ebc84abc73be9cf82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03696.cpp", "upstream_id": "BenchmarkTest03696", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Origin\");\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n res.set_redirect(data, 302);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf6eede47f3f39ec0d98a8ce7dc5af02903b09cd430518a6c20cd784c4fae86e", "structural_hash": "8361236c63adba87b460307e7e73cd5356f619aa127326ab34cd3965ca0a9790", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00292.rb", "upstream_id": "BenchmarkTest00292", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = \"\" + user_input\n if data.to_s =~ /[a-zA-Z0-9_-]+/\n render json: { validated: data.to_s }\n end\n end\nend", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89b63790b50a9a37f089025bf6efa77bc7a32bc63c7c1a485002a13ce7205a9f", "structural_hash": "c923ed24cceacc69119e9c9fe2fd328b1d3e2be3863bff38a9fe5b7e56cb4172", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10815.c", "upstream_id": "BenchmarkTest10815", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n printf(\"%d\\n\", _arr[_idx]);\n}", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fcce0c0a0a557965af6554554762439095d3991ebda67e9ef94f343de591abc", "structural_hash": "0d9db6afcaf0004ab711fd7b63f71cb61ed94812b616b43ef385e97c8849a647", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01376.ts", "upstream_id": "BenchmarkTest01376", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data: string = shared.passthrough(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fc9ae94279c50bd1c809c1f9cf390c95303f1c8f0e6fe37e3ff8a3e010eb222", "structural_hash": "70b9eeb48c5fcc00d87f108338de4fdf82978a1d3cf21b00f153a1a46e046088", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00216.cpp", "upstream_id": "BenchmarkTest00216", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "091896c610a781b4c137740a42bf37350efcafd62d2b476e2449b175b99e100a", "structural_hash": "1eca2ef825de23140a63d0cbb06764023d129f5a49992160378fe20df280c6f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04140.go", "upstream_id": "BenchmarkTest04140", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tform := FormData{Payload: cookieValue}\n\tdata := form.Payload\n\tsharedCounter = data\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b819f66f2540f35e817dc14083b0bf83e20d34f0fd674cfff7cf8ac9a8dddfaa", "structural_hash": "01b9ded6ef83312ca9b43f6171d51bb96e0b98cd7331315fd3652d86f3ab3fa4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36923.js", "upstream_id": "BenchmarkTest36923", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n switch (data) { case \"a\": break; case \"b\": break; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1d1e5abdc99ecb6503edf1652d9e861b83d3cd0648d2dcfb101a2bf3b9b132b", "structural_hash": "d64301964b32c71a81de4e362037a70eb62dc808ad8165f7d458e0edc13863b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03917.cpp", "upstream_id": "BenchmarkTest03917", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd272339cbd7d916035b7865b7f75f3685b9a385ad07ca91a23bdf23eac86597", "structural_hash": "0d0077c4b43cfb8f95866a44ede1aa191b231e553006b2cece32ef78b855893e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04885.rb", "upstream_id": "BenchmarkTest04885", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"ghp_EXAMPLEonly0123456789abcdefABCDEF0\"\n data = format('%s', user_input)\n cred = data.to_s\n authenticated = !cred.empty?\n unless authenticated\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92736c59786325c47a6ed6e7e2d302479533f62fe8533d148a95faa613cfaae4", "structural_hash": "0523869db2d99a8172064cfb24e9e84499197a2706763e6d5acb5d755b4b5aab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04000.java", "upstream_id": "BenchmarkTest04000", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> cookieValue)\n .thenApply(v -> v.length() > 256 ? v.substring(0, 256).strip() : v.strip())\n .join();\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b18d2b39743bde35f9e8b1c886d6a93f445f15b6091fd01d9fd6a4d1de48f2bf", "structural_hash": "db907d2685cb4037e7ee162a5b65136d19e5ea63ccb9f9c5f869f9da9da682c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_25877.go", "upstream_id": "BenchmarkTest25877", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(cookieValue)\n\t}()\n\tdata := <-resultCh\n\thashedCred := fmt.Sprintf(\"%x\", sha256.Sum256([]byte(data)))\n\tif !authVerify(hashedCred, os.Getenv(\"CREDENTIAL_HASH\")) {\n\t\tc.String(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1100c0b0e2dcab503891fc9bd78a12072cfe55aff92d74cc2d2ed0dcf084886d", "structural_hash": "e7285f1e1a78621235fa2c90ddfb5aea5fb01490cab8dc2bf96cb4e927fce86a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16688.sh", "upstream_id": "BenchmarkTest16688", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf 'SETTING=%s\\n' \"$processed\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e080529628eafc02dcf18638afcd441b0e4f6c5e3b144f47060092ef921fe0f", "structural_hash": "b312c0903b6905322901e52e66ed5e65236d0ebb46dab58ba30e65839adc1bc3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04461.go", "upstream_id": "BenchmarkTest04461", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tform := FormData{Payload: pathValue}\n\tdata := form.Payload\n\tdivisor, _ := strconv.Atoi(data)\n\tif divisor == 0 {\n\t\thttp.Error(w, \"zero division\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]int{\"quotient\": 100 / divisor})\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b0b5fdabfdcad5da6f9bbcbfee687a36b8df340d6a43da9fe2101dfc5594755", "structural_hash": "686f0a2a7c9ecccb3ba67344a1b5b3f8812a290da3322ef0f92352ae038fed45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03484.c", "upstream_id": "BenchmarkTest03484", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", user_input);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf5502f30aa2424c0941b5e9b3e57c106c4090f3c23dc791dd587e628e363669", "structural_hash": "8e9640f8f66bbeb5e674871679632ecb28cca35343c9854d728165ccc40060ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31846.sh", "upstream_id": "BenchmarkTest31846", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n printf \"{\\\"echo\\\":\\\"%s\\\"}\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b154534940f0d5b33e0b9d0ef8ab681976c3315b884d0ed838428116c7a7631d", "structural_hash": "5f5202eea2fed6bb0d50b98277c3dad04e30d73e975b4b5698d851658f76a489", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19713.c", "upstream_id": "BenchmarkTest19713", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n unsigned char _salted[288];\n snprintf((char *)_salted, sizeof(_salted), \"s4lt_%s\", data);\n unsigned char _digest[32];\n SHA256(_salted, strlen((const char *)_salted), _digest);\n}", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9be4940e75d49b95a62707216e802ab5eae9cb7a93e04873e6a8005663df015", "structural_hash": "fbbd9fa254702952496a0891d736277786a242c45edd0bc7d6f1ad0f4f194dfc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20519.c", "upstream_id": "BenchmarkTest20519", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc17ca8656375f9eb039b2b2e184b65a9223a260cf7afb8a74c20aec8e24b5eb", "structural_hash": "5860a6b8bcff50e8884f5f7552aee116c71b5521539f3108792676e2058f410f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02934.rb", "upstream_id": "BenchmarkTest02934", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = sprintf(\"%s\", user_input)\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n eval(processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed25d3ac36ad08869ca17d74d7613407650a4fbd44f92c881c18cb6399676fe7", "structural_hash": "7ea45450dca46c55b319e0ae6bee2746e36b952c440458de57d1d7b41b6c06ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01182.rs", "upstream_id": "BenchmarkTest01182", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = json_value.to_string();\n let _csrf_token = req.headers().get(\"x-csrf-token\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if _csrf_token.is_empty() || _csrf_token != crate::shared::expected_csrf() { return HttpResponse::Forbidden().finish(); }\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc2d2e6db2e8fb50261666cdfe787af448537e508cc70f114ba65dc8a6b93f70", "structural_hash": "7ffbc1b3c86c26d913577cef2e34c411ec9e2d3aa95e8bc4996d0c1d88527065", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08825.go", "upstream_id": "BenchmarkTest08825", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tdata := uploadName\n\tif _, after, ok := strings.Cut(uploadName, \",\"); ok {\n\t\tdata = after\n\t}\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0702d425588ead7278f916015e1e74ae8753f2efcb48c60a04f2e58670688b46", "structural_hash": "b670d5c75aea6a5fdb8e5384a890160d6ed9e7bcf5ca8c3e3847fc4496243c8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03964.py", "upstream_id": "BenchmarkTest03964", "language": "python", "code": "from flask import Flask, request, jsonify\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n reader = make_reader(upload_name)\n data = reader()\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': str(data)}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "437fa1f927980513a9eeb21ad8d625b9313a5af24614e34f1e36ae4cdeed2442", "structural_hash": "2a31cc42350c0b5f113693be74b6b0f94c33b07254be15cb0f5053cb940f6056", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24506.js", "upstream_id": "BenchmarkTest24506", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const _val = String(data);\n if (_val.length > 256 || !/^[a-zA-Z0-9 _.-]+$/.test(_val)) { ctx.status = 400; ctx.body = {error:\"invalid message payload\"}; return; }\n require(\"./shared\").sqs.sendMessage(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\", _val);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38c39637a1c8c9245244ca15c3fa2f3d94830b7b62f0c5e147deb85ff830d9e1", "structural_hash": "7354e138f19d0295e4114221b518b9a65538327fc4fc6766ea8f6d05dc4b39b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_31063.go", "upstream_id": "BenchmarkTest31063", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tcapture := func() string { return fieldValue }\n\tdata := capture()\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\tc.String(http.StatusInternalServerError, ldapErr.Error())\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+data+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tc.Header(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9dc379e6df0775d5a4759af7e53eebb17ba5b88a7be6acf565cedf58fae4cf5", "structural_hash": "17f5cd1e5a55f9293730d950f0cf94c9d3e9cb01df42586cd2e7f945e64cf050", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02406.py", "upstream_id": "BenchmarkTest02406", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n data = '%s' % (multipart_value,)\n _resp = requests.get(str(data))\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc81a19eef8e11cae9420fc635a3a45de36a0479da69bce5f51019b3e52f49b3", "structural_hash": "795a51435292b1b914dc96e25a4cd11a903b7c8da32199e8d44296e54e12fc15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02415.rb", "upstream_id": "BenchmarkTest02415", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n payload, _origin = user_input, 'http'\n data = payload\n render json: { error: \"Internal error\" }, status: 500\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67cf6c99380ae145d87e9fc42c1d2a64b80b67539e3ee84bf279b343335df5a4", "structural_hash": "2d08108703a62bda9f234b648b06eae05babf8e2b08f8224950aad70c611858a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07280.sh", "upstream_id": "BenchmarkTest07280", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n if [[ ! \"$user_input\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$user_input\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n arr=(10 20 30 40 50)\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n idx=$bounded_val\n echo \"${arr[$idx]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56459b2db27ddf60aff8727bb38dd135a1ea9142c1985bd5307118cac86d2bd1", "structural_hash": "4658053cae0865ef7ecb2ba81ba1c194fa30c162401c66973afa7dfc4f948241", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01221.rb", "upstream_id": "BenchmarkTest01221", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"config_secret_test_abc123\"\n @user_input = user_input\n data = @user_input\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f22dff995829fcc0ee530035018ada46f6c790731a5316fcdf52244e14def511", "structural_hash": "23790d943cec043950b008e583734a90b4430dc04e43e0a169b0d817ba3048ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02522.cpp", "upstream_id": "BenchmarkTest02522", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "184e96760b1b22d379b33b01983de158d07153a9c9a08ead1ba892a1f75ffbe8", "structural_hash": "ec16e566d5b181d4ae340c92d4686bd2a6db5996511830b11aaf1974c857c3fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01150.rb", "upstream_id": "BenchmarkTest01150", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n tokens = user_input.split(',')\n data = tokens.join(',')\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4e15973e68025e8d50c7006578e4893e1b8c19f8e6b5f2e576ad6937ddaad17", "structural_hash": "bef5e205b3542ad014a9aead935d2f9d6102c6dac880172f7d6a809e9a3c33f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05009.py", "upstream_id": "BenchmarkTest05009", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n data, _sep, _rest = str(forwarded_ip).partition('\\x00')\n key = RSA.generate(1024)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b19ead72ccca846fddba46db9e5bf8dfd9b9f9842840acc5d4030e82b2a039c8", "structural_hash": "fd30e9d44c42ef07037f5eba1e9280c7b2976e039004782fa0a46ca1af889f33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20867.c", "upstream_id": "BenchmarkTest20867", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", data);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c043ff7363256ad3494ad9e3fe66fec6a016ca3bf530a601c4b62bae5a422633", "structural_hash": "89ecba3f534332e81eae0a3c42f3922aa7d35bdcdeab843a453524fae9e8e50a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00949.c", "upstream_id": "BenchmarkTest00949", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", data); fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebfca93bd1e4c3f7c1135507dc11ac443ced6f48317c692ee9cb6cd1e803ffa0", "structural_hash": "7dc240eca28eb1a11f8063fa40335fc13c3c1ec7122973826241e5a6671820ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04884.sh", "upstream_id": "BenchmarkTest04884", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(printf '%s' \"$QUERY_STRING\" | tr '&' '\\n' | grep '^items=' | cut -d= -f2-)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e9a33053de5bdc73ce86b74726d0562edd66ffdcc148288a4817344829cf327", "structural_hash": "dca6f115ddf6c55627decb5137637c4cb39631b683b8e0578f674506996a1fd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04633.py", "upstream_id": "BenchmarkTest04633", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = RequestPayload(referer_value).value\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return jsonify({'name': str(value)}), 200", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36d28f9206eedd0c4ce2d211218dca4d453b0654f67f4b956c748a4d804ddac4", "structural_hash": "aff280e8ecde9a49fbccb238de00314ea4d7ecfd67511c735c5e07c57bbddd50", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02205.rb", "upstream_id": "BenchmarkTest02205", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = \"#{user_input}\"\n eval(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b95c5ccf57eff0c455014dae5419e4300ce7933fac147529461db24cfb613b7d", "structural_hash": "46eea65aab274dccd1408179a8284715b13674b143aa52138d7be767d99a1e21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36098.go", "upstream_id": "BenchmarkTest36098", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", uploadName)\n\tdata := _sb.String()\n\tcmd := exec.Command(\"echo\", data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ad9f35bb33a2b8f9ddebe04522d1f35082cdbdf98ccc9ade8248cd7db5869b2", "structural_hash": "2612e24310459e68f51a690eda48558b99a8e53a19ab60775765ad6d76bff88e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05706.ts", "upstream_id": "BenchmarkTest05706", "language": "typescript", "code": "import { Controller, Header, Post, Query } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const data = userInput != null ? userInput : '';\n return shared.escapeHtml(data);\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2c92f56b9c3246b6b071bfe915a699c958692bf751f101d2aa2b98c4f6a4e44", "structural_hash": "98d1acddac71b8f455617b6cf79fd525e314d13b1961dd5aa1fa0b3906259518", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19675.go", "upstream_id": "BenchmarkTest19675", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tsegments := strings.Split(graphqlVar, \",\")\n\tdata := strings.Join(segments, \" \")\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36a6de6a4754498878497377ecdd359b66dacfda172e6300d91c461d312a3d1b", "structural_hash": "79a2b4a5bc30762109bbed212d2f769d8ab80cc5dfdd5247811960fd6effe2ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01911.rs", "upstream_id": "BenchmarkTest01911", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = ua_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::write_csv(&format!(\"{},data\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fa33922b96d0de775ac866451572b63c12a3ec2257f94d4e85b3cc174bf441d", "structural_hash": "c07cdd75431b34c9a65d660c4b753db3c6e0cd96e34eb98e0dcdf7f9a8b2f7d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07777.sh", "upstream_id": "BenchmarkTest07777", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n rm -f $processed\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84ecc283f4598f82df504aae67c70e34abf9c379850d30c20f6a6ee6185db92d", "structural_hash": "0cd1496ea5132edabed6a559a615cb94d480a6b30603fb174695980a065a8790", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28069.js", "upstream_id": "BenchmarkTest28069", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(data, 10);\n const value = buf.readUInt8(idx);\n ctx.body = { lookup: value }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3982e6d0c8972735cce98a9fd5007b48b562f05591a5471a5d8eff6459368df", "structural_hash": "09d00acab23d3de809daeb39185b4b50d93ab52a62e5a798ff64bcfc93a5769f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11165.sh", "upstream_id": "BenchmarkTest11165", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b0bcf057feacceb5d3dc8974ca75ef560979cc7d66722159db240e506724f92", "structural_hash": "6c2fec8fa445f3a4108ef1dafb98fa950ab772bf44275d9ce8e75c05a56923e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01180.php", "upstream_id": "BenchmarkTest01180", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('output.csv', (string)$processed . ',data' . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "460fb8147b866cf0dc1ce90f58fbd587209cd7a03e475aab7e901b4cb3a2f5cc", "structural_hash": "d7f86bb299d68486472cd55a73d6cf2b99d643945ac54fa06759fa486d711042", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03969.go", "upstream_id": "BenchmarkTest03969", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar data string\n\tif graphqlVar != \"\" {\n\t\tdata = graphqlVar\n\t}\n\tDB.Exec(\"DELETE FROM accounts WHERE id = ?\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6750a7936e0f971f438c4e25c88ef4d5f0e68263224f2380f5c71f82da1c1710", "structural_hash": "ec9c1664af7e8951d72950f1efdb4cbf397be6d37de4405f3caeabf7f7bf7542", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36744.go", "upstream_id": "BenchmarkTest36744", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tlastRequestValue.Store(authHeader)\n\tdata, _ := lastRequestValue.Load().(string)\n\tsharedCounterMu.Lock()\n\tsharedCounter = data\n\tsharedCounterMu.Unlock()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57407136f22ad6b865a2e0a66fc58c8d16a0338049bfba32f7f8e580e493b2d7", "structural_hash": "cf71b1755a2d95bf83c98c447b6a488a22bf7b930f80f942ec88422dcf537df3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10498.sh", "upstream_id": "BenchmarkTest10498", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7582976b8db362323c72ed2e95bb5492d02655ab0f08c9a4646bed05964fe1ce", "structural_hash": "57d91d423067dc7f819df4a82411a433ed17c6cc2196f834ce65a719aa32d98c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00855.php", "upstream_id": "BenchmarkTest00855", "language": "php", "code": "headers->get('Host', '');\n $data = sprintf('%s', $userInput);\n return new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08d9e659f8fc923fa8edf88a1ee9f6cefb23e81e6ce87fd0b37ce6837cfd64ac", "structural_hash": "5f6028fc956812ece8ffa4fbffccb6d420eda0f1793462febe0a2ed284e6ae68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00227.rs", "upstream_id": "BenchmarkTest00227", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&ua_value);\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92007dc19315fc3469424f53052bc1d34a92d657f705a6052f7d8400d50a85cf", "structural_hash": "6661a8829f2c204bc5f063f8b1889a29b6952fc5d5d952b5eecb43bf65b8a5f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00100.sh", "upstream_id": "BenchmarkTest00100", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n if [ \"$(date +%Y)\" -ge 2020 ]; then\n echo \"$data\" | xmllint --noent --nonet - > /dev/null 2>&1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "262a232d088be15cb520b64627e7f62e8e2470d911751f7a812d43b95b31b2c8", "structural_hash": "c03e0ac153c03ada82cbfd4f07ec2fa7c58aafdc6b6a1ee328d254e7c0d82ffd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00745.php", "upstream_id": "BenchmarkTest00745", "language": "php", "code": "header('Authorization', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee49681968cbed5a1b4c04844be2572b065de677d2fac94218ca6c38692cfc3d", "structural_hash": "9343c718442556e66ecfebf34b4b9b9cf6441f2f7122c700a6e9a2c56e8a8038", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05824.ts", "upstream_id": "BenchmarkTest05824", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.EXTERNAL_API_DATA || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n JSON.parse(data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d328e895e88cb90be1b215a5dc9cdfed01fa113fe4dbd9d0f15e78d60cb3a6e3", "structural_hash": "da73bbd92e9775da7b1ee5412017f8b3d65a3f6b7e60f2c105d9af67d356902c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00333.java", "upstream_id": "BenchmarkTest00333", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = normalize(refererValue);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n jakarta.el.ELProcessor elp = new jakarta.el.ELProcessor();\n Object rendered = elp.eval(data);\n return Response.ok(\"
\" + rendered + \"
\", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "649701377826263d9d67e1f7f050cbac7f324f9209b7236011e1d362d845d6f2", "structural_hash": "061525ea1c876303ce949fcd2d290fc73dd96c1c5cc456042c327a8f4d71bed9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05082.rs", "upstream_id": "BenchmarkTest05082", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let mut data = String::new();\n for token in comment_value.split(',') { data = token.to_string(); }\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29cdc7cf2d361a8738a3816dd9ba349a98cf4bd9ddd13fdcfb84e7755853ffc8", "structural_hash": "17701770e4d9dc0282595b09189b1665fa4f08deb922c056e18959d6de08a25b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02439.php", "upstream_id": "BenchmarkTest02439", "language": "php", "code": "header('Host', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09350801c6418170af43038902fd781c51b43ba5c58a3dafbd8ea1ec48d95788", "structural_hash": "61855117188d88cbc05f40647701cc176d19cf81fe98e1aeadc585e374e6445a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05392.rb", "upstream_id": "BenchmarkTest05392", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"APP_ARGV\"] || \"\"\n data = Thread.new { user_input.to_s.strip }.value\n resolved = File.realpath(File.join(\"/var/app/data\", data)) rescue nil\n unless resolved && (resolved == \"/var/app/data\" || resolved.start_with?(\"/var/app/data/\"))\n halt 403, JSON.generate({ error: \"forbidden\" })\n return\n end\n checked_path = resolved\n File.write(checked_path, \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86ca40a2ec75b4001d10af3998693e3062748dac90bc1a002509750580a9062f", "structural_hash": "e23f5b59364892c8b719f51a18dc048e4f6359dbd7dbaf17a3dd5f7fa43704c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14252.go", "upstream_id": "BenchmarkTest14252", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tdata := strings.ReplaceAll(commentText, \"\\x00\", \"\")\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
\" + processed + \"
\"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a667155d695c67c85df289005a1de9fd813e228a45b535e7b96352830f9bc3b7", "structural_hash": "f8073def50442c64789bf2cab50faaee8f77e954570ad0ef14b8fa130ec484bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02291.c", "upstream_id": "BenchmarkTest02291", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n int _vals[8];\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 1, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83a17642150ce0b5389c1f518d59e398fe615222b3fd4374861d96a4f5d785bc", "structural_hash": "12ea2f71c3743a8583f3ffc6d00a34fe12e2122f3bea2aa65e68487fe8abd3d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07977.sh", "upstream_id": "BenchmarkTest07977", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n case $data in config.json|index.html|readme.md) checked_path=\"/var/app/data/$data\";; *) echo \"forbidden\"; exit 1;; esac\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0a769b8e9abb0ae9a33359f3cad78e6ee050355fe1db213561c34dd5aa20b93", "structural_hash": "b2cf94cd8817a91c53ff9fb54b0a7ac8764e97f9b7613edc80f6a8060cf4f2e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_37504.js", "upstream_id": "BenchmarkTest37504", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7efb7ee5b78c0acdc418e7006fde1488dbf73f8a79ed0e11b1c353b81033e80d", "structural_hash": "896d9aef6dcafcb213bd4dc13f1a507c53e4b2ba8398123d1bd8c67f0363d20c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05602.rb", "upstream_id": "BenchmarkTest05602", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93be84453b7207eac888dde21b7875b5c0fd6dbb2689938e5ee6b2d643f28a68", "structural_hash": "8973667cfeb39a47e497c8af127ac301bc2ab95036e75e979f5878486f915d9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05557.sh", "upstream_id": "BenchmarkTest05557", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4bca277c3c392a6946f623c4ae92f3be423c0d87be5616df12404f631841f68", "structural_hash": "e433a57ccc07bb8c584b81f1eb8df99f6885bc517172b0747485df0e7d827156", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05950.ts", "upstream_id": "BenchmarkTest05950", "language": "typescript", "code": "import { Controller, Post, Query } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25ae1220867e53bc81b20f4f14327f4e83f4ad94fed2ef41de792855c4f64763", "structural_hash": "2c7d465ef71c0174f501c1d7aae51e9ee1190f0318f9e10dbb6d4d1075e83c44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11198.c", "upstream_id": "BenchmarkTest11198", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n (void)data;\n if (setuid(65534) != 0) return;\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05ff5771a524867f649466361a2b18c618b5c473bc40290d50972d5d71604051", "structural_hash": "ac38e0a5a1ac9150c10e66143266497050b2b0c20a90aefaf247c6f408bd0713", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05314.rs", "upstream_id": "BenchmarkTest05314", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (raw_body.clone(), \"http\");\n let data = payload;\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2777c343167ceb70c9a650f905e6bb1e09409d3af0b27bd5b014e7538b0b686", "structural_hash": "d934f2ec82ef3299a774439768b385fe5e73c26d2f70857dcfda9f831cffb4ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11319.c", "upstream_id": "BenchmarkTest11319", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b420d731aa80e37b6c5e5d765487d58886de935ad1c167adede93f7ef6772e34", "structural_hash": "289498c83ca98005e3e2853fa1fa50ecf52ee378ab56082527ccc14c25ef2b12", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05765.rb", "upstream_id": "BenchmarkTest05765", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n data = !user_input.empty? ? user_input : ''\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n system(\"echo \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97a27ca3e74907c6fdf303159b7835e31188814f900d69c44299d2525ef5403a", "structural_hash": "a50a652945980d6666d0007e29b8cc7c99202a2ae6233d6c5ec4bc5b60186c02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04301.rs", "upstream_id": "BenchmarkTest04301", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let dotenv_value = std::env::var(\"DOTENV_VAR\").unwrap_or_default();\n tokio::fs::write(\"/var/data/plaintext.txt\", &dotenv_value).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0080245049c889aab6b49fccfa852dea15e93e133eca2a11b3a1b37b3948a507", "structural_hash": "57772517fc8177e90f8a0e58e22f38ee23c5a52e3f57ecc0c81e1fd76f9e8913", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01890.php", "upstream_id": "BenchmarkTest01890", "language": "php", "code": "input('field', '');\n $data = vsprintf('%1$s', [$userInput]);\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "968e6b44ac7a32ad0d71a29c63de2d5992488429b665dd469e02780a86a12d85", "structural_hash": "72935939176869da053567b61264e6f81fedeaafd043c623d029a85cca56256d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04042.cpp", "upstream_id": "BenchmarkTest04042", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ada9db91b7b6698de0558c86cdc0caaaf50aafba62c97d7ffe54539cf711657a", "structural_hash": "73e85638afa7077bc8633015805de2b1317df70a0afe1ee62074c8a58a3aec35", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00562.go", "upstream_id": "BenchmarkTest00562", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tdata := strings.ReplaceAll(forwardedIP, \"\\x00\", \"\")\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cd7c8d82b49df014244c91893b95e1967b01597286168855ea25e250913b9a3", "structural_hash": "60c91f7a4c3a0bacf4cf0ead55405ea2624fb872f6dfb0c8ac3a9df72be8580e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35858.js", "upstream_id": "BenchmarkTest35858", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n JSON.parse(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f689263267dd9148d0c4b6e37975af89fad120fc7e2e494f9755b8626e76abf", "structural_hash": "06b3b54f83e6299868a75522101d940fee7c00d855f84586b528149864b6bbcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11513.c", "upstream_id": "BenchmarkTest11513", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n free(_p);\n}", "label": 1, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "250a6f17f6b265062f08d4f9a929f911fa9ef277bcab04d3d671d1dc0bcc9b4c", "structural_hash": "7996a6b338729e9b806dff1d8cfe12a796bae60cb3cfdf01cb9d9a3fd2a65307", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04849.py", "upstream_id": "BenchmarkTest04849", "language": "python", "code": "from django.http import JsonResponse\nimport re\nfrom app_runtime import db\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(ua_value)\n data = collected\n if not re.match(r'^.{1,256}$', str(data)):\n return JsonResponse({'error': 'schema invalid'}, status=400)\n db.execute('DELETE FROM accounts WHERE id = ?', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13f76377ad6282e2c3bd87b91197ddca1968227d38d70ddfac99cb0b1ca4d666", "structural_hash": "93b703c05b8e6ccd4a5aebedf77d291ba71a6a7f9f46fcfcd66ba96914a6cf7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01833.rs", "upstream_id": "BenchmarkTest01833", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(field_value.clone());\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c5ddb173f1399b0b7a014da637d8c4177d1f207f1377c61a2a6861d1c233aba", "structural_hash": "15e92f0dc0c6f6761c480fb56b85ec70a4b6d9748cccc9384750c550cb50d5fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_42798.js", "upstream_id": "BenchmarkTest42798", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) {}\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5951c5b1ba4327a3a20aed471e9748ca14a5ab6fda7f372b3d8b8aa7177194ba", "structural_hash": "40122efa91127c4b615d7d191f6126aca8cbb403abff683e4a8b442a5469f716", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27565.go", "upstream_id": "BenchmarkTest27565", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/microcosm-cc/bluemonday\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tvar data string\n\tif len(headerValue) > 0 {\n\t\tdata = headerValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tprocessed := bluemonday.UGCPolicy().Sanitize(data)\n\thtmlOut := \"
\" + processed + \"
\"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd39c824e982dd9354dfd620f58125026deb82c749ae554761603ead720a5541", "structural_hash": "623ab683f6d6af2331b6cadb378c7c4d17056b9306c0692dd9fa83a2554b4fc6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_02746.js", "upstream_id": "BenchmarkTest02746", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const data = \"\" + userInput;\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9a1bc74fefa1ca3088ffd5f3a1811a41fc6d0776eb4f6b95922194f30f7aa60", "structural_hash": "e4647e74eec6059d2e47a04e28aafd6bcce0f36c01c903c2d4729c11b81abe9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01472.rb", "upstream_id": "BenchmarkTest01472", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"app_display_name\"\n data = \"\" + user_input\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1243578f6598f3b20aafcf2e797e9154184ded86b22185b3de97ccba2c83b798", "structural_hash": "b6a6a566cade37f7819c33ce47affca3fae0cfc4a1d399396d6f623601ad1328", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04694.ts", "upstream_id": "BenchmarkTest04694", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, ForbiddenException } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n if (![\"ls\", \"cat\", \"date\", \"whoami\"].includes(data)) { throw new ForbiddenException({error: 'forbidden'}); }\n const allowedBin = data;\n childProcess.execSync(\"echo \" + allowedBin);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a7f86e3e4060f40bba5dca4a8f1cd4c81dbf54a111aef1d8441ef86f35ffd49", "structural_hash": "6165b19bec937c7ecb1ee9ff1f6da8efba171ac0161be2ffe0a0dfd86ab4b820", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01810.php", "upstream_id": "BenchmarkTest01810", "language": "php", "code": "headers->get('Authorization', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($data); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return new Response($_elOut, 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0e0ad3f73a7c516ed78c37a91e18b85b01d33ea1bb7e2894ef44ff343d5dadd", "structural_hash": "5896622dfb519a6602438bb83a71ed0ab21198ff3d91cef97a382e9135dfdfcf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04289.sh", "upstream_id": "BenchmarkTest04289", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n printf -v data \"%s\" \"${user_input}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n mongosh --eval \"db.users.find({name: '$processed'})\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75e642e3b178b29759621f779fb4ebadfd421f5cfc7096fd6c68019fd2c4e511", "structural_hash": "8e3299e4ae768cea5a0b4108f8c932d704bb775419693ea6f9bd8a742dcdf8fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19114.js", "upstream_id": "BenchmarkTest19114", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n fs.writeFileSync(\"/tmp/\" + data, \"content\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b269107d3eeaeb8f1a8a2b766a880143a57fcb9f1fc5aeeea011ee9e3a0bbcb4", "structural_hash": "608b6febe81f269f4d442aa8e806ec838efd2608f4329ae54de7fe24b72b26fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06128.sh", "upstream_id": "BenchmarkTest06128", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"audit actor=$data action=session_revoke result=ok\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad3b602c1fc7415b5430d8e723c15a88b9309e04bac5f89c017ef25aeb5a6b4c", "structural_hash": "50d911f312a4beb2ff20bec1651e069a24f09f6d998ed20e94fde838245df521", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01542.c", "upstream_id": "BenchmarkTest01542", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", user_input);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "092c2712b986a9756310039fbf6f097b19b77254d064983e7f1fe6fb21a3a5c7", "structural_hash": "d425aa6fae43bb4a4753e6770d797340efc7c13bec2e5e18ea44ab8204d7d287", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02647.go", "upstream_id": "BenchmarkTest02647", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(rawBody), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\tc.String(500, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a9657a5f185f6b9d30765251267d8faa8e1bda6172df196b2839bf0713c77fd", "structural_hash": "7add0ac89ebabc4ded25c84339a2b385018c76f68d7ef033389603fee070c246", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20918.sh", "upstream_id": "BenchmarkTest20918", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=$(printf \"%s\" \"$user_input\")\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a87ad3261527783c40450c03243c2be3842ba583c9aaa9ea9d6907d99062e58", "structural_hash": "be4870f7b47e6302a0c06a6cf19dcf7a3379a00f93e3eb14bef49c1b2852c25c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03562.ts", "upstream_id": "BenchmarkTest03562", "language": "typescript", "code": "import { Controller, Headers, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = origin || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n }\n}", "label": 0, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3563d8e086a3b4ad857d70a85d910a64d6d434f3f3b6c31396ebc9d1c287380", "structural_hash": "1c64c4f98ae410f345a72787e6eb8ad67681256a67c612b0500bc13cafa3824d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02233.py", "upstream_id": "BenchmarkTest02233", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nfrom dataclasses import dataclass\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = {'secret': 'p4ssw0rd_test_xyz'}['secret']\n form = FormData(payload=secret_value)\n data = form.payload\n Fernet(data.encode() if isinstance(data, str) else data).encrypt(b'data')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "889ab53470f8455477f06e5ee6f4e4cd8f9002cd56b6ce5be3be75742126fcbf", "structural_hash": "b722a927e7786ac25403cedd27927df06166897ab42171e8dbfed8bb51864c85", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02733.ts", "upstream_id": "BenchmarkTest02733", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n res.json({ validated: String(processed) }); return;\n }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9b46fe418ae9199536ab0ce5620d4f88b564381b6561f57728228d282647511", "structural_hash": "0fe82e6f6ccafc65e0a7409962d19e3d9463031d40e11c5da0dcf1304600b967", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08785.c", "upstream_id": "BenchmarkTest08785", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cert_host_mismatch", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db95585f13ec9e5141423f3e6e414a0614cf910ccfc0430d693965a4e9163d4e", "structural_hash": "01553f05cbea51149bfe4da1c32eee0dc43c142defbd5f368e2965ca39c37039", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01511.go", "upstream_id": "BenchmarkTest01511", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- xmlBody\n\tclose(_jobs)\n\tdata := <-_out\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5fb4515f3f5024a71d2489aac76b1cb9c86951ee60cd6d8d0c77261615c92666", "structural_hash": "29dbf849e611c3220680ec68fb67fe912ad9cf890ede6cf82105de125e0cf0df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02434.java", "upstream_id": "BenchmarkTest02434", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(originValue)); }\n catch (NumberFormatException e) { data = originValue; }\n return Response.ok(String.valueOf(data), MediaType.TEXT_HTML).build();\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8c4944c1da3586c3e20054af546d55daaaef862f2651acb935d6e29d84c8f1e", "structural_hash": "9b3145bc26c94b7a17ed61cdc71bbc16532288b8c5a532002b046b1d066da7a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06231.js", "upstream_id": "BenchmarkTest06231", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = passthrough(userInput);\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(data, 10);\n if (!Number.isInteger(idx) || idx < 0 || idx >= buf.length) { res.status(400).json({ error: \"index out of range\" }); return; }\n const value = buf.readUInt8(idx);\n res.json({ lookup: value }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6cd2deacbf78fd4d72f92dfab124b83dbe9109d2b9bc0b6ef0242cd204dd67d3", "structural_hash": "af4bd2c8af8bd11bbd8a2d43b4e68ab40c5b61ae640f41029b3be0103dc2e546", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01915.rs", "upstream_id": "BenchmarkTest01915", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = origin_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44ca110545f239d12e007964c79ad121a64dec8a75341655590a55c4787f1b32", "structural_hash": "96bc23f5b171cc741f4323810bad2aa3b6c18ffa77bf58ade2a4d424a3dfdd64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14678.sh", "upstream_id": "BenchmarkTest14678", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n echo \"Error: $user_input\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c62340672a30665e56b5edb6e315b198ec25c934cee4f2182fdc3c63c0f92dd", "structural_hash": "1a266c4ed6dee87c35b551a2bc709aec19aaa5cd78d2f6c76cb52d2128d72e52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04851.sh", "upstream_id": "BenchmarkTest04851", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n data=\"${user_input//$'\\x00'/}\"\n processed=$(echo \"$data\" | tr -d '\\r\\n' | sed \"s/[a-zA-Z0-9]\\{4,\\}/****/g\")\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81f4da66451d58733c4400b6e3cc2a2e58b791a12c0a27c9338acb80aaa53079", "structural_hash": "b7c776ef14eb5654b3f89cfcca47397ae725432ed9e1e628d91dafdda4417e9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05506.rs", "upstream_id": "BenchmarkTest05506", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(field_value.clone());\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cffd128f7c5706e9fde1acd87ca3d1288f5e382bfe6c3d0e436a098fbffe155", "structural_hash": "1e8e67e06244c2acb0553c9192f548ab9417a46768d51381067514c93e6c25f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02674.rb", "upstream_id": "BenchmarkTest02674", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "824a43352fdc6363a07de2cfb468600762acf385399126a7d076b11df55573fb", "structural_hash": "6f30e7d6abd421206296992973036d8b2b383643ed5ca80e6989162dbce01c40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04124.php", "upstream_id": "BenchmarkTest04124", "language": "php", "code": "header('X-Forwarded-For', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68c7ce939766053e7adc56b38724bb86b6e6387a0823114b1cfa45ce00979f0d", "structural_hash": "55f51043a02b70c951b732261c3c726327d08147ddf32440b0248eb490bf4e40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00088.py", "upstream_id": "BenchmarkTest00088", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom lxml import etree\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = str(raw_body).replace('\\x00', '')\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0af87e73d9dd47eaf9caf912ce60a366bf718a8c9787d58be9dfca529407c1f", "structural_hash": "09256e289d70e817d06885d518212e21a93d94fcda189257fc57963a5fb0e18a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00819.rb", "upstream_id": "BenchmarkTest00819", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n Marshal.load(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41860d21deb50194454e9e10b93029c171db04568c94418a1efdfa8b263ef0fa", "structural_hash": "027d852a8130b75e4e9cd9668246e270913ffe133334c44853e9f4742b70b188", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13436.js", "upstream_id": "BenchmarkTest13436", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n ctx.body = '';\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6aaf7dbf9006dee64ca16497d2b805f4c9e9f8335d97d6be389a254b0a562046", "structural_hash": "fd81bd28cb9a768a75a52b946928c1f54abbdf44191753be1561b78fb62c9493", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03350.rb", "upstream_id": "BenchmarkTest03350", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n halt 500, JSON.generate({ error: processed })\n end\nend", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "686098c7dbcb0a02b7945beb8776ab2a91676b349dfd60b01d672c8e4b597829", "structural_hash": "00aea579b2498928e76859164de06a1895fb6e654951408e4e0bbd526ce433d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06604.js", "upstream_id": "BenchmarkTest06604", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const data = String(userInput).slice(0, 200);\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n ctx.body = { validated: String(data) }; return;\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "590947c371b75475fae820e8becea4d53b1de268fa7365ea58d8c9e38497b4aa", "structural_hash": "ba58453344e8580cc55ca3c71dea21f0a50f0e705c3e523365895aada8c70b33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28274.sh", "upstream_id": "BenchmarkTest28274", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n printf \"X-Custom: %s\\r\\n\" \"$parsed_bool\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7515b8515d467da4818b36829ef7723c86e19266885ad654981ed43f7c158bcc", "structural_hash": "25b7ad986f23ff4ebab51f16a195b8fc89e2773eea053047b458f3800e39ca8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10808.c", "upstream_id": "BenchmarkTest10808", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efefd9c27d25ec7375074d260f3ced3cee1f714316e2926b94421c364c436ad7", "structural_hash": "77bc9bad652dce620b99755283212aa477c22b804080fffcca4dc36db4f7ae32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_10395.go", "upstream_id": "BenchmarkTest10395", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(jsonValue))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0b5d5a09509bc85dc4f19b37b0bfcb6bd57268ae467d7c5fa51ea2b730a1be2", "structural_hash": "12392a240b02d916446500c8931f991faf34c745f0b750741ca5447c441cbd6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_28231.js", "upstream_id": "BenchmarkTest28231", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = \"\" + userInput;\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(data, 10);\n if (!Number.isInteger(idx) || idx < 0 || idx >= buf.length) { res.status(400).json({ error: \"index out of range\" }); return; }\n const value = buf.readUInt8(idx);\n res.json({ lookup: value }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82a6006ab1f9e9aa2e6e2abd8697660e92a60a9a88ced681fd3714ce505daa35", "structural_hash": "4c376336b4067ac3d7a367c17d334b25dac3177c5e4e6a5015dcb5dcb3010dca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04140.rb", "upstream_id": "BenchmarkTest04140", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n unless %w[true false 1 0].include?(user_input.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = user_input\n response.set_header(\"X-Custom\", parsed_bool)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c651c8714a69e3f594e0dfb593b44544f341c031d4e76bf68e47380e2f9dbd3", "structural_hash": "9fd92ec1195cb0444046d551c943fe2f0f6a7fd0e57fdcac511bd91ef9ebcafb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05310.rs", "upstream_id": "BenchmarkTest05310", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse serde_yaml;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: json_value.clone() }.payload;\n let _: serde_yaml::Value = serde_yaml::from_str(&data).unwrap_or_default();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17b5013311718f49e81e486cfdedff643a151730c6d9ce02a5920c0fee399a8d", "structural_hash": "03ed3397708a04b72c73210c36ac8d69e36d2df31faa00c3ece54354f1e59d30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01756.rs", "upstream_id": "BenchmarkTest01756", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in host_value.split(',') { data = token.to_string(); }\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6e196880afb4ff81013838a68f936526157be7ff897b98dbc41b4c9d8df6d6a", "structural_hash": "4252a0cffa0f20177e08c62ba82994af0f98c85c8ed91e2a184e13c26bec2cd9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02476.rb", "upstream_id": "BenchmarkTest02476", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [processed, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8727c7698e96e3adc1054c54fce35247c69fef7e8a303bbfd65b80547f9e503", "structural_hash": "db54c71944818ff32afdac9a6aea14796b9c6e3ac9928a609338d150e609c60e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01948.ts", "upstream_id": "BenchmarkTest01948", "language": "typescript", "code": "import { Body, Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = (vars?.input as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n res.json({ validated: String(processed) }); return;\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "716c731eae5942974d9f88d6902221027c01a63d35981f9b4d32783ed4e984a2", "structural_hash": "85c14033f7c9b70b1c40e3e5f05cb8302d14c96e7cb0d89edf294c5baf7d154d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04449.java", "upstream_id": "BenchmarkTest04449", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n FormData payload = new FormData(envValue);\n String data = payload.payload();\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { return Response.status(502).build(); }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9bb5ded4eb5adb89237938ff9a0224447c6f9f4a51e406c6ee3fe8d490541876", "structural_hash": "bca541b239715a5daafd5c75ce1d67598e49838953385a8b7bdfa1c941019144", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16304.js", "upstream_id": "BenchmarkTest16304", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const data = String(userInput).slice(0, 200);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc28e4e0c5efa93ed7595f02b436a9d393b2718761a1ac30378bdf97c3ff4360", "structural_hash": "49923beb726af14f67152ef370d743cd7d29605b99002d6fc58a12e930c055a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05978.rb", "upstream_id": "BenchmarkTest05978", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n unless session[:auth_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:auth_token].to_s)\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93e72622c2a1cda48c102fbb5bebfba695c2fccac5b34236b119481d21cbcaec", "structural_hash": "e1fc02442679a2b757348b856d4297007a143b2c9940c045c3c33d270696dfbe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00970.py", "upstream_id": "BenchmarkTest00970", "language": "python", "code": "from flask import Flask, request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n ctx = RequestContext(xml_value, source='form')\n data = ctx.payload\n if str(data) in ('read', 'write', 'delete', 'admin'):\n return jsonify({'access': 'granted', 'role': 'admin'}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48338570b0a9590194d1a84ea371a6089f77578245e764ebf6a8221c82fbfaf4", "structural_hash": "4539729c64962c8e3381d115d39e460c205a37f42bb8a35fe0cdbbe4453ef01e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03468.rs", "upstream_id": "BenchmarkTest03468", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let data = comment_value.replace(\"\\t\", \" \");\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58c16e8773ac3bb9216e28c15fd5d05ccc3550c8c54b8a1a99a2dc0998318de2", "structural_hash": "5943bce58a26ef54bca642d07c7927f0c0a48f1c2e68fd479c2e5fa02a155918", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02449.rb", "upstream_id": "BenchmarkTest02449", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = Thread.new { user_input.to_s.strip }.value\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a81f53543204fd0fd81f603579779863efae34a69bf11e1510845f9902432d79", "structural_hash": "d6ae5ccd856ee04f9413af32e120c1d2f7234ef2ef13ccad251ad0a3224af316", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10954.sh", "upstream_id": "BenchmarkTest10954", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n _fname=$(basename -- \"$data\")\n case \"$_fname\" in *.jpg|*.png|*.gif|*.pdf) entry_file=\"$_fname\";; *) echo \"invalid file type\"; exit 1;; esac\n echo \"uploaded\" > \"/var/uploads/$entry_file\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "491d64e13f7a1e3259c07f137989c65c652797819f53f1c1e08989c50623765a", "structural_hash": "be80ef51cb67dddb35f9902b41d3778183b27ffb4c915e31ea38a63ff98c764a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03055.rs", "upstream_id": "BenchmarkTest03055", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let data = comment_value.replace(\"\\t\", \" \");\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27c509ff8b5260c9fa6dbea8b030292f802ed93e2d51fe7456308cab0c56941e", "structural_hash": "b0d4b65e293c6516ae9b98cedd495cb883bf2881d0eb82e048a9c5b1b6d154a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03806.php", "upstream_id": "BenchmarkTest03806", "language": "php", "code": "header('Authorization', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $processed, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "505250638673a800ef952f466564095c2b1163d86d95372f667cd85b0222fe9f", "structural_hash": "c314974c38c14b11b7d8e46f107d0c360a48b05b696530cc2a3edc0daa2c12cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04190.js", "upstream_id": "BenchmarkTest04190", "language": "javascript", "code": "const { db, authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n if (!authzCheck(ctx.session.user, data)) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89c30dda4c4e77cdf487a5ad93cb7954d8d3f68b1449e254d06609814e20ce64", "structural_hash": "1282dfa2592c7fafc95bd6931939cede107b7966cffed531205468fc281e034c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00349.java", "upstream_id": "BenchmarkTest00349", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.function.Function initialFn = s -> s.replaceAll(\"[ ]+\", \" \");\n java.util.function.Function transformed = initialFn.andThen(String::trim);\n String data = transformed.apply(fieldValue);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59bf672160ab527b1ffbacd474f416a9c9bc312149f7627178c032147c9d9e65", "structural_hash": "9165139d8440a816e87ae0b15eb8ded9447e119a59f267ea88a4d16621436d76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00051.java", "upstream_id": "BenchmarkTest00051", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data;\n if (authHeader.length() > 256) { data = authHeader.substring(0, 256); }\n else { data = authHeader; }\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4384246dcb74178499fc8c2c02c1e70fab1580c4d114b7234cb73b07317b3e7", "structural_hash": "baa378ca2a936a486a980cf1fba78713ff6e3a1d004b0843008ec13ec6818156", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00099.rs", "upstream_id": "BenchmarkTest00099", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse pulldown_cmark;\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = urlencoding::decode(&user_id).unwrap_or_default().to_string();\n let parser = pulldown_cmark::Parser::new(&data);\n let mut md_rendered = String::new();\n pulldown_cmark::html::push_html(&mut md_rendered, parser);\n let processed = ammonia::clean(&md_rendered);\n crate::shared::render_html(&format!(\"
{}
\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18bb0092166a8b3193c725448d062d3a62dc067ebd06030d30a1a7bff7b44f28", "structural_hash": "04e48f03b77e439fdac3deafb8d3ba5b2487c2d4cc8fed59d72606305afa3939", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04607.php", "upstream_id": "BenchmarkTest04607", "language": "php", "code": "cookie('session_token', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (empty(session('user', ''))) { abort(401, 'unauthorized'); }\n $entries = scandir((string)$data);\n return response()->json(['listing' => $entries], 200);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b622d85a218bc84247551a3021938e5af59bcd0c8a1cb330b9bef5b7902ad449", "structural_hash": "ecfd8439d6ebd885146bab116c5500d31c6a9f5bc201c9d8aa402fe64bfe5986", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05781.java", "upstream_id": "BenchmarkTest05781", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.Properties container = new java.util.Properties();\n container.load(new java.io.StringReader(\"rawValue=\" + envValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", container.getProperty(\"format\", \"plain\"));\n String data = container.getProperty(\"rawValue\", \"\");\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n response.getWriter().print(data + \",data\\n\");\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0571e8f2a2c0765c90da4a992ff55af36061dd9e42bcc7583b6901486472a1c", "structural_hash": "55c28b454824e086094033cb60d1dd387c2a5c5cdffe9600ff1a9d766999d1d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04847.java", "upstream_id": "BenchmarkTest04847", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", fieldValue);\n String data = sw.toString();\n String processed = data.replace(\"\\r\", \"\").replace(\"\\n\", \"\").replaceAll(\"[A-Za-z0-9]{4,}\", \"****\");\n response.setHeader(\"X-Forwarded-For\", processed);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bb4c5949b30cb113759e1a4bc2e2275b2ab0d83c0d6f0b11d022857779db21b", "structural_hash": "0eedcf4c95316b0c8585fe13f6e63fca418f1771da5886aa73997b1e9387adb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02991.cpp", "upstream_id": "BenchmarkTest02991", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n std::string _truncated = data.substr(0, 64);\n std::cout << _truncated << std::endl;\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45f2543a40a0f617e5090f43ab5d6745c3c27b3fd5c16e4c5f591034f9d4be94", "structural_hash": "f060fc5c59665932e47a4f9e44ba1ce0535ab444c5874c8769b8082147225fc8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01933.py", "upstream_id": "BenchmarkTest01933", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\nrequest_state: dict[str, str] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n request_state['last_input'] = upload_name\n data = request_state['last_input']\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e43708b3cf163b6d77c45661718d536f4852c22cb05c24480f2b8ca57cbb8587", "structural_hash": "c5b393cc5828c0bbe1aefebfea760658df1e8d2cdf2226a28524b720375a9e91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03266.rs", "upstream_id": "BenchmarkTest03266", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(header_value.clone(), |s| s.trim().to_string());\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7405e7b0f4a0f83e58e244e73331b5eabf01dfdb3a6eb1ee00f9f396f5978cd0", "structural_hash": "309ac7eb5bf76908435a6d7a6f6c97666a2b0efc395999fc97316b6043ffb74c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02228.py", "upstream_id": "BenchmarkTest02228", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = ' '.join(str(cookie_value).split(' '))\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edcb17150a8f558123647f774bf344c16447218061271a8eb3a7a0d65c04268d", "structural_hash": "535aa4043865d0bf112e54b225c9cebf068c86d9ee1f6e8592509507b190394a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00889.java", "upstream_id": "BenchmarkTest00889", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @POST\n @Path(\"/benchmark_case/graphql\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(GraphQLRequest req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n String data = graphqlVar.isEmpty() ? \"default\" : graphqlVar;\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n return Response.ok().build();\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2d7f148b64deff62f9a25fa295d5a577fae48fac47dffbbd149e2246d0d9c97", "structural_hash": "eaea7cb91e2a0b84decd80f15a6bd54d70fdbcc33e0ae2f2b92e36863f4e439f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02114.cpp", "upstream_id": "BenchmarkTest02114", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "551783daccde882b447c10dde78e21bc4e16c9a9a650f57a0d5fd833af76135a", "structural_hash": "3551aae1947ae94fa4a99c68ac45f2f62ad30737ce62616177482d9dc24a6b90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04357.js", "upstream_id": "BenchmarkTest04357", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n if (!authzCheck(ctx.session.user, userInput)) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cf05950b1a0e16b7defd2ccfaa3e5b499cbd0021fbd1da3603462590981248e", "structural_hash": "3ee0cd8c1e47513126b592b34b72c0536aa1592a32774e288d0895872cfe771c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02051.py", "upstream_id": "BenchmarkTest02051", "language": "python", "code": "import subprocess\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n data = header_value if header_value else 'default'\n if data not in ('ls', 'cat', 'date', 'whoami'):\n return jsonify({'error': 'forbidden'}), 403\n processed = data\n subprocess.run('echo ' + str(processed), shell=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90ff114c72c6072eda276ed0d6df74dff5d4c9bdb41a42de1335081288620881", "structural_hash": "b69a136e558c0320f2db11831a800e905937172c736b5913325f612504ea5a86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28949.go", "upstream_id": "BenchmarkTest28949", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\t_prefix := \"\"\n\tif len(hostValue) > 0 {\n\t\t_prefix = strings.ToLower(hostValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = hostValue\n\tcase \"f\":\n\t\tdata = hostValue\n\tdefault:\n\t\tdata = hostValue\n\t}\n\tsharedCounterMu.Lock()\n\tsharedCounter = data\n\tsharedCounterMu.Unlock()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b03fa1ded5a38741e3e515bfa621ea217233bfb968ffbec27b16cb4413701046", "structural_hash": "3408ff1532cc464ec72df88e06eaacbdb016a0d182fc4abf25ddd7e08f3c56b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00472.sh", "upstream_id": "BenchmarkTest00472", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "268677978f6156cb0bea7fe9f4b2a645903b3025bd390931e671647ec99d41f8", "structural_hash": "0741812e1bee90db33fce5751bcd6663dd636cea28484f0e6594fdf237edfa98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04266.php", "upstream_id": "BenchmarkTest04266", "language": "php", "code": "getContent();\n $data = \"{$userInput}\";\n $result = DB::table('users')->where('id', $data)->first();\n if ($result === null) { return response()->json([\"error\" => \"not found\"], 404); }\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "571793bb2414d0fda70e4cb2549c462a0222bfef27ce2616424e37f1c4c5cab6", "structural_hash": "b5ea8a17e099054f258c888e939415f6f6ff21d6e500b39106b9ffd6d149525b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02497.rb", "upstream_id": "BenchmarkTest02497", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n cell = user_input.to_s\n cell = \"'\" + cell if cell.start_with?(\"=\", \"+\", \"-\", \"@\")\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [cell, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "532d708223af28a1b4c97c93f7b6040273818773c310b589bc814beb4c3d10e8", "structural_hash": "53fddca349d079c051838c39d5caa37d2b154dffb73af7099bea14865c7c54ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00390.py", "upstream_id": "BenchmarkTest00390", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = f'{comment_value!s}'\n with open('output.csv', 'a') as fh:\n fh.write(str(data) + ',data\\n')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f8625ec997683e97f53f4452bdb429222bc8d4332d2fa47bba9979084281c45", "structural_hash": "4b2fbc7bed5f96d7716f44f86fb21b7a19b6ed5b6292995d15b0cd50aef73911", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00755.c", "upstream_id": "BenchmarkTest00755", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", user_input);\n FILE *_f = fopen(_path, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15af37b7ec40eeccd70644ce6c2187ea74eb93b017dda18e80f111f2c7b220f3", "structural_hash": "7b24b219e7dc6626065e80aea23362b4981e3ec979b93a1717fbfaab329a0bb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02253.rb", "upstream_id": "BenchmarkTest02253", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"yaml\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n payload, _origin = user_input, 'http'\n data = payload\n YAML.unsafe_load(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24471bfad5d0cf646ffa6809ff831469742f34ed2fe7eba7a48602b33c8c9d84", "structural_hash": "f205cd11f11641498085f70aee2fcbc88ef55208a8b77759b1c0e7fc6c56b203", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04749.ts", "upstream_id": "BenchmarkTest04749", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n http.get(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d084938db633ff260e79526aafa415ab7bd46bab24cff8976f9380cf096bf9fb", "structural_hash": "19d8533ef36c3cf89b68e84c9609b4afeb17455c843bb3fb853ddd57936adfd9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32358.go", "upstream_id": "BenchmarkTest32358", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tform := FormData{Payload: userID}\n\tdata := form.Payload\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e16be389111f928397936ad99583d233b51d8de39279094b08f63aaf4ec4b0fc", "structural_hash": "41d10280641dd157a54da15d0d5cf790057db11e91fc57ccd27a82f60298f8a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05528.rb", "upstream_id": "BenchmarkTest05528", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n eval(processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df765df129b5d0ccaee33270d6b9e06ab2bb1d53b577996ba90b287eb28bf8e9", "structural_hash": "02ff51e563d4b09ad4d842513f54541b05686c41b68a622cde653141365839bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04582.py", "upstream_id": "BenchmarkTest04582", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n data = ' '.join(str(referer_value).split(' '))\n return JsonResponse({'error': str(data), 'stack': repr(locals())}, status=500)", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f6f93e827473cd4f50984dd2ac35be66c7aad16f01a514863033e9cf58368ca", "structural_hash": "6aa448e8311c5eddcb5c6dc000ea2324c206cae97c4b5e9635b1a62ab8c2f544", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01418.rb", "upstream_id": "BenchmarkTest01418", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = \"#{user_input}\"\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad3f8af7c918de2742b6e713ae8eb8b75ed528a052d24df4140b9921d5ed794b", "structural_hash": "c0e17b894c36955e06224546fda883f8115ba89f10f3cba9a9191985bdb237e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04112.php", "upstream_id": "BenchmarkTest04112", "language": "php", "code": "getContent();\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n return response('
' . $data . '
')->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b22e69057e99034b61afe6db297745375ae5da2ec9b707d740478f4b7b4d8c3", "structural_hash": "4dc41779edfceb57ad623f72d3884e508c94b8c7bc9f92e4a607de64dddbb4ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32091.go", "upstream_id": "BenchmarkTest32091", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar data string\n\tif graphqlVar != \"\" {\n\t\tdata = graphqlVar\n\t}\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\thttp.Redirect(w, r, \"/dashboard?hidden_field=\"+url.QueryEscape(processed), 302)\n}", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b3cdb011afdb4e1eff1e630345556c452060d08bea5d33d2594e073e122967f", "structural_hash": "cf3453081245057ff1c439b4dcd8de2b41174c12ab4f57f822e608af621a38af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01413.rb", "upstream_id": "BenchmarkTest01413", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = Thread.new { user_input.to_s.strip }.value\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "538c9c22c274f6ae4e396ad0317d66ff7083620ca97d5d91158b5dbf7b6f613e", "structural_hash": "9a3d6d912cfc4b064894a6265d5b8b3daa076594741080e9b5185886a71de3f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_06029.php", "upstream_id": "BenchmarkTest06029", "language": "php", "code": " 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f14cb409f2f9fbbd9fa0eb770dbbe2ef07c662ad01418f47c5343f86a1835a24", "structural_hash": "d047ac6bdfb616b2c3cc5bc9a29c7dc514189dc059a4c46433ef06b244baa806", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10298.sh", "upstream_id": "BenchmarkTest10298", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo $((RANDOM % 16))\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a533cd6d9e77f159ad501bad5baba70b3b0471e0bac2e366d3d8845b9f542cf", "structural_hash": "fd8f847deb318575b2d3f05443513d6b668cc95ffbc45e9db7edadabfac8623d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00817.rs", "upstream_id": "BenchmarkTest00817", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = [\"s3cr3t_key_test_xyz\"][0].to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = secret_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n crate::shared::db_connect(&format!(\"postgres://app:{}@localhost/prod\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22d5674feaa9344093ff2c2769c2b7a1ae7dbcac31586baf0f63712672f24d2a", "structural_hash": "e4ec5c854a4bf1a56fae81f40c5d352232e5ff46bc1ef2218de7d3954ef24aad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00113.rb", "upstream_id": "BenchmarkTest00113", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n File.write(\"/var/uploads/\" + File.basename(data.to_s), \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3707131a3fc7e82f94a6f4bc26d4de7c83e229b3a5358a28ce20b5692a589a24", "structural_hash": "a5bf5117ed9989855652a2d483f940b54d1ba893fb78ae1d6e086428f951cd00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03881.rb", "upstream_id": "BenchmarkTest03881", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless session[:user]\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n Rails.logger.info(\"error: \" + data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "abf34eae47b0a50063c84ef65da669744a4aecf72fc2e576e24a925e4165156c", "structural_hash": "55c8a9ba8331e398a20b5f9efb3144563c053abe94e507cf20f8bc4d63ce2c28", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03004.java", "upstream_id": "BenchmarkTest03004", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data = String.join(\" \", hostValue.split(\"[ \\\\t]+\"));\n Object evalResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dc388ea9febda8e9cc4b32aa77c80d214512bcf3d75daba11d7dce15f852059", "structural_hash": "1f5b9d205ab6b95316162f5e12ae2f8decdb7a7f24c9c1eec1c7d9c334038926", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12055.c", "upstream_id": "BenchmarkTest12055", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", data); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7d34aca2fcf1f42b9953e7ecaf058ee1e35da79cc596219db733e28ab27775e", "structural_hash": "0da11d0c13931dedabcf28be3a11e14bbcfa77c8430a11de56b727f46d2705aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08734.js", "upstream_id": "BenchmarkTest08734", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n global.sharedState = data;\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6abe01f5fe9bb7f2f5589894dfcec8c8a41c4f5f2552688daa354683e167aa6", "structural_hash": "5654109b7029e2919790366cb6f0da3f446464a954fddb260582c60176d00ac2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29245.sh", "upstream_id": "BenchmarkTest29245", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c9c560b81fb64d6c9c8a18bee47d3678ed18af3b32e73a08e5efc2f9c7d5464", "structural_hash": "5c1a93ee3284eb972fb89d2426308d58e3a6068c9a0fa76af0f0629f5db6a129", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33665.js", "upstream_id": "BenchmarkTest33665", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3ae30c27c315da1f1f7de4f8e22e26ab54cecf2bacf991b6b72cea9a94ffb76", "structural_hash": "1a244dfcb626565606bc34d1cfb7925555a156ef7e2b5f54b0cd0cb6b4a3903f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32004.go", "upstream_id": "BenchmarkTest32004", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tvar data string\n\tif len(authHeader) > 0 {\n\t\tdata = authHeader\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tactualHash := fmt.Sprintf(\"%x\", sha256.Sum256(body))\n\texpectedHash := os.Getenv(\"TRUSTED_ARTIFACT_SHA256\")\n\tif actualHash != expectedHash {\n\t\tc.String(http.StatusBadGateway, \"integrity check failed\")\n\t\treturn\n\t}\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 0, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d56ebc5845ba2905aa5ae6a91c55e8492c83c8a0836e945e553dfd424210a324", "structural_hash": "ce65ad5a57cb5559fa4da14b8343cacd9f89ae940ccd2367563d9251b962dd78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01009.rb", "upstream_id": "BenchmarkTest01009", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n processed = data.length > 64 ? data[0, 64] : data\n eval(processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcfb5e5f7f08a3fee57b1108d4c9159fdb91e8781a3420d65cf726ae52d6f079", "structural_hash": "6721f96d0237dd3134ce381c9551154098f846b77e401fdfd62ba0214fab4bca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02429.cpp", "upstream_id": "BenchmarkTest02429", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n std::cout << _buf[_i] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8f527f3af14b407b4cf00043a134100045e758f0155c32a3779315e5f0cc421", "structural_hash": "7a60becb8ea8262c9544b8bc7c1db0a6b383a77c6c456a480011b5ed3b9744a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03738.rb", "upstream_id": "BenchmarkTest03738", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = !user_input.empty? ? user_input : ''\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a2b02bf342d4dae1d4d32feae28742ff37cd9ed2c48b9e52cc68b3eb891d4f7", "structural_hash": "c33c60da0efb38f6c0e0622f2dedf2ba760ba9eacb7d9a02c1f9c54157632884", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01052.cpp", "upstream_id": "BenchmarkTest01052", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n std::string _out(_p);\n delete[] _p;\n std::cout << _out << std::endl;\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13cc2513817ec3fc5282a24a02e43cd7e6b05d5d33412162a9154f7b1dbbb0e0", "structural_hash": "f00aeccf5f1bc20157e3c37feb106ea40284a960edad17f50440c827ff625445", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01405.rs", "upstream_id": "BenchmarkTest01405", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse rand::Rng;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = referer_value.replace(\"\\t\", \" \");\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d5347857122036c219994ecdcd23e9ed7fcb82b06926897052998bf14e68985", "structural_hash": "16fccadd08801227dcc73bcfd627e28d7bb28207233c92f48b27e77a6f830717", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_22221.js", "upstream_id": "BenchmarkTest22221", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) {}\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "854830cecae76f09bd7113369b36aa9556850bdc4e5f1c933d13f4a27a7ce068", "structural_hash": "8cf63436fdc4c151ada7cc37144a791d58f557d352d13c7cda93e8d4158b744f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04002.java", "upstream_id": "BenchmarkTest04002", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String data;\n try { data = String.valueOf(Integer.parseInt(commentValue)); }\n catch (NumberFormatException e) { data = commentValue; }\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e59ed2fe04ffb789e4be29fcdcecbcb2afa3e9576ffcd1e520e86bca8dbc589a", "structural_hash": "5d07c14fb4079c3b5636aba28b9c9ecaaa4f050b1355cb50cd3e797f97261248", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02559.rb", "upstream_id": "BenchmarkTest02559", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n content_type :html\n ERB.new(data.to_s).result\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed26aab2800216e6c9f09162a6030fba9b58aa793e302c7a8fcd256b185dd3e1", "structural_hash": "16bcbb6be67581ffa87465bb81c6f84437f6b332211ccd17098fee102959e5a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_27106.go", "upstream_id": "BenchmarkTest27106", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tlastRequestValue.Store(dbValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tos.Setenv(\"APP_USER_PREFERENCE\", data)\n\tc.Header(\"X-Config-Set\", \"APP_USER_PREFERENCE\")\n}", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bfb7f094d6cfe346f6b62243b4ab426b70b5d37a0f1b4808baf765887fca3b7e", "structural_hash": "fd7ef7b3832da3228548171a3b55cea819489d0033dd255ab035fb14d3c804f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02931.ts", "upstream_id": "BenchmarkTest02931", "language": "typescript", "code": "import { Controller, Post, Req, BadRequestException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as fs from \"fs\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bfdb0316c9b7d2b51d7b2dc7b30b60c38bbd888965cb06dbd41cbd0fe6f6ad75", "structural_hash": "3e99d25d93442cc5d4ea41e6ec6500184325e18e0000484b6ce4fb39f4169e44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02534.cpp", "upstream_id": "BenchmarkTest02534", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data = cpp_own(user_input);\n std::system(data.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aeac99955d89dc5d3c4aadd099bbd65db82261c4e504de2a0d021e403839d416", "structural_hash": "13ad2317c1b4a5a59b5d88f16f50b4416b1a98afa3059a4f1354fe4b112f1744", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13096.js", "upstream_id": "BenchmarkTest13096", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "237d0e5782e1edfd9c2fed46a2d043980d508b47db8ed456f6310d17cdfc3bd4", "structural_hash": "3cc82a1a1101d296a784df77638d42a0f157dab725a1fdbd5a35d85ac1e7d6d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04919.php", "upstream_id": "BenchmarkTest04919", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader(['p' => '{{ name }}'])))->render('p', ['name' => $data]), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d80aace9bd9742ceac1425fde5b8fd9e64c0adfe13fc28eb8b09d476b54e00b", "structural_hash": "646e76983e0633d0eb4b18066a6016d244a2dc490bca2034acff0b8ac1bb2243", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02671.rb", "upstream_id": "BenchmarkTest02671", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d0de8701cac4d2276cc5eac3454c72ce39d4574b33a1931e679e412bf660d58", "structural_hash": "08e557f3b8f67db60794beb42efa2d8f9ca0cab1e0d87f2c131328ffac4ff788", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_18770.go", "upstream_id": "BenchmarkTest18770", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tpending := strings.Split(authHeader, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tDB.Exec(\"INSERT INTO admin_actions (cmd) VALUES (?)\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-441"], "category": "confused_deputy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cdd2a92d8bd48024c7493a36c5d3417eeabfa85564a7d05944a843937a393295", "structural_hash": "8577084bc18e95063cec2c4caa5dd86b71ebd46709b31f2e47b55244200ec245", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02620.ts", "upstream_id": "BenchmarkTest02620", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const data = await Promise.resolve(userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n db.collection(\"users\").findOne({ name: String(processed) });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28e6ca80e2fc318dbef5d149dc7afa59cbaf8d30b7a17cc6f77e424ac0fae894", "structural_hash": "6d336ea1c320aa42f2f43ccba2827fc60a91c303b079f12da7fdbac1b148a163", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00923.ts", "upstream_id": "BenchmarkTest00923", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data = \"\" + userInput;\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1de529d8764059d78a5f1e677debbe0e18276b328ebe7b7e7011df2491efc13c", "structural_hash": "f12140ef67cad8217536816080c87589cfe3fefbad46bcd6c0ab785d764061b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08551.sh", "upstream_id": "BenchmarkTest08551", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f558ce8b031233040b66a512f45c54e47b6b0ec9fe218a166e68d215f56f722", "structural_hash": "af2d8aa6225693803e3dff87c9a60f8ad5b3c676e67659ee1b9f9eaddebe088b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01395.go", "upstream_id": "BenchmarkTest01395", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tform := FormData{Payload: commentText}\n\tdata := form.Payload\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tw.Header().Set(\"X-Custom\", processed)\n}", "label": 0, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "019bacb1ce5682a600110d2afaad9050852ad3688021d4dfedd9fdae4e284e5b", "structural_hash": "9bd2ad6b3fb97ffa60f9fdf8a7d65a5f107dafe725dd71c3ddac1cb1f9302f17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20786.go", "upstream_id": "BenchmarkTest20786", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tsegments := strings.Split(fieldValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tcmd := exec.Command(data, \"--status\")\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1628e15604fa5b780b13e669c10bdc79c7cf44d60fd228b714a8c6a8fde2fdfe", "structural_hash": "57d9fae152d31b73f8f906c0fc015b64393a364b9049aac47526af1ba653eea7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03947.php", "upstream_id": "BenchmarkTest03947", "language": "php", "code": "getContent();\n [$data] = [$userInput, 'http'];\n simplexml_load_string($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d1942fb48dd8d5a0353fddb63f3182235fe014451a3296d15633465de4ee2e4", "structural_hash": "7d96a9f5ce3949dfdcea7a3070d48b19d21e0c86da43243ff3b027d3c70640ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05859.php", "upstream_id": "BenchmarkTest05859", "language": "php", "code": "headers->get('Host', '');\n $data = \"{$userInput}\";\n file_get_contents((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d9308130a25a6bf7911cb34a740108d843049f91d2baa8f98ae6a444352b7f2", "structural_hash": "a2eff0569a1be73260800969aa65c52f16e8899028c0f74536a16e447f57bae6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00078.go", "upstream_id": "BenchmarkTest00078", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(uploadName)\n\tc.Header(\"Access-Control-Allow-Origin\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d2b7c4ec063cbb0ee4a9905433201d308abf627831fb14a8974263b7ffb333e", "structural_hash": "111c86bfa565256d3ec0f6dca8f33d598f857da1bdd8ff13dc7cc44769854ba5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03125.py", "upstream_id": "BenchmarkTest03125", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n data = '{}'.format(forwarded_ip)\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce012b31452b478d2c4da039792f6166c6ea31c197382d48a409dfb1a3858b15", "structural_hash": "7b1f3ed5fb7198db4af141261b5c261af2c7ed13c5688a489c45325c070bb689", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05348.py", "upstream_id": "BenchmarkTest05348", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n return render_template_string(referer_value)", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b9ac6eb1c1c97d7144a9c7140a8e8693341f1b50ff165ce1478c05821a02dd0", "structural_hash": "b28adcdef3b30e4a54031c5c6f1981259a4fe6f8970718924ecd235f4c158588", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36581.go", "upstream_id": "BenchmarkTest36581", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tvar data string\n\tif userID != \"\" {\n\t\tdata = userID\n\t}\n\tif data == \"S3cr3tToken\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-305"], "category": "auth_primary_weakness", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81be9019e3f4de931dd707137d1cb08f62a4619aa8d2b6128f3608e4c26b6476", "structural_hash": "a5aeea3c643735ea544754f660681913259ac0e9af6c0fe594d19035325a6820", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04963.php", "upstream_id": "BenchmarkTest04963", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$data . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2db24c6ff9668be24135db783a0ed7336bec0b722a61a78a994e2cd2d33f083", "structural_hash": "6455cc70edb6587e0f5c1aa028f515e750459b04d46ae2602ace7ac3e93c93e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_06028.php", "upstream_id": "BenchmarkTest06028", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $expectedSig = hash_hmac('sha256', (string) $processed, getenv('DATA_SIGNING_SECRET'));\n if (!hash_equals($expectedSig, (string) ($request->headers->get('X-Signature', '')))) { return new JsonResponse(['error' => 'integrity check failed'], 403); }\n $trusted = (string) $processed;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ce69e43ef285b4b2b2af83bc321e83dbbe65ce73c1b69710fc69f8e3758856c", "structural_hash": "159828a38dcd6126620ad529677ad11e3362b2a116123f8c411a2783d97b2fc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37849.js", "upstream_id": "BenchmarkTest37849", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ef8aace02369e431b97d42b41d79bf8fb38855f558035adab48390caa81d05a", "structural_hash": "b339c6f62528f66815bf5ba0904ed41ba7e58cb1e22f2f3982ae7de432ef0b7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09737.go", "upstream_id": "BenchmarkTest09737", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(uploadName)\n\t}()\n\tdata := <-resultCh\n\tprocessed := strings.NewReplacer(\"&\", \"&\", \"<\", \"<\", \">\", \">\").Replace(data)\n\thtmlOut := \"
\" + processed + \"
\"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b279af17261fb747ab4c9dd3807cace7bb0794014965be1d0156bc773fe46a36", "structural_hash": "ebac1fe5f77e9bd6db497e49397eb603828617b0d57e77a33c6f1c6c5fb73765", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17377.js", "upstream_id": "BenchmarkTest17377", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8ee966c84f29046d0567fe5bf9cd256b743e70618dd9289af5261849140b65b", "structural_hash": "fba1874587fd7079ae79a5ef4b65bc302531a0354d3d37125a56a2b53818010d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02548.cpp", "upstream_id": "BenchmarkTest02548", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a93889b1449c12162da01d55afc1d573bfe67efc24855fa12dd76f0ea55d5708", "structural_hash": "1170777ca8d69d53e0e3ad0812912bc3dbc91c5e9455eb78309db82e2073388e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00901.ts", "upstream_id": "BenchmarkTest00901", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data = \"\" + userInput;\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7092e2c10c08342690a6b9966e076f3d1646f1ad26bcbe8f13a0c53c20296d1d", "structural_hash": "67e9a498abbadd93cbed5dc90f857c93dcfbfd898205c91bdc7b9dd2827179af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31485.sh", "upstream_id": "BenchmarkTest31485", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n echo \"$data\" | openssl enc -aes-128-ctr -nosalt -iv 00000000000000000000000000000000 -K \"$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-323"], "category": "reusing_nonce_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8646e1e6a73fa06899da41de6554fe15bf3411b185356d5b946d0b79da6ddfd", "structural_hash": "98a7a1dfcdb4a66389699382c9ed116bda819ff7c12b244beba252cbd39790a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00991.rb", "upstream_id": "BenchmarkTest00991", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = user_input.split.join(\" \")\n unless session[:user]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n logger.info(\"error: \" + data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5f7dacfd65f871223517564b0ad6f3165eff13a1d757472109aa19979654ebe", "structural_hash": "6cd8c9caaabcae2cd9989ac7e5e8f9073ab50bb23beba5a938b800bc2b257e90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02646.php", "upstream_id": "BenchmarkTest02646", "language": "php", "code": "json('payload', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b818caf35026a76bb14b42e8ad1c996abe57c1c7899ca022e9fa7f7e5cd2cb54", "structural_hash": "b096bf9156c55d75ca8d9452c6c11b06eedeed4f95755bf9663002431b988014", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02295.py", "upstream_id": "BenchmarkTest02295", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n xml_value = (await request.body()).decode('utf-8')\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(xml_value).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f34b6e23ed5b9fc50f13d0698984a37f4b1c94e646aa3f908136fafbef70a5b3", "structural_hash": "4fa7264bfc287c0bb204edc407291566fb1aa8ffa661ea08c3274bc55d7ea30f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04786.js", "upstream_id": "BenchmarkTest04786", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n eval(processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72d70cd2c173ef771917d0ec70662813195b880235d23cbee1f959aa0af928a3", "structural_hash": "a9641062a305d924824b34bd33b30698272e2f131dd1eec0df29020ca144657a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03875.rb", "upstream_id": "BenchmarkTest03875", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a652b792b65a400860487bc97205c0d14d61a605a94381556eed6377deb6f375", "structural_hash": "92ad60f7f20d22a260447fc7ad966bcbf89f0c17b432c38d45e80dc80c657976", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02704.php", "upstream_id": "BenchmarkTest02704", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$userInput), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7fdee0f2c8d0b5fc64fd5108177bd2c776a19529189f91cf68823693ac9030e4", "structural_hash": "b6ce56f2fa97ed15b82126e3e3c463028f1d264be9ce20347ba4c570024a45e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00263.rb", "upstream_id": "BenchmarkTest00263", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = { secret: \"p4ssw0rd_test_xyz\" }[:secret]\n data = \"#{user_input}\"\n _dsn = \"postgres://app:\" + data.to_s + \"@db/prod\"\n _ = _dsn\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1850786fa4fffe0341bed71e3329041fcf900257151fa8f5304943ddb274bae1", "structural_hash": "1bec99f13e209dfa9893feed20bb6eecdeae0a3d912243dc7c2538bdfdc24878", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21599.js", "upstream_id": "BenchmarkTest21599", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n require(\"./shared\").iam.putRolePolicy(\"app-service-role\", \"inline\", String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37b88aa5012a68ae1e2537eb80b101023070bb873e9c739d16c80d97b805f767", "structural_hash": "8fbd72696a06b31a7eb380887b6c2fef3308027a2b96193e594aa6b5ec8abe91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01743.go", "upstream_id": "BenchmarkTest01743", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := BenchSvcPassthrough(rawBody)\n\tf, _ := os.CreateTemp(\"/var/app/tmp\", \"upload-\")\n\tif f != nil {\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b1a0539ec742ff122b57ea2ad073d5bff1901089037400b36c2bb5cc777ff61", "structural_hash": "16e70a4493c86287585f5b5f0de0f6d28eee5fb2572086d299de432bf1edf905", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03560.rb", "upstream_id": "BenchmarkTest03560", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = sprintf(\"%s\", user_input)\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => data}).first\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd6667dee5f4fe15c56ef1563817756db0171b6863d95f71f1e29c9bf2fef718", "structural_hash": "c24816e3c0dcaf01b907ff5166de3bc0c51d33ebdfa468443c82a0dd19b4416f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00290.rb", "upstream_id": "BenchmarkTest00290", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n data = \"%s\" % user_input\n render json: { error: data }, status: 500\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0808ca63d7b33fd7f881e109dc789035ceeef6ff7ca69f506c3a36a8e3bede72", "structural_hash": "eb11c3a73b077c437c765e6c33ad28cf3883d552d4f4b005834522f6dcdc66a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05861.py", "upstream_id": "BenchmarkTest05861", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import db\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n ctx = RequestContext(json_value, source='form')\n data = ctx.payload\n if request.headers.get('X-CSRF-Token') != session.get('csrf_token'):\n return jsonify({'error': 'CSRF token mismatch'}), 403\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb6732ff063f3e0377785399de7c7750f3b60de191b9da53bbb01bb1ae9643e3", "structural_hash": "98ac41ca104090fd7454e23dfb5bc5f80726b4ba7e4daa5469a7e819e72e65dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17529.c", "upstream_id": "BenchmarkTest17529", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_passthrough(user_input);\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NOENT | XML_PARSE_HUGE);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-776"], "category": "xml_entity_expansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7907b98ef85d37482c140e66a1945ad7f0d2091c9611f03e9c5b3a9913fa35b2", "structural_hash": "7f6e6a688a3d5a947c443b82694662db9a2463300f6ea20cca8d336268d5e905", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00301.cpp", "upstream_id": "BenchmarkTest00301", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::string _fname = std::filesystem::path(data).filename().string();\n if (_fname.size() < 4 || (_fname.substr(_fname.size() - 4) != \".png\" && _fname.substr(_fname.size() - 4) != \".jpg\")) return;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd2e364a5a0426710a063d5b44fc860fd72e96b8dcf89d39df3a461615994610", "structural_hash": "c1a404636bfd9b14993bd17d0f702e2949bc04cc60bc88e311340890f9e815d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02830.py", "upstream_id": "BenchmarkTest02830", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nfrom dataclasses import dataclass\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n form = FormData(payload=field_value)\n data = form.payload\n logging.info('User action: ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae00f4ce2a143f804381e1b2581bca4e8de0c62f7ab16c51581aa5c4dbb9364f", "structural_hash": "ee73c1f3e33c31b731fbde5cde300aa457247c7e9e679b95749612203a9b673b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_06064.py", "upstream_id": "BenchmarkTest06064", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n kind = 'json' if str(cookie_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(cookie_value).strip()\n case _:\n data = str(cookie_value)\n auth_check('user', hashlib.sha256(str(data).encode()).hexdigest())\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d735d7b32556db3b5b53c4fa3bc3eda74d59bf406fa551fd063e3bb565b8479", "structural_hash": "889f13f3b8db9e1ee11371f3aec79a09b661ccac88d3df50d9fc1d683e3fac5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29029.go", "upstream_id": "BenchmarkTest29029", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(hostValue)\n\tw.Header().Set(\"X-Custom\", data)\n}", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d536fdcd06c1c56ae4908d9154bc715c677e6052a820801375afdb7635edcf8", "structural_hash": "ac29dd5743fd8eec206bf835a9a25685ba1a1d4b1cc7058c7b8948c41373998b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24116.go", "upstream_id": "BenchmarkTest24116", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- graphqlVar\n\tclose(_jobs)\n\tdata := <-_out\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\thttp.Error(w, \"invalid\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d50f3d4f3feb1eba4573c108be710cb6e6fa66b5f574d7af424f9236a9ccdda6", "structural_hash": "d13edfefc5f369a963aa7fce283e66d9aa9164addc1877523cd5d60ab71837ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00347.rb", "upstream_id": "BenchmarkTest00347", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24c1b33681359dc1481f6b903e3444503bffcb128d886f4a7467c80d3b9a6cf5", "structural_hash": "df216f1317f598205753df232d7a864832364e2bdd8ee4d9dc0a40856e9656e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27295.sh", "upstream_id": "BenchmarkTest27295", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n printf -v data \"%s\" \"${user_input}\"\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9187fe4131551587f3cd9b90733e69b98f766488d19e176b591c9c428bee3752", "structural_hash": "a462abed98ebf8885f90fc50951b5fde52bb2f21bf163a9ae8c544b6e9ca630a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00866.php", "upstream_id": "BenchmarkTest00866", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $result = DB::table('users')->where('id', $data)->first();\n if ($result === null) { return response()->json([\"error\" => \"not found\"], 404); }\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a46a1416fe58d116bb443739b207f30ed3b26fec67ad7e326b97c184cf7957d", "structural_hash": "61ceb031380444a01115612957de2fe46720495706161cc327c8e00ca6298d17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01549.py", "upstream_id": "BenchmarkTest01549", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n return render_template_string(graphql_var)", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ba2777c7edc247fcc7d36a23fc03fcdf3bc44d26e96502b21b9931fea8a8e5c", "structural_hash": "ad8d18cb7d971e05fc2116d275fb8f5a69212327f5542b9007fa3bde4381c903", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28829.go", "upstream_id": "BenchmarkTest28829", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\t_prefix := \"\"\n\tif len(refererValue) > 0 {\n\t\t_prefix = strings.ToLower(refererValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = refererValue\n\tcase \"f\":\n\t\tdata = refererValue\n\tdefault:\n\t\tdata = refererValue\n\t}\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Header(\"Content-Type\", processed)\n\tc.Data(200, processed, []byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcc68e2a6c7a1467dbb3a4e5d5cd3bfa67010a43a5711ea5f6884d56f6da3bff", "structural_hash": "7fcb3aefc61cc2ee68f461ded74cc4dfd76acde15c7c1d1fcd9e9b3e3c778a57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12620.c", "upstream_id": "BenchmarkTest12620", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3833f00c3b9fcad775c12a16ae3442b63abb74625d327340886d1f09f26daad6", "structural_hash": "228f12fd9cbdbaf087051de7c43395bef622ebc6ce87f795ebff3036149785ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00532.php", "upstream_id": "BenchmarkTest00532", "language": "php", "code": " true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbf20f2034f84e19e9477614f8cbe0acdb1c86e1fde7a32bf9a93dbe7ce586d8", "structural_hash": "3473e2c14752a48d9b8b52d9e8a8e767d4bf75a681a75b0a6ed69b9e5dd2c5bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02804.py", "upstream_id": "BenchmarkTest02804", "language": "python", "code": "from django.http import JsonResponse\nimport re\nfrom types import SimpleNamespace\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n ns = SimpleNamespace(payload=user_id)\n data = getattr(ns, 'payload')\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JsonResponse({'error': 'invalid input'}, status=400)\n processed = data\n with open('output.csv', 'a') as fh:\n fh.write(str(processed) + ',data\\n')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4aa3ec89248be31c59709d5cb07e0316f06854556bcf30433514d3032a611d86", "structural_hash": "49b080b71c5fb192ec57195d173c066e44bdd0af5f2f74cfc64c0f3e2fa03af4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17899.go", "upstream_id": "BenchmarkTest17899", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tvar data string\n\tif pathValue != \"\" {\n\t\tdata = pathValue\n\t}\n\tos.Chmod(\"/var/app/data/\"+data, 0600)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a089e4157fae9b7d69f733b57381d6b3f9496d7d02b3aea1a7eec62ecaeddb1", "structural_hash": "9135b33b4384f1dd46fee8b0be01622db5766b2edfecc41cb66bf229804930b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04632.rb", "upstream_id": "BenchmarkTest04632", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n trusted_claim = data.to_s\n render json: { trusted: trusted_claim }\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "739cc22c158e249cd9540e8c0bfa8c915d2015e08a2310217f1e60fce96eb725", "structural_hash": "b198230840c1eba34148d98c59cdea34dcb83e7b3d6a60a935c9c8c02b14dc50", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05980.ts", "upstream_id": "BenchmarkTest05980", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as jsYaml from \"js-yaml\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n jsYaml.load(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef2844a1c8aca13c12ce6f97eadccd28f785e1df0ade692a4632829cc3991bdc", "structural_hash": "18a915010edf115635b93d78c62a204a1ab83aaaeed10c6ca9b3c5d97302aafb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00329.rb", "upstream_id": "BenchmarkTest00329", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n result = User.find_by(name: data)\n return render json: { error: \"not found\" }, status: 404 if result.nil?\n value = result.name\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "121acc57f21c7c7e8410a55cf4e565d6276a3e7b6865899e6a3ffce2c01c30bf", "structural_hash": "d6f4538893f90f89daa889186e70c3ed839a90bcead8184feb259c5c37558305", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01310.rb", "upstream_id": "BenchmarkTest01310", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = !user_input.empty? ? user_input : ''\n processed = CGI.escapeHTML(data)\n content_type :html\n \"
\" + processed + \"
\"\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2822acd180780a3ca01be11b8b08453197002a2b123354fe13d10dcdd95b155", "structural_hash": "a5f91156e3d423b4dc4cde3e29f6df9239f8361f3df1c3a1cce1f19e9b50056a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02087.rs", "upstream_id": "BenchmarkTest02087", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = graphql_var.to_string();\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "caa9276524d3e53835387ebf55bbdac060c1e76ef09c9e0b94d5d384a025110b", "structural_hash": "6417085cfd25cf12c5f4213a67e337cf269c34c68ab3cce091053ce3404aecdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04337.php", "upstream_id": "BenchmarkTest04337", "language": "php", "code": "info('Action: ' . $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d7c998b451561b092e9f08d6aa9939ac0d1cb7e95f40838b1df97dcf1bb165a", "structural_hash": "32eb50ce1ad2e5ae1d70436765c60a55e94c3ca5bc59a15f5cac6c5dbf484540", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05429.java", "upstream_id": "BenchmarkTest05429", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(uaValue)); }\n catch (NumberFormatException e) { data = uaValue; }\n response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df4d5cb214e74f574628b26e40fa19419be0956cb1d4dd7c056e77e8d56df4df", "structural_hash": "753140643bd74796080fc1355b35c6c6ce7288b8d24c3537f6a943f849810632", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01038.rb", "upstream_id": "BenchmarkTest01038", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n _body = URI.open(data).read\n ActiveRecord::Base.connection.exec_query(\"INSERT INTO feed (data) VALUES (?)\", \"SQL\", [[nil, _body]])\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c64cbddfa9e2df3ac7634a805b9d9ee43087690ac6aefc2728c9f07c993e49d", "structural_hash": "7c0640eab4d38ef72bb98f41434567222ff82e57d2f2d26ccf6bb4da1e9d57e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03858.rb", "upstream_id": "BenchmarkTest03858", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n data = \"#{user_input}\"\n response.set_header(\"X-Frame-Options\", \"DENY\")\n response.set_header(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b98a916b3038eef0b7fdaee373af72eb959c91d6053f9e3c447311a83288c25", "structural_hash": "2a49ca1d57a7abd560b1de999e98f293b96de8a0849e9f13da984f0592e8c32f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00483.py", "upstream_id": "BenchmarkTest00483", "language": "python", "code": "from django.http import JsonResponse\nimport os\nimport subprocess\ndef benchmark_case(request):\n env_value = os.environ.get('USER_INPUT', '')\n data = env_value if env_value else 'default'\n subprocess.run(['echo', data], shell=False)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b14732a60c8da2356fab503760f890da2a71ea22c01c68f46ace96bc0372c27", "structural_hash": "4591426d3473576940148958ff48c62ff2e2b044c2df0ec192a965031e770494", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03534.java", "upstream_id": "BenchmarkTest03534", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{pathValue});\n response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "773ffa30d91a75c1c8e7eea21a6b2021fcdf87d6e03025223cc9cbfea5dcdb31", "structural_hash": "42d6f5a7e7ec60bc64f3c94e5ddb9d75f1fcce35c8eb65dd7ec021eb0d4f379a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05394.php", "upstream_id": "BenchmarkTest05394", "language": "php", "code": " ['header' => 'Authorization: Bearer ' . (string)$userInput]]));\n return response()->json(['data' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca03b49ce6a82a7ee24abd2563bf994f7d285c339730495e63f69a4daff1ffcc", "structural_hash": "bba852a233acad47db1af1a2820a1b7f24fda4279037f3ec9b5759eba6fd88f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04399.java", "upstream_id": "BenchmarkTest04399", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.parsers.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference valueRef = new java.util.concurrent.atomic.AtomicReference<>();\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n valueRef.set(fieldValue);\n String data = valueRef.get();\n String processed = data.length() > 64 ? data.substring(0, 64) : data;\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(processed)));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc411e8e0f69ad5f9654423504e48d3bc1190c8ef4fabe6372b7cce2890412ef", "structural_hash": "5f945eaa423dd8b567d36dbf2c7c389e7e71bf3263e724c91bf58b0c8c88d528", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05106.java", "upstream_id": "BenchmarkTest05106", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = xmlValue.isEmpty() ? \"default\" : xmlValue;\n Runtime.getRuntime().exec(new String[]{\"chown\", \"root\", data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6438755afc805fd3c5eda708b8c9f76a25ea7a7ae5b151d7a71a18d9875cb9d4", "structural_hash": "21396eb6fad9a3e1248d75eb064f2014f3ae1ae5d393f446599f2c5085888a3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03395.rb", "upstream_id": "BenchmarkTest03395", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = settings.app_value.to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n _hashed = Digest::SHA256.hexdigest(data.to_s)\n File.write(\"/var/data/output\", _hashed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6ce9877682599512ecfd0ef9ef8773e042dbf470e1ea5545c6b3aa4e0acc442", "structural_hash": "5f9054d00893b7068f6dc2a21ca47dba56265094f7a3062afcb9be42fc369ad9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03317.php", "upstream_id": "BenchmarkTest03317", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = \"{$userInput}\";\n return new Response('
' . $data . '
', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ca257be1b4968b1e6364d9dcb03c4c730700e3c6952c73622fcd91391d78ad2", "structural_hash": "bc32cb1080b1fc43b63b5a0124649f240a00006cb76650020aad11a88258a55e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02848.cpp", "upstream_id": "BenchmarkTest02848", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n if (!std::getenv(\"APP_ENV\") || std::string(std::getenv(\"APP_ENV\")) != \"test\") {\n std::cout << \"Location: \" << data << std::endl;\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "562a799836273e592be5c5702a31a3fdd88f4b1ca5be582f9a02b997ae84ba5d", "structural_hash": "4d229706681e162fa87ccdb841887871f73be9b1521babade0e82387ba4c317a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00137.php", "upstream_id": "BenchmarkTest00137", "language": "php", "code": "request->get('multipart_field', '');\n $data = str_replace(\"\\0\", '', $userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8236a8f7954a1f3ae99abb35ca9bc041600713afd6cad06627f05b7a8182fd8", "structural_hash": "73e84881c3d8efa9908fa2ef4f487fdc86f22542657e1a1349999844d6362b61", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29326.sh", "upstream_id": "BenchmarkTest29326", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8bd010ad9bdc01fa4baff57e87687346a80e041a341a1504607175ae8f69ef05", "structural_hash": "fa12c0f16cab3adc720945d86c000aef07120408efe78ec5f64ecf3ce6bf8b2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05960.php", "upstream_id": "BenchmarkTest05960", "language": "php", "code": "getContent();\n $data = call_user_func('strval', $userInput);\n if (in_array($data, ['https://app.shopcdn.io'], true)) {\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->set('Access-Control-Allow-Origin', (string)$data);\n return $resp;\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba5262d447ea4923590df1b9f1ef14fa9263b113ec34ce565b71b782f347f2ab", "structural_hash": "4351be1d553ec5deebdc68a551d21d2198df8953ed5b70119d379ce325ddd72a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01683.py", "upstream_id": "BenchmarkTest01683", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n data = (lambda v: v.strip())(referer_value)\n if str(data) in ('read', 'write', 'delete', 'admin'):\n return JsonResponse({'access': 'granted', 'role': 'admin'}, status=200)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5509d70861b184f038d8049a432cb9a7000e82962695daaa790d04861eb67dc3", "structural_hash": "12c106cd67e753d7bad30cb5278a6f3cfbc48a8bd8a87fc7f30fae1eacfd3cac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32401.go", "upstream_id": "BenchmarkTest32401", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tform := FormData{Payload: xmlBody}\n\tdata := form.Payload\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3c73a92a47bd3a3ecb315e94cbb720b10b5c3fb1e942c6d399a1150c08b8eba", "structural_hash": "457c8df950ee0da8d88d960f06f0485ad7f1840fbc8d6f10f9d34d0ae4cfbd26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_38000.go", "upstream_id": "BenchmarkTest38000", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := strings.ReplaceAll(rawBody, \"\\x00\", \"\")\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Header(\"Content-Type\", processed)\n\tc.Data(200, processed, []byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3ea8bf4f80d774691f902e8e002ccd84cfc850927700c61fcc534e3c8d460b9", "structural_hash": "1b1dd84cf45191cee6d7f33dcbebe012ccafb35ffd20270cf5bca57dfe6ece48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14252.sh", "upstream_id": "BenchmarkTest14252", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n (\n eval \"$data\"\n ) &\n wait $!\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b18851e4cd642595a807395629bfb4d0b37859d60ae4c37f9e9976d2685c073f", "structural_hash": "0d43d919157224596bb5a63d5284133550bf9f66b965edb55dfaf543c2637bc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28530.go", "upstream_id": "BenchmarkTest28530", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(userID)\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26d7a955253f6ef74d056d0d3d03fc42b53ef910bd2e9cbe079e04c4d03d4bf2", "structural_hash": "808c910c3060236fed087b7cf57998c7a378745aaac51f85e26f2868006d2c26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05949.ts", "upstream_id": "BenchmarkTest05949", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n res.send(\"
\" + data + \"
\");\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77d5da436a2853829cf81bb322d90b18de766801f6081479369ff7869c04471a", "structural_hash": "841548a6a88eaf3400b5d4d1267ffb8b2158a277375053f08e3ca2e8562950be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04202.rb", "upstream_id": "BenchmarkTest04202", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n DB.execute(\"UPDATE users SET name = ?\", [data])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3aaf889a0d956de2423019a7a8ece9761f14bef946f3a5210b06104926e4b7b3", "structural_hash": "4a53f221f39d784c13b78101a2e773efe48127e9f0988328b8cbfadda32be1cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03543.ts", "upstream_id": "BenchmarkTest03543", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send(\"
\" + processed + \"
\");\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1c6fdc8c9ed91bb93ff63cea5902752ae0f5e945be02f8af94147ceeb8d1eec", "structural_hash": "32c03d551f9f523a7843004515628abe1459463cc5fb9719c776c0b202ed78ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_26059.go", "upstream_id": "BenchmarkTest26059", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\t_prefix := \"\"\n\tif len(userID) > 0 {\n\t\t_prefix = strings.ToLower(userID[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = userID\n\tcase \"f\":\n\t\tdata = userID\n\tdefault:\n\t\tdata = userID\n\t}\n\tallowedBins := map[string]bool{\"ls\": true, \"cat\": true, \"date\": true, \"whoami\": true}\n\tif !allowedBins[data] {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tallowedBin := data\n\tcmd := exec.Command(\"echo\", allowedBin)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc962e03ecbf362d388bd4d04617b1ce9fadfd50e55857b254e7176511252d20", "structural_hash": "5b043a69fd1de848d35c9dcdd5b65730c36ac8e01ded8d76a60081794677f9f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02454.py", "upstream_id": "BenchmarkTest02454", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nfrom pydantic import BaseModel\nfrom starlette.responses import JSONResponse\nimport os\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = (lambda v: v.strip())(json_value)\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27c52e1c450d3ebb1586c92d52b70ce9c1f80e05bed59e4c973116d40ff10fc7", "structural_hash": "da2729e95ae7c2483f1b950cc3c24b88affa47aaebf2dc13cd43e3a87c6c31c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01083.php", "upstream_id": "BenchmarkTest01083", "language": "php", "code": "query('id', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d233ef51ad09c66fc304e951af54dee6ccc799af11e9803107a45bbc224097af", "structural_hash": "e479c4cc8a35b04013c35aa27486c643209b5e62af2b68f6d561df8064ea5b1e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08326.sh", "upstream_id": "BenchmarkTest08326", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n curl -s https://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "341f19c2cab4a8f99ead06c5016f87f0639813ca6c3b48cadc5152b3effbd8ce", "structural_hash": "0ac5429f1315ac41c94eb9b8862bb9d6cf4c18b92eedcc58d836f8925d023b66", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05220.rb", "upstream_id": "BenchmarkTest05220", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"base64\"\nrequire \"yaml\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n data = Base64.decode64(user_input)\n YAML.safe_load(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b5eefb735ada8cc68ff052478ff244ed4e8deb01e81b26203724d13b7b4b5a9", "structural_hash": "171b946432c1ac93b00525655c42bf1d5abc29df781b22ece6b3031fc3e0ab13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05566.rb", "upstream_id": "BenchmarkTest05566", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "293793773a178e058cc71f111761608015f3b0892c1c5fe8e59018fd9e6da4c2", "structural_hash": "83b0876cb5359cdb892580376cb1b4ac0811ec3f9ba12694b437ba9a9a8d0e09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03104.java", "upstream_id": "BenchmarkTest03104", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.yaml.snakeyaml.Yaml;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n Yaml yaml = new Yaml(new org.yaml.snakeyaml.constructor.SafeConstructor(new org.yaml.snakeyaml.LoaderOptions()));\n Object obj = yaml.load(forwardedIp);\n response.setHeader(\"X-Deserialized-Class\", obj != null ? obj.getClass().getName() : \"null\");\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "805ceb813ee4b1cff0d065e4e58bdc8c47d43b412705c11c9c4c17ef2846ba33", "structural_hash": "a61bf6ecb5d97bd97edfb55e23f2762b39530f90c9430b1b2f5158aa1e289c97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10249.c", "upstream_id": "BenchmarkTest10249", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n int _req = atoi(data);\n int _alloc = _req + 1;\n printf(\"alloc:%d\\n\", _alloc);\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29d5faede0dbae6e0cfeb687ad5489a5f04e59e910f9a5ddfe0eb49aca47cffc", "structural_hash": "789cdf1eb948bbd18fce19f5c11fc222042c9ac509d516bb6d2ecce4d4d34440", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14667.c", "upstream_id": "BenchmarkTest14667", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74dfa489a9f2c5e8f68be02f1f3dfe63398c75b1d1c38cfcb41261effa1f4291", "structural_hash": "a54bac97ad9d76ba1e2b25a3791821e6b92582df5e88341d412ae201df20cf30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01075.cpp", "upstream_id": "BenchmarkTest01075", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n std::string _path = std::string(\"/var/app/data/\") + safe;\n if (FILE *_f = std::fopen(_path.c_str(), \"r\")) std::fclose(_f);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a21209615b616860c055161ad92aedd44b2cb46c093be0bdefebdc784157324e", "structural_hash": "ebe7625e827928dc1bbf74bd968fe9e5de2303a39f5ed215a778738121c19b73", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01259.java", "upstream_id": "BenchmarkTest01259", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(fieldValue);\n String data = normalizer.apply(fieldValue);\n String processed = data.length() > 64 ? data.substring(0, 64) : data;\n long seed = ((long) processed.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d40da86adf4b1df0adeb8bd2e0d55c794ad8ed4197c2677451e914b7d0c70a9a", "structural_hash": "709e250be86d5435d47a3b882e97a4bddd1082500abd0d0c4f821fa0dd69e21d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05215.py", "upstream_id": "BenchmarkTest05215", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nimport os\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n profile_value = db.fetch_one('SELECT bio FROM profiles LIMIT 1')\n data = ' '.join(str(profile_value).split(' '))\n key = os.environ['DATA_ENC_KEY'].encode()\n encrypted = Fernet(key).encrypt(str(data).encode())\n with open('/var/data/secrets.enc', 'wb') as fh:\n fh.write(encrypted)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91bbe73e1ce464e4cea9405639f9626fb477413f9aa3fbd0f7e38a30b606958e", "structural_hash": "f062da80c46a04880e82419f132cf1f3e1845c8a11e437b8e9e229eb837e81f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00709.php", "upstream_id": "BenchmarkTest00709", "language": "php", "code": "input('multipart_field', '');\n $data = '' . $userInput;\n $token = bin2hex(random_bytes(32));\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "062babc4633b05b1c6f20def04000cf95a3bb2afc9985c062e873c51b6aba931", "structural_hash": "656cf8ea7ca2d7cbb203525be761cc5b3d70b8b10b145fbebed489982ce43864", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00377.cpp", "upstream_id": "BenchmarkTest00377", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n char _dst[16];\n if (data.size() < sizeof(_dst)) std::strcpy(_dst, data.c_str());\n else _dst[0] = '\\0';\n std::cout << _dst << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcffc684ff2c77b28c429f26c629ac2e2cf43c2ebbb16452983ddf9c6643316f", "structural_hash": "e25039b930a4e4718ccf1c7786246bca7a69b6330c9791afc698b231d2f2d4ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03820.ts", "upstream_id": "BenchmarkTest03820", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = cookieToken || \"\";\n const data = userInput != null ? userInput : '';\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { throw new BadRequestException({ error: \"out of range\" }); }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aadcd4de65da475d04de1ee72100b74c47cfd4c402b01d7beed1e67c1d9e22c4", "structural_hash": "0839037edcad8c628af09bcde2634a1f6950fefbdbb829530b4458516f34a8bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12237.go", "upstream_id": "BenchmarkTest12237", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\t_prefix := \"\"\n\tif len(commentText) > 0 {\n\t\t_prefix = strings.ToLower(commentText[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = commentText\n\tcase \"f\":\n\t\tdata = commentText\n\tdefault:\n\t\tdata = commentText\n\t}\n\tpanic(fmt.Sprintf(\"processing failed: %s\", data))\n}", "label": 1, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06b6c528bcc06fb45b6d913d8107ede274d539328960cfeb10ae02e329259041", "structural_hash": "7d986a92f6d57464d08f2bf3dd766b578bd31f46b46def68ece371162875228a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00913.py", "upstream_id": "BenchmarkTest00913", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n if upload_name:\n data = upload_name\n else:\n data = ''\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d02e2f0611363780456fa734fda3a9ecdd2de56fd3a48d3b1834d75726e5d1e5", "structural_hash": "f8a3701607bfb9b5f3106e359eab33ea27bec8fd2959d50fa91b5043dcee4509", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03308.php", "upstream_id": "BenchmarkTest03308", "language": "php", "code": "headers->get('Authorization', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "129c29b3a4b9b87890c7da02c15f54be75a34408b628082eae92f1a48433f4b9", "structural_hash": "7839809c94524df7a26b905a0ab0f32db5061bd19c0313a0c93061c9346f8f93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00598.java", "upstream_id": "BenchmarkTest00598", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String argValue = java.util.Optional.ofNullable(System.getProperty(\"argv.value\", \"\")).orElse(\"\");\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(argValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n java.nio.file.Path baseName = java.nio.file.Paths.get(data).getFileName();\n String checkedPath = \"/var/app/data/\" + (baseName == null ? \"index\" : baseName.toString());\n Files.delete(Paths.get(checkedPath));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebfbc026a83140d0d67fa30d1de410179489fbec2123474a0ba9d987a3ba71c4", "structural_hash": "be4e8b8f2e30d55290238e8c7d50370739dd258551db71f3bf761f1f4357d60a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15417.c", "upstream_id": "BenchmarkTest15417", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n int _d = atoi(data);\n if (_d == 0) return;\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4bf0a0af9b65cdd6f9bbcb2b2e2a335c840fa1189f5c68d9e6b6f76e5cdd5be", "structural_hash": "c5a7c1fabdef342356608a3d5a961b3ccaa221d170d79dafbe49eeac387f3891", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05448.py", "upstream_id": "BenchmarkTest05448", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nfrom pydantic import BaseModel\nimport os\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = json_value if json_value else 'default'\n key = os.environ['DATA_ENC_KEY'].encode()\n encrypted = Fernet(key).encrypt(str(data).encode())\n with open('/var/data/secrets.enc', 'wb') as fh:\n fh.write(encrypted)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc4c79cc7caff7d9b3b44b3520f564536ccd81758f0f6352c4c1332f1bf26329", "structural_hash": "96a271b13c407fa2e5a58fe90587a727d44c9b76a20b9a2a09dfb3d11456be54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01458.js", "upstream_id": "BenchmarkTest01458", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da08f4e779c1e1156d2173d07d0e55c333077ddfb335cf20da7a13eb50a309f5", "structural_hash": "214b12e1834310f1696e024eb69135ce118e028a3f6cde1106315e6068612403", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08027.go", "upstream_id": "BenchmarkTest08027", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tdata := fmt.Sprintf(\"%s\", multipartValue)\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "149be7780b53d0c52a17f0f55ec722baf1ae0b55f889a44bc94b5cd16b703950", "structural_hash": "1c472530e712b94aeca5d97891ee147369fa7579a200197c89c8b508fe654728", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03689.rs", "upstream_id": "BenchmarkTest03689", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = if field_value.len() <= 4096 { field_value.clone() } else { field_value.chars().take(4096).collect() };\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa72ce21e74d0dafbc23992641f0c45c70980b5ba559bbb74567268f703d54a1", "structural_hash": "006ee0388d4a0eb2e932987756c956834027cb0dbd26f42e994d28a793c24bcd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02504.py", "upstream_id": "BenchmarkTest02504", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n data = str(auth_header).replace('\\x00', '')\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n trusted_claim = str(processed)\n return jsonify({'trusted': trusted_claim}), 200", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7760ea1c64a9860e8d15eefb8c413b7e28497af2dad8e8a1f5a267ef21d3447d", "structural_hash": "5797ef423339043ccb32ec47781ce16c21cec8cae04377b7a57c9cdcec63cdb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04257.php", "upstream_id": "BenchmarkTest04257", "language": "php", "code": "request->get('field', '');\n $data = (!empty($userInput)) ? $userInput : '';\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return new JsonResponse(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n $expectedSig = hash_hmac('sha256', (string) $parsedBool, getenv('DATA_SIGNING_SECRET'));\n if (!hash_equals($expectedSig, (string) ($request->headers->get('X-Signature', '')))) { return new JsonResponse(['error' => 'integrity check failed'], 403); }\n $trusted = (string) $parsedBool;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0633793e2be1688881ac834b5f24adede2a6e62cf700e25ac74e96d2fe4b5e45", "structural_hash": "fd583b64b5ff9a5bf6a2e36bc5b5890518e6290f3d575b9dbc9ff74a818d7e64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03030.ts", "upstream_id": "BenchmarkTest03030", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n res.json({ status: 'ok' }); return;\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1bc585519920424103d812d79a50d07fbb91c95c4e4c83e86b98c2d69be3fd7f", "structural_hash": "1ec591ea1a1c6b041e3ada1eae72454bf227d1e1ef67a982df8e16374fbecbb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09860.c", "upstream_id": "BenchmarkTest09860", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "158e7788cce9c0b35d602d3a943b9f13aaf59ea806986e4f912c37d6ed82aaab", "structural_hash": "f5f5474b5c109fb0e4d7481514ae7a2a749a21def4a2fed9792636bca1dc8217", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03570.cpp", "upstream_id": "BenchmarkTest03570", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc2539ccf80e822bbd087b385c491eadcfe908a986792ebc193647f48737ef45", "structural_hash": "813b1c468ec5e88ffc1107778aa23201b78402666427e25aeefc4f6c1c2095dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18026.go", "upstream_id": "BenchmarkTest18026", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/antchfx/xmlquery\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tcapture := func() string { return headerValue }\n\tdata := capture()\n\txmlDoc, xmlErr := xmlquery.Parse(strings.NewReader(\"\"))\n\tif xmlErr != nil {\n\t\tc.String(http.StatusInternalServerError, xmlErr.Error())\n\t\treturn\n\t}\n\txmlquery.FindOne(xmlDoc, \"//user[@name='\"+data+\"']\")\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c4d88ca0934e26cdb643007918b2d7a45ee2dc01f443da013f2110e5e61d713", "structural_hash": "b603d9efa81ef1c987ae5694ddfa9a86fcef72a8293293dfaa4d249ea5758b64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03552.py", "upstream_id": "BenchmarkTest03552", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n def normalize(value):\n return value.strip()\n data = normalize(ua_value)\n exec(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0049a23111f08c3ebb7ae45e5c5007f381438f5898181ae991807307fe61355b", "structural_hash": "a5f95a49158864ceb87e15ce07b8f2bbec8d8239557ef5a486cd521200beebda", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02015.js", "upstream_id": "BenchmarkTest02015", "language": "javascript", "code": "const { passthrough, escapeHtml } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = passthrough(userInput);\n res.send(escapeHtml(data));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a960a89ec9470a1bfff3859828bd4ee7e11ab1c5cd0448013f616328e7fdd42", "structural_hash": "3c6484f5ea7a5e16f6ebff199724334f1091b2a00ae4e6820c66674051e09689", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04366.rs", "upstream_id": "BenchmarkTest04366", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(raw_body.clone());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::render_html(&format!(\"
{}
\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c356ca2ade95f2200cea20a4b07e789b81ae4dcf6396ead750d64784a834b11", "structural_hash": "a4997d5e878937bf1681bd394bf3165a4ae0c2c86076f9597f1c3122a282effb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02782.php", "upstream_id": "BenchmarkTest02782", "language": "php", "code": "request->get('field', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n simplexml_load_string($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e7a7db7263abe4fdd0869cd91b5d618630f33dfb7eb615157759ba21509dd79", "structural_hash": "38c517a63cc7defb4c62cf4b7a0c84c160426a011864957aade2475691f513a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14537.sh", "upstream_id": "BenchmarkTest14537", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n result=$((100 / $data))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "991ff286008ed381c6695e9e367b002320a6ed7ed19fd94dcda3664f75376f40", "structural_hash": "b49d1bcca1de6048d05c606cf2cd76bd61f790c3e55380130f92b0571cfcba9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16694.go", "upstream_id": "BenchmarkTest16694", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tdotenvValue := os.Getenv(\"DOTENV_VAR\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(dotenvValue)\n\t}()\n\tdata := <-resultCh\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d460043ec2e52da2d7d8668f9ac35972d5c9b99857b8f69e5fc222a431765be", "structural_hash": "8bdc59821a1d775fbbbf279e55dec6b3a1834f19c514219ff5b9119e46c7a1ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00178.java", "upstream_id": "BenchmarkTest00178", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n byte[] hexBytes = new byte[userId.length() / 2];\n for (int hexIdx = 0; hexIdx < hexBytes.length; hexIdx++) {\n hexBytes[hexIdx] = (byte) Integer.parseInt(userId.substring(hexIdx * 2, hexIdx * 2 + 2), 16);\n }\n String data = new String(hexBytes, java.nio.charset.StandardCharsets.UTF_8);\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5429f5a1e937532ed9b31bfc1766f01efc80977595e85a5445372cc419104d96", "structural_hash": "d2b1e792efc415894588651d1d4385887cf1064fff168957667204e0d028d08f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18314.c", "upstream_id": "BenchmarkTest18314", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n long _v = strtol(data, NULL, 10);\n signed char _c = (signed char)_v;\n printf(\"%d\\n\", (int)_c);\n}", "label": 1, "cwe": ["CWE-194"], "category": "sign_extension", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sign_extension", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2412175f5e58976e033c67cfee7cbf9e3902cefd9015be6258b3a67e24ed1ee2", "structural_hash": "5675c027eacdd2e4ddb4778e706eeb271da9a4345bfc0d09389084a2d2d6f6c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03270.ts", "upstream_id": "BenchmarkTest03270", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c96f4962aa493364b5d6619bbe706b8712e2b1c633590dc228ae08760eb56aae", "structural_hash": "06a725af55d32b803b82c9d163fe4ff3819f0d98792e71f0f787a1648de024dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01690.py", "upstream_id": "BenchmarkTest01690", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n secret_value = 'config_secret_test_abc123'\n data, _sep, _rest = str(secret_value).partition('\\x00')\n auth_check('user', data)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa023c39700b241df6c0a8263fb4a1c117e60f69cf57a4bf8d922bf33aceae38", "structural_hash": "ee28a6c17f8ac9356f510ceec731fdd4c4781a0b3fd19571acc111647fb84a97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38923.js", "upstream_id": "BenchmarkTest38923", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n eval(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-749"], "category": "exposed_dangerous_fn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5827bc322a644e93fb2a70558937a7e3d861589f7ea22afe98ff3e344f93fe21", "structural_hash": "e1649f7fdd1d82bd650f644c5d542bbfa65e6d97e399c1d255db554a9c36da14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03995.rs", "upstream_id": "BenchmarkTest03995", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: origin_value.clone() };\n let data = payload.value().to_string();\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a2ca613b0930918dc77f775573136886f0dfdad53ed38a52c47d242112b8caf", "structural_hash": "460e39db66c564f7f54e24f47896fd3b0d7dcb3ed5a644e5f910143ba7d4e7f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02554.cpp", "upstream_id": "BenchmarkTest02554", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27b8095052413f5fb444ea02c604ae472f4d0eee4ae9d1bead703affd0c87b89", "structural_hash": "1805fe7de7dad43bcb3d9ea1e8bc5189a090ceca2cc11c9c86d55ceb37ae2a36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05017.rs", "upstream_id": "BenchmarkTest05017", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: forwarded_ip.clone() }.payload;\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f38bfae75b4baa0be970c0b3c7ee70057d1354286f6c822930fab313ef0649e", "structural_hash": "c6b3e75f50337f764ad473b651dddf0b5bb5d55cf837ef927d4665dcdb909b59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03825.cpp", "upstream_id": "BenchmarkTest03825", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"https://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e12f170e0467e1d78838663400f85a4a8e2cad213f93bc8f7efc255d4c7f116", "structural_hash": "b27165daa4c57bd77ab70ecafe9225662847ce05c69e1a74752deba082b2755f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02320.ts", "upstream_id": "BenchmarkTest02320", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = String(userInput).slice(0, 200);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78586399e8d21554541f4c7d94900e770ff96eadc577cdac5e2e98b1625ba874", "structural_hash": "828977f47cd5e77c2b358e123fb23cc748fb5e2be3a66547cfc0b0cee42d91e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00734.ts", "upstream_id": "BenchmarkTest00734", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n fs.unlinkSync(\"/var/app/data/\" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63fce1503b16e7865bc379b163f72e66e9a9d09bd6a6fc40f9db082f55760220", "structural_hash": "f35ebc30e7ef5c1473a02ec90ca3e2ca25dd29622f2c4a6521c949ac91aa79b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20330.js", "upstream_id": "BenchmarkTest20330", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = String(userInput).slice(0, 200);\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c56f492fa0ccb4af723e119ded6319cf7fed63d48c127505aa34e0aa31b79f07", "structural_hash": "1428cf488df61a0cff937ce20d70253412f699cec457c4d43805ac29f5d5e733", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03126.rb", "upstream_id": "BenchmarkTest03126", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66031e781f46c4a9c145794c4a48a780abadb4fa2fe98d8b72bc7b554ca1a890", "structural_hash": "b73d15640e4e69d640f363bbd7ad47cca5562d6fdefbfdded7595fcb0fa8dd51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10039.c", "upstream_id": "BenchmarkTest10039", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81436e12507476578ccc29f061aca35adb1bc43c10ff47983c5346f536243f35", "structural_hash": "94e84994945e5bf71b5bcfb2b227d42abbb1806794e3118f83647b276d093964", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23537.js", "upstream_id": "BenchmarkTest23537", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = \"\" + userInput;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + processed + \";\");\n require(\"/var/app/plugins/generated.js\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eab2ac20ab4c90c73da0404b08995fc30a91f36b0c64dd60b75f045ea688b128", "structural_hash": "78c0d8363fdf8ca5ccf01770722b59a93152acaf17b1a99d8ae8da628afd97ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03292.rb", "upstream_id": "BenchmarkTest03292", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n payload, _origin = user_input, 'http'\n data = payload\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eece57ffadb874acb13cc42826ddbed283455656adddb160720dde894debc802", "structural_hash": "03d01934479056014bb6511f43254403d1ff35d47f15dffa44fdae24a25a2bca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03991.java", "upstream_id": "BenchmarkTest03991", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = \"\" + authHeader;\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35d483954a8df6c2c7254608f202431470a95ced2f8c74130d6ce44c783f72ef", "structural_hash": "b55eb8bb6942160d937d625a1bb06164ce2807d2fea8c9283c38112fe8476351", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00133.ts", "upstream_id": "BenchmarkTest00133", "language": "typescript", "code": "import { Controller, Post, Query } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58c1533aced2ed895ca6da0edc319eca61ac64a654e605be325bc26108e8390a", "structural_hash": "67de3bf6440da1f8ff9908aa3c6957c35eb00836ec91d837453e892062a55126", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32685.sh", "upstream_id": "BenchmarkTest32685", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo $((RANDOM % 16))\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-331"], "category": "insufficient_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78488980ab9f13e04b7bd1132ea98f0b93056ec0265a000bf65401ad1c60c8c6", "structural_hash": "df9d02ed8165baed63fb7d8c98403c94d74750faf1015a98c9f4f3a0cf1e677c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00720.php", "upstream_id": "BenchmarkTest00720", "language": "php", "code": "getContent();\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "301f35c0abd60f7abb50aa70901e1df8275d86fa9fad6971b5ae65ec2b09d20f", "structural_hash": "a4cd2664b25c71d7f21d2f217c6859236d2ea6d757a304c4584bc6cd9efd370f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04398.rs", "upstream_id": "BenchmarkTest04398", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in path_value.split(',') { data = token.to_string(); }\n let _role = data.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20346dc03f32f5e2c8e0d0ece335cefd2234185f9919bb0f9975b91ec5cff84b", "structural_hash": "c88b43b7c7d359b39c50d56f9bcf6209d3e67ba572265ab9ba4105e84e0e963b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07638.go", "upstream_id": "BenchmarkTest07638", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tvar data string\n\tif len(pathValue) > 0 {\n\t\tdata = pathValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\ttmpPath := filepath.Join(\"/tmp\", filepath.Base(data))\n\tos.WriteFile(tmpPath, []byte(\"data\"), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0e38c093153461c12f82578941d3a6c99ef2f468fa49ede5bc10dabaaf942b1", "structural_hash": "9ead64e97656c895a6c2780511a09256ca88c901cafb06344ad72f58810e555c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01009.cpp", "upstream_id": "BenchmarkTest01009", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28a10d21ca80e89ed5ac4d473cbdd32feba029bd16b276092f1ac6cbaf29bf2a", "structural_hash": "e1a0c661071b061b62f3f84c28d54612dc25dbbdfebae652f5ca525460f28ae9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00747.py", "upstream_id": "BenchmarkTest00747", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n if env_value:\n data = env_value\n else:\n data = ''\n if data not in ('asc', 'desc', 'name', 'created'):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n os.unlink('/var/app/data/' + str(processed))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "604162e2b5ca25d1a397cfd95e9a28d2ae6869e1741f05f4ebb5567d5a63b0d2", "structural_hash": "128e2a949c45ea5aa12f8907dc43f0e4e6a41129dd56984895cf566a663738f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01314.cpp", "upstream_id": "BenchmarkTest01314", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee90564f426154cb60d62e8e827ee67fe89384327ab0bfbc8dd83d47028a2c82", "structural_hash": "f670548ae603fc4c73f0995beb83ce108ec42c781180d53d75d2587f5761da81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04277.ts", "upstream_id": "BenchmarkTest04277", "language": "typescript", "code": "import { Body, Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = (vars?.input as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91d7fca88b32121bc6f68fd1c357eefac9735c3d13e4a1e12c789f9c6f01b4a3", "structural_hash": "73ca2af5255262277d0795359fd5c8f5f9fc4c5cae597f549c05f3e71a10ff00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04421.rb", "upstream_id": "BenchmarkTest04421", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
\" + processed + \"
\").html_safe\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a98039b8b4b05d0771ea260d9975bf5952d47a027a9f409e257149e0e58fa65e", "structural_hash": "ac3b52286c27036d4adb9dc514eeab4fd6e4633bf56d1d0e5d35b1467cab8776", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04175.rs", "upstream_id": "BenchmarkTest04175", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: json_value.clone() };\n let data = payload.value().to_string();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd28d7d14f2c13c73912468f04ef686ec64d147a66e47e42f95ef7e16d48a99b", "structural_hash": "208d4c382aafb8328f663e55891860dafb3db2ecbd6526ffa7275203f0b37a5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01611.java", "upstream_id": "BenchmarkTest01611", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(cookieValue)); }\n catch (NumberFormatException e) { data = cookieValue; }\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9deedf1f150c91216f3a1201ffe1d5021d25749967aac3bcd28a45d6cdd3918e", "structural_hash": "bec15ac9ff633d26f3eeb617d08b30dbba4851b62f398bdda5ba463dfe7621f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22621.js", "upstream_id": "BenchmarkTest22621", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const data = \"\" + userInput;\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91a9aae496aff2efc8f7abb44d0c2f01a1b5af7909db50ebd3177a81fb464879", "structural_hash": "cfe65f5c62663ba7149b2fe9b3294043c9e242acc58f176a9138c47ed9f0a296", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05041.py", "upstream_id": "BenchmarkTest05041", "language": "python", "code": "import ldap\nimport re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n parts = str(origin_value).split(',')\n data = ','.join(parts)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0bcf0f9d86735f5fefb3cb318ca5725cce69b3515761b506f1d26c1e7f3c856", "structural_hash": "5d7c4cf5cd9abb27982281c201e41de2c2e3dfb207cbc962012cb8ac2cfb83b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02303.rs", "upstream_id": "BenchmarkTest02303", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n struct FormData { payload: String }\n let data = FormData { payload: multipart_value.clone() }.payload;\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return (StatusCode::NOT_FOUND, \"\").into_response() };\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88f76093c5ee91ce8d28f4d612f682f8d9d83384569b5bee2f7c1e90cb359448", "structural_hash": "8b061ee3fc98c973a0d2f0245c0ad60f073e7bfd3f4bff39e4f607489a221794", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02711.ts", "upstream_id": "BenchmarkTest02711", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n fs.writeFileSync(\"/var/app/active/pkg.bin\", _content);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd03e016217124d92ded3623f723f8fc471cb2980fb05a9c4e6a1a22b2859703", "structural_hash": "ba057b5f581d4e4919879ed5b95c7f0c31bba0459040cae71c5000ace6e054e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00284.js", "upstream_id": "BenchmarkTest00284", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b756dcc9f9ee07d0798c58eb95f839e50989fe6311bf29f99502a2b181729e8", "structural_hash": "7b335e960d2e30f6b2da5d930352045e6a67ff7f223ca5456576e51c4d7fd65a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05460.sh", "upstream_id": "BenchmarkTest05460", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f58e745366619e7aed5247a599ca6de77c20f2a8286951c84a672d31c297712e", "structural_hash": "c60d9e1f907e7aa9dbba3ca06c8d418cc08ab7f2a832c0e1658540ef05744921", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04314.ts", "upstream_id": "BenchmarkTest04314", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = await Promise.resolve(userInput);\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n const _cred = String(processed);\n if (shared.authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9970278074546669e8d569723b4441596b6f33f32a8db7c60fde40c097669307", "structural_hash": "61acbd9dbdbcf5166d23105966ec09651d74c150a499d546c7e067809f7e64da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_06051.py", "upstream_id": "BenchmarkTest06051", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom pathlib import Path\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n profile_value = db.fetch_one('SELECT bio FROM profiles LIMIT 1')\n data = '%s' % str(profile_value)\n base = Path('/var/app/data').resolve()\n candidate = (base / data).resolve()\n if base not in candidate.parents and candidate != base:\n return JSONResponse({'error': 'forbidden'}, status_code=403)\n checked_path = str(candidate)\n os.unlink(checked_path)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "546824b772cae2b084c121144e4ce99d3230e6f3972ba49d7480befba7945c4e", "structural_hash": "8ecee650aed8d6a64a0c730c89ddf4ec0e6929c77950fc4724ee6674c0481758", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03576.rs", "upstream_id": "BenchmarkTest03576", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = referer_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n tokio::fs::write(format!(\"/var/app/data/{}\", processed), \"data\").await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d76e8b5406af85a3880a01e5461821383e1ec407783f2d7b42cc51cc66bee97", "structural_hash": "c0e9f66269ea252ed598c17024da2ed3e687b4d8435753a1544fd6b8076cef21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13273.sh", "upstream_id": "BenchmarkTest13273", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n echo \"$data\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df1d7d287983626c3c91da0be70b779183b766774bb29bf91abb693e1103bad3", "structural_hash": "97c1f92d2b4729cd4fdb27511045d4da8a19426c1dbf09133d35c8584d25ff18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00953.ts", "upstream_id": "BenchmarkTest00953", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT body FROM mq_messages WHERE queue = ? LIMIT 1\", [\"tasks\"])).rows[0].body;\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n http.get(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a58f2750c845cdc0fe395d2e258f6602184be90d9c57953c3f8204c8c3da37b6", "structural_hash": "175dc1d28079e5922c9ddc467e7f8c9a797919fdb43e3261e6b0cc795220d49e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12085.go", "upstream_id": "BenchmarkTest12085", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(uaValue) {\n\t\tdata = normalizer(uaValue)\n\t}\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "247bb1f78c099b558624ec48ff9faa48ba364a3974d508980a6b03540099f749", "structural_hash": "7dd7205566d7c65c053fdc8f42e3b0d6151ad636d982b2ccdba4ff6ec50a808c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04935.php", "upstream_id": "BenchmarkTest04935", "language": "php", "code": "headers->get('X-Custom-Header', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38ecdb5c72a4ae32699ef84f1bb203b21c1b7909c96f40fa979fbe83bad173ab", "structural_hash": "75c78d43937d21687443a7727c7cc3dbaa42c94683731c491a864e8344044fd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_06099.py", "upstream_id": "BenchmarkTest06099", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n kind = 'json' if str(referer_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(referer_value).strip()\n case _:\n data = str(referer_value)\n record = db.fetch_one('SELECT * FROM documents WHERE id = ?', (str(data),))\n return jsonify({'record': str(record)}), 200", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d9b0e61e4bffd95e8532617ebbabb78feee08633202d3b2ce612267119fa7d1", "structural_hash": "35ba1467baf6090cf7411c1b45771833fb66eca7d446d673f13ee71d64d45d7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02019.java", "upstream_id": "BenchmarkTest02019", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n String data = forwardedIp.isEmpty() ? \"default\" : forwardedIp;\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b03670bdb2ef0d4822cf54f1002880e1948420cd3d136a53790ec169e13b2e37", "structural_hash": "6b31fda0bee69f1df940f9372e24983193f57f47d689f535253f5f28b765118a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03419.c", "upstream_id": "BenchmarkTest03419", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c959d56824eb8ce9d2d3dfd2f3b82f3c7e4b082a0eb3e39662382a5e5e11468a", "structural_hash": "e4314e6d9103d65b54fa78b2aa73b5b96febb6e67776b03945f03da2f9d23a3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05204.ts", "upstream_id": "BenchmarkTest05204", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aee6feae1788f9c5c692f035cffd992948585cf7668525050ed0f89d63d9c7db", "structural_hash": "e933183118ee7b7475a17a4e3e843e76fde3b8d7667816f9d602f6a1f4b6ede1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05537.js", "upstream_id": "BenchmarkTest05537", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = String(userInput).slice(0, 200);\n req.session.id = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7aece8870f300a116c9a30e71b4c327e1d343ba3a976ccf1763741824d3fd579", "structural_hash": "cdcee09ac60ad62b3928cd36f6ea4368899c063d46d3625b8e036aa12570a6e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22279.sh", "upstream_id": "BenchmarkTest22279", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n chown -- \"$data\" /var/app/run/worker.pid || { echo \"privilege drop failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3189742390a628bead5f2c78ca03e9198f85388185bbece79b2000adb2387db", "structural_hash": "1d6ee06bcf3d0e9ec78ce17ea9031a5805b77a4f358e70b5d9f4c21d9e1a0729", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03696.rs", "upstream_id": "BenchmarkTest03696", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in referer_value.split(',') { data = token.to_string(); }\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")).finish()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1d238d86c55f691271861a1124418fa48b409b5527c81dfb44c81115ce54b2e", "structural_hash": "2b23fe4d0517ea9a81fa49e3739c354344c1b5fe79c59c188f91574d155b26e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01131.rs", "upstream_id": "BenchmarkTest01131", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"setting\", \"default_config_label\")]); m.get(\"setting\").copied().unwrap_or_default().to_string() };\n let mut data = String::new();\n for token in secret_value.split(',') { data = token.to_string(); }\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ct = crate::shared::encrypt_with_key(&store_cred, &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5163ca6dc3d259a3bd29e030264ddc0668d05c0e79108944073e3477ee3065f8", "structural_hash": "442616124ff75ca87a6ac67a2b646478326282564db7a6938650a393a2276e14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33272.sh", "upstream_id": "BenchmarkTest33272", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n local -a _cmd=(\"printf\" \"%s\" \"$data\")\n \"${_cmd[@]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8de8ad489a5c159eb7b185a59f9d729bbf70ef0da1f5bf59a673c6bacb88bb03", "structural_hash": "27091d99ad05d2cc3c8a06eaf6a83294f0162a9f1be99378ae302b9eb6533cec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02834.py", "upstream_id": "BenchmarkTest02834", "language": "python", "code": "from flask import Flask, render_template_string\nimport re\nfrom flask import request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n ctx = RequestContext(xml_value, source='form')\n data = ctx.payload\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n return render_template_string(processed)", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65571efd308a5ee578e6afea3131961de9e001fdae315ede62abc514376cf090", "structural_hash": "1dd7ed7852abfd2ccfcb04cf32c459fed832815321bdcd2ebd468d75f11fcdf1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01856.php", "upstream_id": "BenchmarkTest01856", "language": "php", "code": "header('X-Forwarded-For', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n DB::statement('INSERT INTO logs (data) VALUES (\\'' . $processed . '\\')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-843"], "category": "typejuggling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10b4a7313d49df49895722de946c9a7ca81aadff486007b9964d23a7bb16f1cb", "structural_hash": "52f1ecc920afc6db192d6441dcbe5c24997c01db49f24eaaed587c79b93b7777", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03444.rb", "upstream_id": "BenchmarkTest03444", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n Marshal.load(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c36c4d03fccfb6c6ddd6739a7444be57e10ccf529f3a56c150cbbdbad5ba0fcd", "structural_hash": "2f89450ac6e0104f75740f5f5afb001e0c04425cebf7e668ce58b506acb06f98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07542.c", "upstream_id": "BenchmarkTest07542", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, user_input);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cert_host_mismatch", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df1b69cbe1412762253ad96b7be4bdd9129d9d7e405716b479a03767e3359b4b", "structural_hash": "92c7d12169edaff213c3165af90137d6daa28912f53b91681e4e527827cd5c59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_26407.go", "upstream_id": "BenchmarkTest26407", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(jsonValue)\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\thttp.Error(w, fmt.Sprint(r), 500)\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1602ecb0a957b13dd80d502642efda3ba70ce2b31528ca28cc5750ccc5946eee", "structural_hash": "e87abfa9c122adbff836363442c5a5a3ed57b50d374b91a2079007d996f21618", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00961.ts", "upstream_id": "BenchmarkTest00961", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3842804879a548820e23dadbbbe6503f05871a1b985fd71acd084992abe3e79f", "structural_hash": "b82749832321949d842844e526bb0797af33f9bb250f3a4cc696b149796054ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_20118.go", "upstream_id": "BenchmarkTest20118", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(multipartValue)\n\tif !aclCheck(ctxString(r, ctxKeyUser), data) {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e28005041d0163114623d79f7bb4fca59cb98571b56dad7c9da571dc3111d73e", "structural_hash": "a45b15b745b2ecb7cabcd1a01376cfb1bca936c875df3073646e38267cc9a655", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04488.ts", "upstream_id": "BenchmarkTest04488", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54fddf2420f336e57ad62f94355c8f323d92efb1ae60dec3e3c3550645fdf394", "structural_hash": "c39d27502286fb4b8880d8d060aa4c2f0e486118be8596d476c772849b5b9e41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01093.py", "upstream_id": "BenchmarkTest01093", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['doc'].filename\n data, _sep, _rest = str(upload_name).partition('\\x00')\n allowed_ext = ('.jpg', '.png', '.gif', '.pdf')\n if not data.lower().endswith(allowed_ext):\n return jsonify({'error': 'invalid file type'}), 400\n entry_file = os.path.basename(data)\n with open('/var/uploads/' + str(entry_file), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10cb9093e60e3d7499be812b2aa7144b48ed55334ab5b6d46d9b8845525dfa4a", "structural_hash": "7cf165d5b82ba9e2e68b07c0b1826abea967ef66ca5a94ca516bb194662f7e11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06507.js", "upstream_id": "BenchmarkTest06507", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = passthrough(userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-311"], "category": "missing_encryption", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a1f2b3958ca95b9955df0608422ecda68491aa64c39e769e312a9bcd6be2830", "structural_hash": "f381876a4812fb290405a8388e0fda40d3e76aabf177104fe2b76dd040f1c1fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06053.c", "upstream_id": "BenchmarkTest06053", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16ec85f584116450795aec2ab28faa4f0f3a5e9c92d20d16b43a09e5fd732cca", "structural_hash": "3debcc2f30fc7c95f764826373c79a0f748bbf831454fca9c67f0daf82409ad5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02651.cpp", "upstream_id": "BenchmarkTest02651", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ac5a509549689411137ebbff63debbe78d53cbd17f40099e95f1934dfb8872c", "structural_hash": "3e4ed8847c5dfcaf519e3d0ef8a5adc397957bba3b8b5036b2c30936f5b49f52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13540.c", "upstream_id": "BenchmarkTest13540", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c3bbdc35c4e37be3268d5f6348edbf38317d4344db45aff95661de9379597d6", "structural_hash": "c32d5c400b41328a0035b250dba79cbb5fe9e832946a7e672de4cab7e9faa885", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02540.cpp", "upstream_id": "BenchmarkTest02540", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n unsigned char _digest[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2951d2525ae533051ffb3602178618c3f07837c397bac0efed7fb4026a2516f", "structural_hash": "2b3450c55dca81c352e651fd8bfef2c8578b02d7ab53ad216c188c3ed5dd1900", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01584.rb", "upstream_id": "BenchmarkTest01584", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n eval(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4dace251a2843c00bc1160e715cfb395c76ebe149c8f6cd3b4925fac404a976c", "structural_hash": "afaeb561e6748c59710129a4ee23bef590a132b79c1f41b2b92dd36001cf1528", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04109.php", "upstream_id": "BenchmarkTest04109", "language": "php", "code": "header('X-Custom-Header', '');\n $data = ($userInput !== null) ? $userInput : '';\n $trusted = (string) $data;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "535a3103ddca7bba484db27298593cc2308067a8097afd6a634a6fe88075cd62", "structural_hash": "606ba6f1b898b74df19856664278c27b972adcc6ae836a73f51dd501300dad26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25305.js", "upstream_id": "BenchmarkTest25305", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n switch (data) { case \"a\": break; case \"b\": break; default: break; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ead13d16af635c4107fe802387e90db5ea4eaf05242c777bd4636bc94b90baff", "structural_hash": "a65d77b8a8aec2c2c343cd324c8091bde9efda8f7ddd31b330df95f529e81e32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00395.rb", "upstream_id": "BenchmarkTest00395", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f49e1cfdc07a3d3740621f60151bb5863fce433fe2b5f5269e62ef56ba73abd1", "structural_hash": "6a1905898db1e11a60d31f4f2191d59289a148d64556ba32ddd22ad22c9b3810", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03533.py", "upstream_id": "BenchmarkTest03533", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n data = str(origin_value).replace('\\x00', '')\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "accfb191495165dfa68dc62fa9839b406db412da58fcf996957cfbb386f789e8", "structural_hash": "574eab5867eeffa04134018ee3d4992bf10e306de30fa829d788996520237111", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00157.ts", "upstream_id": "BenchmarkTest00157", "language": "typescript", "code": "import { Body, Controller, Post, InternalServerErrorException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n throw new InternalServerErrorException({ error: \"unable to process request\" });\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d15dab322cc945161d5c9431652f6c03374c0f9da4700f623088c21b72b74091", "structural_hash": "6b011f143704091d648888f450ad528652077b3f3ef15220a4ab1ff917cac642", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02844.cpp", "upstream_id": "BenchmarkTest02844", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string safe = std::filesystem::path(data).filename().string();\n if (FILE *_f = std::fopen(safe.c_str(), \"r\")) std::fclose(_f);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3be7c89f8123afa3ca8c6bf4eb75c8d08103031ea7e0d010d83628cf25ab72ea", "structural_hash": "98705fd8dfd531aff2d46250d5ff3f925bdf3a699aa6d6ebf3cc669b19d3a2e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03749.java", "upstream_id": "BenchmarkTest03749", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : rawData.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n byte[] passwordSalt = new byte[16]; new java.security.SecureRandom().nextBytes(passwordSalt);\n javax.crypto.SecretKeyFactory skf = javax.crypto.SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n byte[] derived = skf.generateSecret(new javax.crypto.spec.PBEKeySpec(data.toCharArray(), passwordSalt, 100000, 256)).getEncoded();\n response.setHeader(\"X-PBKDF2\", java.util.Base64.getEncoder().encodeToString(derived));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e5fa7f644522d9e1aef9df7e7c8846f99b3dda63e01ec563d414dd65d206f69", "structural_hash": "70739bc1010004ea4a6f945fec874aadb8f88c77482fe8d3b74b4b432fd5049d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03647.ts", "upstream_id": "BenchmarkTest03647", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cdd0bf906e1b80dd9bb7ad48471bf38d1b3abb8c0ac34e2253b8707177be71c7", "structural_hash": "6bac8eebcfa1b86e9a5955d7be2e9e118c5b17c8e5486a5d48a05de6e4b59dba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00126.rb", "upstream_id": "BenchmarkTest00126", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"base64\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = Base64.decode64(user_input)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [processed, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3c6734f78adb785ed5c556d26afd79cd6a1daa33df4a2fa2912f577358856cc", "structural_hash": "e30a09d0b2b61264311cee18118e6884c0aac5ffeffba094052e50f7f64aace7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00272.rs", "upstream_id": "BenchmarkTest00272", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in origin_value.split(',') { data = token.to_string(); }\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3983a5e59ed0f91bbd245a8f4d0a0669057c75564a9894a597aa4f2ea0100edf", "structural_hash": "3aa61a829ebacf4051842a84e701bad1dd7eccba58630a8a45f6d2f36cf42943", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17361.go", "upstream_id": "BenchmarkTest17361", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/base64\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdecodedBytes, _ := base64.StdEncoding.DecodeString(dbValue)\n\tdata := string(decodedBytes)\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tc.JSON(http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-337"], "category": "predictable_prng_seed", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ddc1e67b161bda352b2e6692fc204604893faa5d4ab225ac3ad6565ed92d03ea", "structural_hash": "28fe660e3cebe0163877704befe8e5c4c5cd0c0b749687d2f4d2f42c6aef7868", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01561.rb", "upstream_id": "BenchmarkTest01561", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n processed = data.length > 64 ? data[0, 64] : data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + processed + \"']\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fd65870bca4b95ba00d71a36215a9987e0ce8a06217013e60507d14572821b9", "structural_hash": "522de0a1a25208afa4153aafc5bfbf18423f000816b3f984b6c8ba1084a3d92e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01337.py", "upstream_id": "BenchmarkTest01337", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\ndef benchmark_case(request):\n secret_value = 'config_secret_test_abc123'\n data = '%s' % (secret_value,)\n Fernet(data.encode() if isinstance(data, str) else data).encrypt(b'data')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c593a3868f582bcbfd46beb67696b235e70484ee946fff83693df53a3d2c1b95", "structural_hash": "6b7ef5b87ba5333eab0ee27dadda3291592bb4ccb3dde780a4d78fa315deab05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00313.rs", "upstream_id": "BenchmarkTest00313", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let data = user_id.split_whitespace().collect::>().join(\" \");\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a7c929ab50acf14106b1cb69c3cf9e2347a0738a469d97901d75e7cc49951f6", "structural_hash": "58cc59739381f9f2f6986111f861051c6f0f315f7370d97df018cf8e68f01597", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24586.sh", "upstream_id": "BenchmarkTest24586", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n _fname=$(basename -- \"$data\")\n case \"$_fname\" in *.jpg|*.png|*.gif|*.pdf) entry_file=\"$_fname\";; *) echo \"invalid file type\"; exit 1;; esac\n echo \"uploaded\" > \"/var/uploads/$entry_file\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9800660e429bcd1eead09ed6bb5f0466c205d0a44530465828d978923d15b34", "structural_hash": "64570de08cb8dac1ba9695fb43be7e4ce7af13b9e893992f990c92ea4050ccc0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01094.ts", "upstream_id": "BenchmarkTest01094", "language": "typescript", "code": "import { Controller, Post, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File): Promise {\n const userInput = file?.originalname || \"\";\n const data = `${userInput}`;\n JSON.parse(data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6c419cf74e545057cc2ade7dfe03210918e4595369857ce44b7c3330370e475", "structural_hash": "cf4e6a3f9cb51fb824c50820d1b2fedafe1e44f368d564d2c4d2045910f1acb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15880.c", "upstream_id": "BenchmarkTest15880", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3b2a438f6760a4b0b7e805e5af5f3c17495815328e91341a732c34f6a0226a1", "structural_hash": "21cf5fc3b598e0ef446cd45b725f2479598f5521f8936a6d7bc3c0f030c87a8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09145.sh", "upstream_id": "BenchmarkTest09145", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n trusted_claim=\"$data\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f03f17ecf465090181fca823d12a4dfcf2787e4847415b8a0a7fe7caef944042", "structural_hash": "1c8cfa34c5e9691273595755df13d49c555b77150901a6bbd70b32aa3c08a489", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_31820.js", "upstream_id": "BenchmarkTest31820", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n try { JSON.parse(data); } catch(e) { }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32e826307cca62c0bfe51cd5756ee68d95ba969a33fcbb9c7c7fd4aca1a70afa", "structural_hash": "9ebae25e1f1c9c34f687d88597b30f98b428b26807a499190c931aecb1cd29aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11698.c", "upstream_id": "BenchmarkTest11698", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _vals[8];\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 1, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee60aa302724e0442ae02a0265c6739a3cc10903ddab1b23edc75d3ecfeff506", "structural_hash": "03ce2ab152286deec1424c67343126131ed79b70b742fb8e4215b18b942df0f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00383.py", "upstream_id": "BenchmarkTest00383", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n origin_value = request.headers.get('origin', '')\n parts = str(origin_value).split(',')\n data = ','.join(parts)\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90efbf155c44b76b57e5c5d36470599fdfdee31f96b642a723bf0a7e1a873a31", "structural_hash": "ef1223a3f024dd2e5fed96eb8dd5b09bbe6558397e7e23578edc2f16ae09ca9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03965.cpp", "upstream_id": "BenchmarkTest03965", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d405d934fdff8a01d9f6f3020e8541113fa917ae2b1b67c38b95e7884b8e0d52", "structural_hash": "a66579a31f0ef19d6fe67ffd8c7acff9dd590f2529aef6c3ffe754dcfff7dd2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09383.js", "upstream_id": "BenchmarkTest09383", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n ctx.body = { validated: String(processed) }; return;\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "762ad8bb04a883bb41ceadab5ab48f69aeaa47615b3b6b78a9466c97df24a559", "structural_hash": "ffdbfdeacd92cb6ff4e2149dcfb68e28991ef4dbcd2774d9aa1a2e368f2be602", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10165.c", "upstream_id": "BenchmarkTest10165", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_passthrough(user_input);\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NOENT);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96e09068b077b055aca18d110179991e5b5eb5d904fa2dee5d583d539c05011f", "structural_hash": "014fdc2b801188b0865ff257b7f1fcdb81a7bb157c720d5b44ebce7aa627d671", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04533.ts", "upstream_id": "BenchmarkTest04533", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1defb878020113943780811a8510564e7501fb27ce2a5852f2183124e853f4a3", "structural_hash": "cf9bf18da4df0f7ebf8471747680edbfb32aa8310092699bc0b36f4ceca8b29b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00534.py", "upstream_id": "BenchmarkTest00534", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n kind = 'json' if str(forwarded_ip).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(forwarded_ip).strip()\n case _:\n data = str(forwarded_ip)\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b981b9e0318d48b17db4b4031d45f605c0c2ffc7b81bff76a82be294477b206", "structural_hash": "77c88026a3f0f1e1509baf7394d3c209921955b442343e34680e9e041b19fd6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12560.sh", "upstream_id": "BenchmarkTest12560", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n IFS=\",\" read -r -a values <<< \"$processed\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54c65a3eae4cae48cd3128e11355d07931712e8712c5ca7bfad19a3ae1435e47", "structural_hash": "f6ed7852d63a257b2795115d9d64f23449411a262b793a1d856f30d47b4925bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00792.java", "upstream_id": "BenchmarkTest00792", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data;\n if (rawData.length() > 256) { data = rawData.substring(0, 256); }\n else { data = rawData; }\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "800e63022fa9c572dbf6e2db3fa60f6e6635d9ee0ae40b07297169bdef031f21", "structural_hash": "e6cca980fd08690d8ce649f56271fb53dc3ebc2b5ba99587fbcca59b711de35f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11797.js", "upstream_id": "BenchmarkTest11797", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29beae2feb5a8562f0f2715db7b08d2c44af7bb8fe5446a77e292ded7fd54be9", "structural_hash": "84fc9b6129267d0b40692cb142c16ffdb7b761782eb9bd086683ae4aa121ba16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04995.py", "upstream_id": "BenchmarkTest04995", "language": "python", "code": "from django.http import JsonResponse\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n data = (lambda v: v.strip())(referer_value)\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "900e77e5466febb3876bb012a0cef166d78335cb7b0d6714672f52730d656275", "structural_hash": "933f63eebfa15823e44a30c902f28db8436dbcba52d04095359a03282df3d531", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03996.php", "upstream_id": "BenchmarkTest03996", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "108b300869317cbd97e883d20e2ee7e88e35a3963a40bbd7b0dfff9090ff2fdd", "structural_hash": "4bfc668545c09a39a4b2fcff73ab3a4eab375eee104b200d77c1764548d64216", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_21252.go", "upstream_id": "BenchmarkTest21252", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"go.mongodb.org/mongo-driver/bson\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuaValue := c.GetHeader(\"User-Agent\")\n\tdata := strings.Join(strings.Fields(uaValue), \" \")\n\tvar mongoFilter bson.M\n\tjson.Unmarshal([]byte(data), &mongoFilter)\n\tmongoClient.Database(\"benchmark\").Collection(\"users\").FindOne(context.Background(), mongoFilter)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "117c02526205d3ecc0f4f83f94bc8667cc0d925bce6970644743e9090713d8da", "structural_hash": "82317b05213222894da67107d47a5aa988119b815c30a13bc27b50885cd23f17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19034.go", "upstream_id": "BenchmarkTest19034", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tholder := InputCarrier{UserInput: fieldValue}\n\tdata := holder.UserInput\n\tf, _ := os.CreateTemp(\"/var/app/tmp\", \"upload-\")\n\tif f != nil {\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f7d2c16d938ec590f83d78f3afae6cf56b4b0b716cb07318241ca0f7dd82d9f", "structural_hash": "9d461515bcc39675147a5637d99e268f2464857767de979bb07f694c418cf184", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02626.php", "upstream_id": "BenchmarkTest02626", "language": "php", "code": "headers->get('User-Agent', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $processed = preg_replace('/[A-Za-z0-9]{4,}/', '****', str_replace([\"\\r\", \"\\n\"], '', (string)$data));\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce002caebedc17446ceaa1424d0f17735a281eec7d668d783d6112fd11a05cd6", "structural_hash": "1f65a8df4fd58904adadf956cb1f70be15b1a0d5af55ea417ee071b9206b6101", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32386.sh", "upstream_id": "BenchmarkTest32386", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1050421903ca3c7511e41c0c1aded2344b1200126078047f98fe688570503bb2", "structural_hash": "59c8ea76a8844a6ca487e97af20c1004f4ea31a43965b27a62de80ec7d765442", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12346.sh", "upstream_id": "BenchmarkTest12346", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _primary() {\n curl -s \"$data\"\n }\n fn=\"_primary\"\n $fn\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "135158ce938ba42d705b9fe2806623bc6771e6f219843458970b83ccd94c3d2e", "structural_hash": "69eca89162785f5d44c3d7b684c651f92ec4798762f36ada0954cc2468f6f18e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00580.php", "upstream_id": "BenchmarkTest00580", "language": "php", "code": "header('X-Custom-Header', '');\n $field = 'data';\n $$field = $userInput;\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$processed]]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44ebb8d0488660f585eef388377effe5dc84d09b76efaa2333e01b83df456bfb", "structural_hash": "ce78440c6e3b0dedde9268cf745dd0fe9e986f6d6acd79b5ed49f296c793ae8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04392.php", "upstream_id": "BenchmarkTest04392", "language": "php", "code": "query('id', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32152b1c8ba74b0130da34ca1f2c2ae938326851bb66f1f8fe6bbbd07f0f15eb", "structural_hash": "33a235716198d773202f2310e62721b0edee8fd7ebb08b5decc79fc1c8759168", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00308.rs", "upstream_id": "BenchmarkTest00308", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let (payload, _origin) = (json_value.clone(), \"http\");\n let data = payload;\n reqwest::Client::new().post(\"http://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e24c638ee306c44117f8d3eeadc06a6bc2d0ac6549aa91ecc369c090b474443", "structural_hash": "e12fa169ac1607c7e64488408ce3f5bad5eb831c5a63321db82bed461a27e964", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05684.php", "upstream_id": "BenchmarkTest05684", "language": "php", "code": "request->get('multipart_field', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n return new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9a4c8646b1caefd4d89e8d6edc4b56561f1afc886a5d28a8aa9491fd501c2cf", "structural_hash": "926113657ae3f5c1198965808fca51224285bef0d3a0607d5bcd7eaeff55a012", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03642.py", "upstream_id": "BenchmarkTest03642", "language": "python", "code": "import logging\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n if db_value:\n data = db_value\n else:\n data = ''\n logging.info('User action: ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9d4e2c5d2a9b423edf39b86da82aae0a05a971924ccd536da3b45e3d72c3e0a", "structural_hash": "497bd1fea4d27e1829c754c3a04b635d5a30e70841b8e7508f3246a68a4b5a67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00250.php", "upstream_id": "BenchmarkTest00250", "language": "php", "code": "header('Host', '');\n [$data] = [$userInput, 'http'];\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83a2e5ae3ec889e090239307f513f0007822b8d3ab1c65a3c80412f216da309e", "structural_hash": "9851c750c4cbaf02f5a8b1bce7c03ea9c83e84ae8388fdb728bdfcad89e547ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03358.php", "upstream_id": "BenchmarkTest03358", "language": "php", "code": "cookie('session_token', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n file_get_contents('https://api.corp.lan/submit?d=' . urlencode((string)$data));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd90e4f9b671184f96e34dd2e24aba9ee0105deb0eecceeceb3321ae14846a9f", "structural_hash": "77a5bbfe0fcf8a271be67b1843bca0817150ed1c5a721cc32981c06e909dc986", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_36963.js", "upstream_id": "BenchmarkTest36963", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (![\".jpg\", \".png\", \".gif\", \".pdf\"].some((e) => String(data).toLowerCase().endsWith(e))) { ctx.status = 400; ctx.body = {error: \"invalid file type\"}; return; }\n const entryFile = path.basename(data);\n fs.writeFileSync(\"/var/uploads/\" + entryFile, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f895ff31a99c9b9f664e8841b7391ee4b13f5a0444e8b6cbca00fd45b4132ad", "structural_hash": "4de52355de7e7809ca0d1886879211beb4d00dd28b75d038b796c138fdda2ae3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21494.c", "upstream_id": "BenchmarkTest21494", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n void *_h = dlopen(data, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb706df06170c68e9514100bbf2129af495552e4ea2af16c452d56f9dab50047", "structural_hash": "6edacef3053145d4e3e434fdc8fe1df0467895d08d023925e3a85ced53accef3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01030.rb", "upstream_id": "BenchmarkTest01030", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68421d05a427d8ca7205d861b2868dc33047978a9e50cf15996909fa6a3b7d32", "structural_hash": "6119853e8678b26df31b73bbfd9f85145d20ada1c03597d0f7fc541cc2131799", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02611.php", "upstream_id": "BenchmarkTest02611", "language": "php", "code": "header('Host', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return response()->json(['validated' => (string) $data], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f06de4dd06a3058c1137cfe8a68b6676759280b8b602ddf57f6faa7ff8e44f61", "structural_hash": "dd213e2f8227f8c6021ca7762441ff6b4836accda48b960b88c5f3d4fb94aed7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05247.php", "upstream_id": "BenchmarkTest05247", "language": "php", "code": "header('User-Agent', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return response()->json(['validated' => (string) $data], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bebc778bc28801bae657e26d9cc881098a2bcd1f2fe8f488ee2ded0b4f0936c0", "structural_hash": "541ae5ea1459ce29ba042c202a053f3da8a18a3ae5131d6700d60a644a747093", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_34858.js", "upstream_id": "BenchmarkTest34858", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n try { JSON.parse(data); } catch(e) { if (e instanceof SyntaxError) { ctx.status = 400; ctx.body = {error: e.message}; return; } throw e; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed6df58eef4e446a050141a088d8d68464355d30844119940770c540cb12dc97", "structural_hash": "1e3276e01b22ee66272cd32b2937c68b90959bfc98b2dc6c460e06b821bacd65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33780.js", "upstream_id": "BenchmarkTest33780", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = String(userInput).slice(0, 200);\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-565"], "category": "cookie_no_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f2264d6c31352af0adb8049973d3a97c709171a15ea70515a048be25635101a", "structural_hash": "a8070dee3a4b0d407fb036c5e9330d910cd43aeb2c648095efad3e5f811ae859", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00406.ts", "upstream_id": "BenchmarkTest00406", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n return fileContent;\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "795908a5c49508137ee589cf1f92005a8eafe2f33d8f3438313d0a9a9199c1cd", "structural_hash": "cfbda3772449af1f1aebff8d5bf42dd3769136863a68c3e3eabe1c3bbc8dd204", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04927.rs", "upstream_id": "BenchmarkTest04927", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n let data = config_value.replace(\"\\t\", \" \");\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9bb6d8508810dc805430f84c21ffaa3614e23a8666e9c06dbda618dedbe7c8dd", "structural_hash": "b6cdfec2bb94ea7b7b2127a14788da657f6152ac500e5bd06b3e0e8c51364378", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05864.go", "upstream_id": "BenchmarkTest05864", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tvar data string\n\tif pathValue != \"\" {\n\t\tdata = pathValue\n\t}\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0585f6d887c8beca5c0b1fd52d58a499da749cb6baa37c83e4b0721082c03101", "structural_hash": "b371982dbd0ffc3afe7bc291bbcf0dae673525bb5c2aed48a0f2e2308a6237ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02638.rs", "upstream_id": "BenchmarkTest02638", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: field_value.clone() };\n let data = payload.value().to_string();\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e34955e96cc8d761ca2b981eb38d83ccdccdb16f6b4a647f0cc8f1ecd327d3e1", "structural_hash": "35852c431182e71619e1d0e3781ec07fa75903791482a8d6055359fbe3a359e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04025.php", "upstream_id": "BenchmarkTest04025", "language": "php", "code": "headers->get('X-Custom-Header', '');\n [$data] = [$userInput, 'http'];\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5fc6f992fefd9865b8ddf837866a352597063febf9906155b04918ff4702fc46", "structural_hash": "e258cd5e945925cfbab0d8ebee0957ed6c3a397ec5a422c34fa7d6c00b13a1fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16967.js", "upstream_id": "BenchmarkTest16967", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = \"\" + userInput;\n const allowedFiles = new Set([\"config.json\", \"index.html\", \"readme.md\"]);\n if (!allowedFiles.has(data)) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = \"/var/app/data/\" + data;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "492550f4c6cc346942d05e900c78ab2e842b541a4454060df0686ff6c26f6ea3", "structural_hash": "1de7522bac5b64b769c9ef11877df961cc73bf824868763f6dfae894370b2f3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_34706.go", "upstream_id": "BenchmarkTest34706", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tdata := headerValue\n\tif _, after, ok := strings.Cut(headerValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+processed), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1a5ce8c8fc6f202ba6f5232d92782fbd863f38dc3b1766e70a37fb024f9b403", "structural_hash": "cb2d6fd8a4fee772671cb3cdb091d76681a0aadbeaaa640c0382a976ee8a6a50", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_14052.go", "upstream_id": "BenchmarkTest14052", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tdata := func(v string) string { return strings.TrimSpace(v) }(hostValue)\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 1, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c52995280ce5d1468df9802de8f09b016cc8214b10cedf0027c616febc73967", "structural_hash": "5cd04b25de93a26043528c1b4a2b3431c2a35904edf9216a251786440ed567a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20924.js", "upstream_id": "BenchmarkTest20924", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "481e8dd33b5936d17c2807af83a8d8f75f203798416724df2f1efecced7447dc", "structural_hash": "07128b885ad74a01fd141cb1b5081dc8dfddfc3b1249bfae69b944d0e120e24c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20118.js", "upstream_id": "BenchmarkTest20118", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n res.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dda8a5f06a182fc265c402d8bd12091786771b42f8f1e06a410a5af84f221a9d", "structural_hash": "0abc348942e05e111d0b9ffee327e95fba7caf4f722ef046a2128504ecbf7946", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11996.js", "upstream_id": "BenchmarkTest11996", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.send(\"
\" + processed + \"
\");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "978e7a021afddf71648610745b9cb944e4a9dd740302257af2182c4104971e69", "structural_hash": "26088f0e320664579759e772bd5aa10026ec6c8b2df861fbad7de1328bc89b17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28893.go", "upstream_id": "BenchmarkTest28893", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"html\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- jsonValue\n\tclose(_jobs)\n\tdata := <-_out\n\tprocessed := html.EscapeString(data)\n\thtmlOut := \"
\" + processed + \"
\"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "786f64c29983949dbd3a433bbf892fb657bfde60d615ea969097bf9024989dc9", "structural_hash": "b6aeceed35cd753a8bdfffffcf7d6d32d200d219717f9b8f860712ffd62cd0fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38485.js", "upstream_id": "BenchmarkTest38485", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n res.set(\"Content-Type\", \"text/html\");\n res.send(\"
  • \" + String(data) + \"
  • \"); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "617d9914d55dab8b3ade2c24d10be7ce616838ede14c09c1e760a9b68cd03a5b", "structural_hash": "d8e6b6c700117b05cb33e9d33709587cf86c4f332706da973b62dfe352192505", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22327.sh", "upstream_id": "BenchmarkTest22327", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n ls -la -- \"$data\" 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4e0750ac0dd1e85cd5ebb37ebe0de3896906ecdb0e53a9a02d7c20f61eb59b0", "structural_hash": "f8d448da9f78b723dc904db84355220c16207ec3dad3c3dd0d7a79e2001b5ea3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00868.rs", "upstream_id": "BenchmarkTest00868", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: header_value.clone() }.payload;\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1236086aea8985a419259bd732890411acb28784b80e33845ce278f720f72d0", "structural_hash": "acd58905948a01ba41b42c1ccf077d9f3fe9c48b8748be3c90a53db8faf153d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16949.sh", "upstream_id": "BenchmarkTest16949", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n chown \"$data\" /var/app/data/managed.txt || { echo \"chown failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e1ba869ef4a92290bb25bbef9a032e35ad0587c4c51a5a1f484356280380d5f", "structural_hash": "8722a744bdcf4684e0159b4cbf3039138789b936464c777494526e8d6c4b5c08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01599.java", "upstream_id": "BenchmarkTest01599", "language": "java", "code": "import io.jsonwebtoken.Jwts;\nimport io.jsonwebtoken.SignatureAlgorithm;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String secretValue = \"default_config_label\";\n java.util.List tokens = java.util.Arrays.asList(secretValue.split(\",\"));\n String data = String.join(\",\", tokens);\n if (data.isEmpty()) { response.sendError(400, \"request required\"); return; }\n java.util.Properties props = new java.util.Properties();\n try (java.io.InputStream propsStream = new java.io.FileInputStream(\"/etc/app/credentials.properties\")) {\n props.load(propsStream);\n }\n String storeCred = props.getProperty(\"api.key\", \"\");\n String secret = storeCred;\n Jwts.builder().setSubject(\"user\").signWith(SignatureAlgorithm.HS256, secret).compact();\n response.getWriter().print(\"{\\\"signed\\\":\\\"ok\\\"}\");\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b8e8504dfd4b36f70c6c647366156230dfb4726a353c0f63a6a0db327faa50c", "structural_hash": "84d9a3c60cd533d2c80cb4175c4337446957554d2fc13340f863531822b3cef5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03157.ts", "upstream_id": "BenchmarkTest03157", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = \"config_secret_test_abc123\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb2e1e77adb21c15a3c271f79683b8a36eb2c07b739a761a95e11e25ffcb5662", "structural_hash": "e88927a61b899511a3faeb87162c4561311d22d4d4ba516238aee92dc3919260", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24515.js", "upstream_id": "BenchmarkTest24515", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = JSON.parse(process.env.LAMBDA_EVENT || \"{}\").body || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n require(\"./shared\").iam.putRolePolicy(\"app-service-role\", \"inline\", String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e5381288b4bf9424ba96da5c18ee948baed48c67cbb34de1368da8d513babe5", "structural_hash": "93fc6258d34cb962a01ca6026cd6c48186e98d3e0fc50659e5cc81051c932beb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04076.py", "upstream_id": "BenchmarkTest04076", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import mongo_db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = ' '.join(str(raw_body).split(' '))\n mongo_db.users.find({'$where': \"this.username == '\" + str(data) + \"'\"})\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0601b7badf5374e10fadc85403098382ef79c587d9fc37bd2260c2794af490f6", "structural_hash": "66add95a96d0851dd22876c68791ac52cc46d599091b81ffdd7dd444cd9e5ab5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02037.rb", "upstream_id": "BenchmarkTest02037", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n Net::HTTP.get(URI(data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a98cef8e425a83f74a1b7b8b76b3c255f8fb3566f4b9c0759f278d87e130f472", "structural_hash": "4dd1b6c70d79e8c682c59ab2f2929f9275be0cd96fddb36b224f6002a161da0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05523.rs", "upstream_id": "BenchmarkTest05523", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", multipart_value).ok();\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61a71262e74fdaa9e33eb7f2086d277b1bcb6cf27dce604538eb1b1dbd5c87e5", "structural_hash": "e990d66f343c9fdbea759afc503a47260337be42f466bdad22f77208c9d14f85", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08390.go", "upstream_id": "BenchmarkTest08390", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tform := FormData{Payload: xmlBody}\n\tdata := form.Payload\n\tsharedCounterMu.Lock()\n\tsharedCounter = data\n\tsharedCounterMu.Unlock()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a2c060624b27cb37b677e45dad79810ff004f69e1508ff0387206443b84ce4e", "structural_hash": "c93dcc19d426f9f55360d26c6088aa1a10eb7cb5378fe24c60f766cdf3356b90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04470.ts", "upstream_id": "BenchmarkTest04470", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59722be478bcd28c2564658444327b2d5f7021129b4a94e8e93bfad9b5cd4325", "structural_hash": "21415803da427375c9adc9c9a15e0102287c2d34913b87feb47d54dea98f7bb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01797.c", "upstream_id": "BenchmarkTest01797", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f61aa00f2861a1f3f34d7b671ddb11b50cd2b651616b6bd3b14c50a8fb035dc4", "structural_hash": "49dff44d4d7a95883989762335dbfa9e8085dc17f8c62ae85947f11e5d59f2f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04697.java", "upstream_id": "BenchmarkTest04697", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.parsers.*;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = \"item_%s\".formatted(multipartValue);\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n dbf.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n dbf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);\n dbf.setExpandEntityReferences(false);\n dbf.newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f99e154ccaf796151aeba72f908f51ec231f7b56658ac1fee2229d6c6cf57773", "structural_hash": "5ee194d26ee3b80601819dfc241e6553c2c1707cc8e3bb018e679f63d7df6251", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_11517.go", "upstream_id": "BenchmarkTest11517", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tform := FormData{Payload: hostValue}\n\tdata := form.Payload\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e1526752e87a9f8c134b3eb8b68f98dd006d2dcd97889e2fb78ffed1fab84f0", "structural_hash": "fed887aaa2b39bb2915aec108201d65ba1bf62e47ab67f378ad853e7e4a2ef4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27290.go", "upstream_id": "BenchmarkTest27290", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tlastRequestValue.Store(commentText)\n\tdata, _ := lastRequestValue.Load().(string)\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58941e031c4e17ace18b4c7b85cf20b1177053c68e1f91d11d06e6328ead0ca6", "structural_hash": "77023a8f9eb0b7f4111553d9b1ffa848e62cf64d730ce54a76f55b796fa4866b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02504.rb", "upstream_id": "BenchmarkTest02504", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n content_type :html\n \"\" + data.to_s + \"\"\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8a874d26d764b9e02f8612781c5b74d4731ea7fac927329fcee941c40cc4e38", "structural_hash": "dea45df90d84c10c702dc115ca96d0771b7185586e3a7ed18e1a67b3d8557057", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00695.ts", "upstream_id": "BenchmarkTest00695", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e0d89d2bb25f47d2d1a24cc7f73f49575f46e3a8f65de43572b2a2773e944ac", "structural_hash": "0af59603c97a0f26a9c52cce8404417cdbcc9b31f4bce2343c0d1893a75e7f3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_26938.js", "upstream_id": "BenchmarkTest26938", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n const _digest = crypto.createHash(\"sha256\").update(_content).digest(\"hex\");\n const _trusted = \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\";\n if (_digest === _trusted) { fs.writeFileSync(\"/var/app/active/pkg.bin\", _content); }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2799166a061ce2897a2340ad91de4db1c88968b34ee8dbc4dc0b13ef09603655", "structural_hash": "480e968525173e8ed0e6efab50fe650726e4c4e6030831b8f8adadba85d1510e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02431.php", "upstream_id": "BenchmarkTest02431", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d04fd66cc9d3d3a24db4755e8dfaec2897244cc6187207e61a3e2b45af3de15", "structural_hash": "9e9845ae735843c4c1eb65ed7f3993e600bad26054f33ce932d924e5f1166143", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00778.cpp", "upstream_id": "BenchmarkTest00778", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n const char *_sess = std::getenv(\"SESSION_SECRET\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48e8490ae53e5126129d2fad23570723a4b4857a9f415e5914d5fe09330005ad", "structural_hash": "e7721a1dfd59c2beb943ee892b8217e7636f489b2e042ef282f0e45ce29849a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04614.py", "upstream_id": "BenchmarkTest04614", "language": "python", "code": "import os\nimport re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = '{}'.format(referer_value)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n os.system('echo ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91c1f65c9b1c5ed1d6794c43bc1520a81f14d4e4fd8609b819cee90564bd2ca9", "structural_hash": "a4c332b21a839ee82242b68447e0c634bb322b03db1205394080e7ace0587af6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04040.py", "upstream_id": "BenchmarkTest04040", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = handle(graphql_var)\n with open('output.csv', 'a') as fh:\n fh.write(str(data) + ',data\\n')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16a274b052264d09ff2ba4b771f4c7e8f33de971f6710f6d0064afe748dafdb9", "structural_hash": "43f2fb037ca938898de587530b8280c07d7532b6ffcd51f76310d90fe63cc8cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04244.rs", "upstream_id": "BenchmarkTest04244", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse rand::Rng;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(cookie_value.clone());\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa5214c749c0ba066cd0aa2634a7de5fb98e070c6a3b9388aec31179af792e8e", "structural_hash": "367bf3ac713a3f914c43f55adb8a0b86c3a8d41ee15dda1c5d810fdda00f7328", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03565.py", "upstream_id": "BenchmarkTest03565", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n data = '%s' % str(auth_header)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c925935eed5c163b0c30e38206d24ffe9399f47d241f2b589df516be9402a52", "structural_hash": "ac326764438ef467ca7ad12489de4d73e83d73730cc0ddc95d058810d7a80d73", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03627.java", "upstream_id": "BenchmarkTest03627", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n private static final java.util.concurrent.Semaphore RATE_LIMITER = new java.util.concurrent.Semaphore(10);\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(jsonValue);\n if (!RATE_LIMITER.tryAcquire(1, java.util.concurrent.TimeUnit.SECONDS)) {\n response.sendError(429, \"rate limited\");\n return;\n }\n try {\n byte[] buf = new byte[Math.min(Integer.parseInt(data), 1048576)];\n response.setHeader(\"X-Alloc-Bytes\", String.valueOf(buf.length));\n } finally { RATE_LIMITER.release(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23e61f797bdcd34bda03ee1b9c91e29fd1b0cbcf07ff9752bcf737cc301b08cd", "structural_hash": "5aca2a7fe4b8244149ded42de5e2addcab63d6d09049768841343c294df03f9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22987.js", "upstream_id": "BenchmarkTest22987", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab8dd7bf1efdfcfacb88a578a6de04e5a8d8b8df75667b31ece806108ac0dbb3", "structural_hash": "9c23619bc4c5d968adb791de9afc75e2444d17c6dc594f50dd80825113ea697e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05117.java", "upstream_id": "BenchmarkTest05117", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(multipartValue);\n long seed = ((long) data.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7010d5f85e78f9497408a42b40655c4f22932b3c5b4ed74620aa2b933d5f021", "structural_hash": "bbf315ca7b69deeecf7223764a9cd5cf88f718cc4385a056d4f4e81bf55bdb23", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09133.c", "upstream_id": "BenchmarkTest09133", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n }\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "621389714a900f5a94c277e21c7693268625af1832b3f0041dbaa56bc47845b0", "structural_hash": "237eaec229171309dc1bbf9be95e75de51473ac1478008e1306adb4bc80da1ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00816.cpp", "upstream_id": "BenchmarkTest00816", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8497c3b9c7548289148531e3206bf7c2fbb7d3c14180cf790e6c50b2abf47a42", "structural_hash": "a6cf0bf2239d7d7c4ee664cae73f863540f41e0a4dc5ce336ee56f8f8a291100", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02042.ts", "upstream_id": "BenchmarkTest02042", "language": "typescript", "code": "import { Controller, Param, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = pathId;\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n res.set(\"X-Custom\", processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ea1a3e5ad5370a181a4580c771a60eba8ae673e0ac8a416b0c596d4ff368528", "structural_hash": "872f2000a610c8111d7ea785604ced29b94ee16c953a607be9f48a4d0684fd84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01760.ts", "upstream_id": "BenchmarkTest01760", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = Buffer.from(userInput, \"utf-8\").toString();\n shared.authCheck(String(data), \"admin\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f63dba5220093937e63e26c36c70dd6698f92c59f19c70814b47c7128782e1ae", "structural_hash": "763b4627c8f2c55fcf62e962e9ee34564cf09d62744e96f14d1e9ed246823b03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14549.js", "upstream_id": "BenchmarkTest14549", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n let _result = 'none';\n switch (data) { case \"a\": _result = 'alpha'; case \"b\": _result = 'beta'; break; default: _result = 'other'; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d4e6d5701117f5b154b023c40b37bf674e94cf36fbcdc95018fc695f2443729", "structural_hash": "4a097bfcbf6e629faefe84205273d48a9c6349aec4262eea91bb0995791072ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17664.go", "upstream_id": "BenchmarkTest17664", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tvar data string\n\tif headerValue != \"\" {\n\t\tdata = headerValue\n\t}\n\tdivisor, _ := strconv.Atoi(data)\n\tRespondJSON(w, http.StatusOK, map[string]int{\"quotient\": 100 / divisor})\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c0491c37346539c663bbbbf0a68e86b228a0da35f4d969efcb22e88dfe8b5a3", "structural_hash": "8b7921ae838cfbcf17fabf7349e288cd6201f004197149fab5208ee0e185c542", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05091.java", "upstream_id": "BenchmarkTest05091", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.xpath.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + userId;\n String data = valueSupplier.get();\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n XPathFactory xpf = XPathFactory.newInstance();\n XPath xpath = xpf.newXPath();\n xpath.evaluate(\"/users/user[@name='\" + data + \"']\", new org.xml.sax.InputSource(new java.io.StringReader(\"\")));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cfd0f5ec7400492f1568786dadedbf8c5bac1cf33a5b24b4f8c9ea69b8332b7", "structural_hash": "0fb7c94a3296533a56136a81e8fd1d731f4cb3a752704ee0499f26cc2e64f45b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_05917.js", "upstream_id": "BenchmarkTest05917", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "610592f374fef3988d8d8b4e130c26520108f5beb7007354a933bf34e26823ae", "structural_hash": "6f09e278a90d7304b83e528fb978930669a9b1f31b57933dcbca0becfa7e871d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00060.cpp", "upstream_id": "BenchmarkTest00060", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) return;\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "568ee01f43ac1c72bfb5573a284b4e15a7a7100bf44e8fd43799740531af48d1", "structural_hash": "a2da25a01a9a2e0dd3004445c2ca69f740a9ac14d9f1895ff562961201e526c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03876.py", "upstream_id": "BenchmarkTest03876", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n data = bytes.fromhex(auth_header).decode('utf-8', 'ignore')\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1dbb5f90e87f7da0c49e3bc82d8deda50ad9971d6711ddbde9ccfcf333b4caa", "structural_hash": "5115ca541da1fe933986b3445285474834e66ed5cd90a88aa7de0926f2a6a2fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04241.ts", "upstream_id": "BenchmarkTest04241", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(data)));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbc38d4200475811e76167f6f8d19aca7531939b3d1e8ef815950dff4eaff1f7", "structural_hash": "4c67974e9cd06c73d6275aa8d983f0dbd7a063c69ce89af2f9fcdf69bd9fadad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00140.java", "upstream_id": "BenchmarkTest00140", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n String data = String.format(\"%s\", pathValue);\n try (PreparedStatement ps = connection.prepareStatement(\"SELECT * FROM users WHERE id = ?\")) {\n ps.setString(1, data);\n try (ResultSet rs = ps.executeQuery()) { }\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "893d7675832a30dd0c05c329356405c6148085bb773fb44bd4c66f5cc5e1b2aa", "structural_hash": "e840b58e926076e5f9cc26da0c9971d6c625ca9a5995a89d34adb325a140f84a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01819.py", "upstream_id": "BenchmarkTest01819", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n data = ' '.join(str(graphql_var).split(' '))\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return jsonify({'error': 'invalid integer'}), 400\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return jsonify({'allocated': allocated}), 200", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ceaae99e330dd950769fdaa135f84973fa4645973a91ec9ffe0f5c96169e37f0", "structural_hash": "9efe37b49b21ea47ab62a33b72bcda111ed134f3eaf5b3bcbdfeaed0a757665f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06428.js", "upstream_id": "BenchmarkTest06428", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "209d2a6e5ae642ce4ed71cb809fb8adc725e0743e1627d527b03a280902dac5c", "structural_hash": "d2ae397a5b6056330b006f71e8687bf78b742e722d9de875ab43d0dca62e5a1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02067.php", "upstream_id": "BenchmarkTest02067", "language": "php", "code": "cookie('session_token', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b3ff6f1dacecaa8c2462847195aeb85da97cfe78fe1e2f52a53c7d0c7bda946", "structural_hash": "8afa70e78c2ea4626e17bf7e859196d10495a6c7743b6d0fc3316bb9c769129e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_14114.go", "upstream_id": "BenchmarkTest14114", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(multipartValue)\n\t}()\n\tdata := <-resultCh\n\tparsedURL, _ := url.Parse(data)\n\t_host := parsedURL.Hostname()\n\tif !strings.HasSuffix(_host, \".svc.cluster\") && !strings.HasSuffix(_host, \".gocdn.net\") {\n\t\thttp.Error(w, \"forbidden host\", http.StatusForbidden)\n\t\treturn\n\t}\n\ttargetUrl := data\n\tw.Header().Set(\"Access-Control-Allow-Origin\", targetUrl)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "696ce2e0cf8f0ab769675bc390aa19d8e6ae021400bc40a42ab665b6c5acfc11", "structural_hash": "1588ed33ddbf0bf43e52f834e781caa0df6699f8fa95fef872374325256577f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26302.sh", "upstream_id": "BenchmarkTest26302", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n rm -f \"/var/app/data/$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de652d419b567b40db8cbcff38d04b4477dfe4bea0f1f2c6a5bd4b1caf647b24", "structural_hash": "23026bdaefabf1aaa88ea92876e1148d124b4370e0c63147050df68d858d9996", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12921.c", "upstream_id": "BenchmarkTest12921", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char *const _argv[] = { \"/usr/bin/tar\", \"-cf\", \"/tmp/backup.tar\", (char *)data, NULL };\n execv(\"/usr/bin/tar\", _argv);\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "831b50ee5329e91383d0e3e420839518bc368322978388ce4d09b78239ffb33d", "structural_hash": "c8d913c6087afc46ff3babd5dc7b3e4d51181c92809c2294fab77f4919afaa96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01644.php", "upstream_id": "BenchmarkTest01644", "language": "php", "code": "query('id', '');\n $data = (!empty($userInput)) ? $userInput : '';\n $digest = md5((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0c4f9c3dc7625ec796154756e3e5401271b7dd7c41749f42d2dbc497946ff08", "structural_hash": "e8cf3a378a03d3914a953d476c7ad481f160f52ff59c0043d99c99ad6f5798c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02635.cpp", "upstream_id": "BenchmarkTest02635", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6480cc89e56588b67087436a987bcb08cef2b5930b9879c7296042c75e32cca", "structural_hash": "553c7d37d99e5e233b1662a9f571add7c9e15adc09770ced54443ca2df37b522", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08163.c", "upstream_id": "BenchmarkTest08163", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc85c7c15145b586b35ba7c155a9fbd787909eca29f04cbef3683bcec9ec0624", "structural_hash": "f3ad07f8233ca01f618c5c49d3a114759970e87b4fa495e1880dd97b3746358c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02573.cpp", "upstream_id": "BenchmarkTest02573", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n unsigned char _rnd[16];\n int _fd = open(\"/dev/urandom\", O_RDONLY);\n if (_fd >= 0) { if (read(_fd, _rnd, sizeof(_rnd)) < 0) _rnd[0] = 0; close(_fd); }\n std::cout << \"token for \" << data << \": \" << (int)_rnd[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4fbf5cd5fa84e0a71709d73ba011844ce1d27af857786ce04d0ba6fe7585fc9", "structural_hash": "36cba03d43a987d48ed4fe9f7e77485b3823884cbc9b7019370e2e4ccefb5fd6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03261.java", "upstream_id": "BenchmarkTest03261", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/json\")\n public void benchmark_case(@RequestBody GraphQLRequest req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n java.util.Map.Entry tuple = java.util.Map.entry(graphqlVar, \"cookie\");\n response.setHeader(\"X-Tuple-Context\", tuple.getValue());\n String data = tuple.getKey();\n LOG.info(\"Action: {}\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b2a70dab3215564f6b353881ee815834ff1e5c2013f623da70b17581a3817b5", "structural_hash": "d8166f94c0a19b9068027de935022d264672c9864f62b9dfb99f76d56b2b428c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04764.rs", "upstream_id": "BenchmarkTest04764", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(db_value.clone(), |s| s.trim().to_string());\n if std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) > 0 {\n reqwest::get(&data).await.ok();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d54f0c48007c1c5e4238447c4ecf10aa29b05f361486be4edf6d70ad930fb32", "structural_hash": "204ae470c79ccde45f8458ca2335067e5c391bcae069270ace2c6fcc2b60fee5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02744.java", "upstream_id": "BenchmarkTest02744", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> authHeader)\n .thenApply(v -> java.text.Normalizer.normalize(v, java.text.Normalizer.Form.NFC).strip())\n .join();\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n response.sendError(400, \"forbidden\"); return;\n }\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "079cff668be8ea79c990cbd08309af203573eeba7b2f9d1a5d8f1e1c33563f67", "structural_hash": "1982a4f256a62805b4d34c4f76446b1b50d3c4d526b5571255d5431d3afdd126", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03400.c", "upstream_id": "BenchmarkTest03400", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char *const _argv[] = { \"/usr/bin/grep\", (char *)data, NULL };\n execv(\"/usr/bin/grep\", _argv);\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4ab190d2b0c328b1403015b5e25664d767c55d288f54595dae804ca2ce2cb8e", "structural_hash": "163d99925d06b710e0db553f066f0e3e43b9dd167bac3bfa80f72346211216cf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04760.c", "upstream_id": "BenchmarkTest04760", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec95a00e75c0b5668f18ece95867ed65e5c1c16117ae786c647fa618fdb43640", "structural_hash": "d564e167d536710e3efd2ae5e01bb4d0b0377e22d114a482e686908bd769bcc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08717.c", "upstream_id": "BenchmarkTest08717", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2b92fc21e88ced636debf986edf4e3207a9c980ae0e3f7bca3a35657df35942", "structural_hash": "3c26bf98f7331fe9876cfa1ee8128a69c8c91003dde74bf9286decc8cd301511", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00930.php", "upstream_id": "BenchmarkTest00930", "language": "php", "code": " 'p4ssw0rd_test_xyz']['secret'];\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt('data', 'aes-256-gcm', (string)$data, 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "869f9191e9636c14ff54b29f6ad57cdc3bd406ca683ecebfc053b58db2fe6191", "structural_hash": "06ddd85bb9df0a80a6ac3a9aca759b729aeed878e28a93b9a486c572750b30b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00722.cpp", "upstream_id": "BenchmarkTest00722", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _fname = std::filesystem::path(data).filename().string();\n if (_fname.size() < 4 || (_fname.substr(_fname.size() - 4) != \".png\" && _fname.substr(_fname.size() - 4) != \".jpg\")) return;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3c7f0ede2f5f70b8e3d21cc3a8af7cdd2f25f5132308772f998ff9963c613b7", "structural_hash": "106ce46bd04e1747a900e98c735eae37f70a777ad67a4141f6275f684bdecc71", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11668.c", "upstream_id": "BenchmarkTest11668", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n int _req = atoi(data);\n int _result = _req - 1;\n printf(\"result:%d\\n\", _result);\n}", "label": 1, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "848151565a19f752beb7dbddfa97faab98b353c009eed552cfb19727b51deb56", "structural_hash": "e977d172aa299f2d1c7c7e4b68064a43b281e48b107e18d0e3619aa1796f91c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03401.php", "upstream_id": "BenchmarkTest03401", "language": "php", "code": "json('variables.input', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n return response('
    ' . $data . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b64e505d42259afe3d4257e2e25a326282a3aa540214e06025c8d260fdb933f", "structural_hash": "70ecafb8472bfe8fb4185888a14a627b406cfe60a9d1a0a1d507e96b30a60201", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16525.go", "upstream_id": "BenchmarkTest16525", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvar data string\n\tif len(commentText) > 0 {\n\t\tdata = commentText\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"audit actor=%s action=revoke_sessions\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c0a9663ac7c262758a718985f269b765ffc3360008140ecaac533b71fb32e21", "structural_hash": "91a2f732a9ab756de43c7c232302fa5f41d1019c819356db4bf853fec6763569", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05516.py", "upstream_id": "BenchmarkTest05516", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'default_setting_value'\n def normalize(value):\n return value.strip()\n data = normalize(secret_value)\n store_cred = os.environ.get('APP_SECRET', '')\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d13c2336ba219766ef0e3c00934546c17dc5bc8181a0d0a179f4fa1d7c78eae0", "structural_hash": "6a903eb3046d14d063e4e19cad7c7b1387832edfc9a15a742df035468cda3f03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25006.js", "upstream_id": "BenchmarkTest25006", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const fields = [userInput, 'http'];\n const [data] = fields;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b26fdcf500bd45e2c75c937f94162b6f7094c017f469213f8385580755ede3e", "structural_hash": "949bd2e0529ca558a0e9d0ddaa0d1ef424027c4f513e4649626cd31e275f64e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02193.sh", "upstream_id": "BenchmarkTest02193", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "185d5bcd31f8d942b6cc195ed7f4af9ec3893e2195fc1a8ad9769869746ca48d", "structural_hash": "ee4f3438036cb8c003728020c17234437be5e79574154b23746d221ceeb179bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03214.cpp", "upstream_id": "BenchmarkTest03214", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _fname = std::filesystem::path(data).filename().string();\n if (_fname.size() < 4 || (_fname.substr(_fname.size() - 4) != \".png\" && _fname.substr(_fname.size() - 4) != \".jpg\")) return;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b04d17ed2716081172fb5aca0f8775fb06cee2529a919d8a379447cdc5bef31c", "structural_hash": "46a8540e4876c223b32b7cbe61796a56ae48553f7d47baf2b209804643e74507", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14457.c", "upstream_id": "BenchmarkTest14457", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_passthrough(user_input);\n int _vals[8];\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 1, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b62170ed1beab22fda62452be06dad7edd5ee5efc8052cbe7cab72652bf868c", "structural_hash": "89c702a0a2408c42aceeeafb4f0e8627b2e673f395e54e17826c2ec84cb00e88", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_11830.go", "upstream_id": "BenchmarkTest11830", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/crypto/bcrypt\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(rawBody)\n\thashedPw, _ := bcrypt.GenerateFromPassword([]byte(data), bcrypt.DefaultCost)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": string(hashedPw)})\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "672518a611377eb997942b9a7848d38ff5f4ddf50b8b2dc192bbe2cbbe0f90c4", "structural_hash": "666998b5ff0509e0a4175a33b4490620514f5d0471fe080ba0097f353d8bf9fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01017.cpp", "upstream_id": "BenchmarkTest01017", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n std::string _cmd = std::string(\"ls \") + safe;\n std::system(_cmd.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d02b482bb0a64ac2c481599e0c168f029b11ae1e896e6c2a7f0a0a7d2837b7da", "structural_hash": "159160ef0631437b2f6931b7eebd9e9ef2d3533df6e4aefa29eb968dfd1d6de5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02504.rs", "upstream_id": "BenchmarkTest02504", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n let data: String = multipart_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| multipart_value.clone());\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32531bfd5f6c0927c0a6533ac0f2189f859f068ec94de205d948f3af0a04aad4", "structural_hash": "d8884283ca3f672b462deb38fa025426c4e23d4bfc65c1eb2798e0a729443a74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26616.sh", "upstream_id": "BenchmarkTest26616", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n echo \"data\" > \"/tmp/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be1ff61ca7c6be7c7f5ae4e4651f67debcb77372bad0320d282f0e8883ba9391", "structural_hash": "3af2b1869ffe46be5a86683fa5e61aedfbf7e9e9fab5f4cd07e789d9aae80033", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06664.c", "upstream_id": "BenchmarkTest06664", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0600);\n}", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73a0b26408a5701c2a9c75e69c7bae580bb6aec2b7bd7f5ed9157f60331efa26", "structural_hash": "3581249a918966ec4b1297f2d1fcd70d3340ec98bc5e7c4c6a9c65082580771f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05731.java", "upstream_id": "BenchmarkTest05731", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n private static String stripWhitespace(String v) { return v.strip(); }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = stripWhitespace(jsonValue);\n jakarta.servlet.http.HttpSession fixedSession = request.getSession();\n fixedSession.setAttribute(\"authenticatedUser\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94b74ce3d5e00db2d2e753aa15c4b80535d76d37c62c4af3ba2d2d3eae7b1fec", "structural_hash": "b3a46c1bb727688391ff0372bd68c65aa0fcdfde716320764a03c975cb2bc324", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01542.cpp", "upstream_id": "BenchmarkTest01542", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Host\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f71680fe3fecf00fe99277d4339c96afcf276638bc2f55626633d19ee691d6c9", "structural_hash": "68c85e9c135d12cb200423b06792198a98c1be50901668a7305b0dfcc307c243", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01150.java", "upstream_id": "BenchmarkTest01150", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(authHeader)); }\n catch (NumberFormatException e) { data = authHeader; }\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "946b6387d7a34f7310ced8f7ddcdd4fc68c64d0d9360804bc170bc7c5d7f08b6", "structural_hash": "19d3f072cc7c5333b3ef2d8a8e8db82669f8075a8b456b372f759bb2878a3126", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13097.go", "upstream_id": "BenchmarkTest13097", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tlastRequestValue.Store(uaValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tdefer close(done)\n\t\tcmd := exec.Command(data, \"--status\")\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Write(output)\n\t}()\n\t<-done\n}", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbce7abe2e8884bcf3068eca00a8a145d0df6e83df88a5f77439391b901bfd12", "structural_hash": "757d1d8d5bb535cfcc012aa09c166b0662a7d9f4e7b87f15a80b9ef2111bae5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00083.cpp", "upstream_id": "BenchmarkTest00083", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n unsigned char _digest[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9dd43ef151cd5aef8ae19fd7d80e30098f93c8b78da6dae2f1bd4696603a3962", "structural_hash": "4783e4f8515ddbc7faf57468d33724edda15cfa587dd88636d865e9124589401", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09864.sh", "upstream_id": "BenchmarkTest09864", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$user_input\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6cc77215935e3ea499cdc0642d58785d3a16225a008670ed1aafea7a8d7ca9cf", "structural_hash": "fdca54aa0a77e266f334a4b9e5f02c1b08394aba95e5fb7893efebc93e86b497", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04138.java", "upstream_id": "BenchmarkTest04138", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{originValue});\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b2cbd0748be564bb8340dcaf24b99a3f8e0f7d22f04d980d59f615c0ba4b0ac", "structural_hash": "0cc3931b737fa482ecc9ac86a40e4a5470bc231f99157ba1dd8c48af3991bf83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_11220.go", "upstream_id": "BenchmarkTest11220", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/md5\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tcapture := func() string { return fieldValue }\n\tdata := capture()\n\thash := md5.Sum([]byte(data))\n\thashStr := fmt.Sprintf(\"%x\", hash)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3d6d664e134049596fc65d97a6707fa01a0c80b5d3525d29d8317bcfde6227f", "structural_hash": "e2d07c653de460fa958a10777cb7f289779383e798ff9650168886813491e8ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09016.js", "upstream_id": "BenchmarkTest09016", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e5397c47f9828d015c2fa1d7fc76792b89d57a9b2edf9fd9d5cce0a4c25c67d", "structural_hash": "071ed21b39330dd2da0a9011fbcfa5f3914162ea3c186fe248fd8e1a5c1b58b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02116.rb", "upstream_id": "BenchmarkTest02116", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59b94a4d612780e545a8295675c764efadde4c47adb701bc382f20ff7656d5db", "structural_hash": "e984c632f706aeb8833d57eccaab7e9fa10f7261444996c313212658e1908973", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02403.go", "upstream_id": "BenchmarkTest02403", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tdata := hostValue\n\tif _, after, ok := strings.Cut(hostValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tblock, _ := aes.NewCipher([]byte(data))\n\tblock.Encrypt(make([]byte, aes.BlockSize), make([]byte, aes.BlockSize))\n\tc.JSON(http.StatusOK, map[string]string{\"encrypted\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea9a77726fde250167c984f8a50c3170cb5a84042b6176e7cf5f565333f4fc00", "structural_hash": "bd5979b0b59e2aba90efd3e108166c0ab609c8281b509bc88869a9bc117a4c6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01488.rb", "upstream_id": "BenchmarkTest01488", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = [\"s3cr3t_key_test_xyz\"][0]\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n processed = data.length > 64 ? data[0, 64] : data\n cred = processed.to_s\n authenticated = !cred.empty?\n unless authenticated\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6514a78847fb0e23ac6dd1c9447e49a37dc0e5f9d9cc221f13d2eefed5213a1", "structural_hash": "e9fa84bce61f14b1dc24646e9f9e92d57126eb08e674eccd61b73083683199c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02131.py", "upstream_id": "BenchmarkTest02131", "language": "python", "code": "from django.http import JsonResponse\nimport re\nfrom app_runtime import db\ndef coalesce_blank(value):\n return value or ''\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n data = coalesce_blank(origin_value)\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n record = db.fetch_one('SELECT * FROM documents WHERE id = ?', (str(processed),))\n return JsonResponse({'record': str(record)}, status=200)", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "720e19ef8f4b4c137e96f7fdf9343380550fae77c0e4c1f442d13dc0e2ad0255", "structural_hash": "93810fa311d7e0197dd4fbaa354ac858259c2c368bf7f0b17b3fefc0ecc1c4f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04682.rs", "upstream_id": "BenchmarkTest04682", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = crate::shared::passthrough(db_value.clone());\n let _ = data.parse::();\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "882de7b091b5217c5ab6a12444f384d080000268f8fbe1bfad4d8c535e7b9130", "structural_hash": "b83125d560c83fd66ce7bc5bb06ea03e8471b06f3c775125fd23ae749f4a54ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03473.rb", "upstream_id": "BenchmarkTest03473", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f12da235bd31511d506b3b25b725de50bfadd84c66823a3e878ed9c420a0170", "structural_hash": "c4333e47ab3c440edbc5b9ef1acd40557df986c82b13bec2d450c1e182eac4c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27554.sh", "upstream_id": "BenchmarkTest27554", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/app.properties)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c303c9b3642d746cd861d702e0af2d4c7c7c810dbc1ba2a505b5617c47bf8a2", "structural_hash": "8c6ae29aa327b4b2beade82fe2138e6da98ffccba90306f7880b6ea69079c9d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_38810.js", "upstream_id": "BenchmarkTest38810", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n ctx.session.expiresAt = Date.now() + 900000;\n ctx.session.data = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6061cc14b96d1cd59abc851adaa187a987cac5df9b1b263fdaf559c5f9b2020", "structural_hash": "c65bc0da7a3126cf6a95c113e69fb5624002c70891603626c7a5a7633d660ce0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02080.rb", "upstream_id": "BenchmarkTest02080", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = sprintf(\"%s\", user_input)\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef3eb8149bcf9665d0d87e88dd0176a13a409f5df850a97142535e80543b719a", "structural_hash": "66f075860355f8a5f5bab53700329fb210a2bd9918717387e376197a36e11845", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_25541.go", "upstream_id": "BenchmarkTest25541", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(hostValue)\n\t}()\n\tdata := <-resultCh\n\tif os.Getenv(\"APP_ENV\") != \"test\" {\n\t\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+data)\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Write(output)\n\t}\n}", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6304abf6058cb53aaa950f96f12754b8c12014e3c41509edf126a34941743f75", "structural_hash": "8d97125f1b170ccf2ef7063e7d31700586c46a1011d11ed14e83fc029a69c977", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16069.go", "upstream_id": "BenchmarkTest16069", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvar data string\n\tif xmlBody != \"\" {\n\t\tdata = xmlBody\n\t}\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tif cleanPath != baseDir && !strings.HasPrefix(cleanPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := cleanPath\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dffa4a4b2f9c1e57e3ec9bf5dd7e928728c9d1390d11951efe7d802a967dc6f", "structural_hash": "35f9c9469f06db54d7d2d60dffe60ac604a135ca1b7ee43e05ec450ff0cfb475", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04936.ts", "upstream_id": "BenchmarkTest04936", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const data = userInput != null ? userInput : '';\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c077fd912d95006769e03bdb63ce19210cb131b171e92d758a39e572d587e78", "structural_hash": "4671cc9558efddfaf6c8c7303d02a6c13d59f3a0f731546f966c9e8b1748c8b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00934.java", "upstream_id": "BenchmarkTest00934", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n byte[] raw = rawData.getBytes(java.nio.charset.StandardCharsets.ISO_8859_1);\n String data = new String(raw, java.nio.charset.StandardCharsets.UTF_8);\n byte[] passwordSalt = new byte[16]; new java.security.SecureRandom().nextBytes(passwordSalt);\n javax.crypto.SecretKeyFactory skf = javax.crypto.SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n byte[] derived = skf.generateSecret(new javax.crypto.spec.PBEKeySpec(data.toCharArray(), passwordSalt, 100000, 256)).getEncoded();\n response.setHeader(\"X-PBKDF2\", java.util.Base64.getEncoder().encodeToString(derived));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee095438c36fb75f9b2c32ea791df5ce1ef2e3646dcbf1d54d5b68cd0dbde7bf", "structural_hash": "35b1f5819b7d64ab42ce01bc92006092c0f89beb7bb00e3cc609d0c26eb38bd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05422.py", "upstream_id": "BenchmarkTest05422", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nimport boto3\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'app_display_name'\n def normalize(value):\n return value.strip()\n data = normalize(secret_value)\n sm = boto3.client('secretsmanager')\n store_cred = sm.get_secret_value(SecretId='app/secret')['SecretString']\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74398ccfaeace40f0e4b29b5cae4af05f5a2779a4b9c4662ffec194e0be3d9ab", "structural_hash": "c883a8b729ca4af22a2e3fe5de46d2bb98262941e7cd854de32bd974664d0b5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02548.php", "upstream_id": "BenchmarkTest02548", "language": "php", "code": "headers->get('Origin', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n $processed = preg_replace('/[A-Za-z0-9]{4,}/', '****', str_replace([\"\\r\", \"\\n\"], '', (string)$data));\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a838e5bb985a1a5b2a17480d9492d84ed8c1439da827961ab8ec2376f033bad", "structural_hash": "4eeabc6d9824ded997cfe51fe69a7f990159aca57f12ea68812f3ba4747badf5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02983.cpp", "upstream_id": "BenchmarkTest02983", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string _path = std::string(\"/var/app/data/\") + data;\n if (FILE *_f = std::fopen(_path.c_str(), \"w\")) std::fclose(_f);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0b0e6b33f4cacf201c609d547375bf0473536a90a57b36e2112ceb4dffeecf7", "structural_hash": "ff229c8bb54d9976e11d427b8788bca9575539c9e9835c162375a667be47de69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17110.go", "upstream_id": "BenchmarkTest17110", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tvar data string\n\tif len(pathValue) > 0 {\n\t\tdata = pathValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\tc.String(500, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f90bdfcd0af583388eda2bddeab799f02453de906bed1abe14f65c539c2ed7d0", "structural_hash": "b26ad1d69c085846ac425aa1f2f3840a87f258b0f39e2d46e58c2c603c03e712", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02833.rb", "upstream_id": "BenchmarkTest02833", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n system(\"echo\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "faafbc5c9ef70de29236e23a5c944540e3aaac2f8c083f13ba18f56ef8b1aa27", "structural_hash": "eec61a0ebb5d7f3f730316d3580624943ea0848cfc25b7308306a468d892a70b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01579.py", "upstream_id": "BenchmarkTest01579", "language": "python", "code": "from flask import Flask, request, jsonify\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n parts = []\n for token in str(forwarded_ip).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return jsonify({'length': len(ciphertext)}), 200", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40bddb6321c83b258df1b69f5a4907cd5b180714c93091e5111660a2760ea56b", "structural_hash": "fffb5c4906dba4739f8a19026a23eeca954540c9ce8fbba62298729241e1c52c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19271.js", "upstream_id": "BenchmarkTest19271", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const data = passthrough(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n res.set(\"X-Custom\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c303d1ef1bd414001033f560272c599afecd0b31b169937dfcd23c8ae1a0263", "structural_hash": "80323b2aef85d90c8562d74701c43cf31baf6daf59862350ec036d31cc94214b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03379.sh", "upstream_id": "BenchmarkTest03379", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=$(printf \"%s\" \"$user_input\")\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n mysql -e \"SELECT * FROM users WHERE id = '$processed'\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92bb6be7808fdb7e2598ea7ced6e6bb55b8c4271afacd255b106f808f505bbc4", "structural_hash": "a954542c3ef9fe3b95ca25a2b906595b7123490d26e67884fe2cc733bd38e778", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10333.sh", "upstream_id": "BenchmarkTest10333", "language": "bash", "code": "benchmark_case() {\n user_input=\"d1Fg7Ht3Vk8Mq2Pn6Ws\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b26e115eaa443dbcabcf3a1dcffff817a56ea98bcc4e998fc15a5c549975c4d6", "structural_hash": "add6ad2d03c6a12a9394a83aef9617f6947efd287d7b216df908483546e72422", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20004.js", "upstream_id": "BenchmarkTest20004", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3650f0cdf2d81c597d82eab16ef2ef208d9ae5211a45b892be553a5afcb13c2", "structural_hash": "fa0abd4fb852eecb713c54c681fd2d48deb156e16e57838fef4d4faebc23cf79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12666.js", "upstream_id": "BenchmarkTest12666", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf4b356c80626645fb1dbac30de06b3e725444530540de2567143447bde461a7", "structural_hash": "8fd6b4d69de70cb75f0dbbafea602907ffe4706518fd3814bbfe7a2182fe648f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33114.sh", "upstream_id": "BenchmarkTest33114", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=\"${user_input:-default}\"\n printf \"%s\" \"$data\" | sha256sum | cut -d\" \" -f1 > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87d6a89b52827dcbb505987e38790721adc2a89795aa949db4f98bbee0270cd7", "structural_hash": "6f91b38d8cd99b543079196c09670a21fe7eb674b91c9718126685124279246d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04583.rb", "upstream_id": "BenchmarkTest04583", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01628194838b55021b282cd31f2061b3c8bd2503b2e75452cbaed2e30bc58a28", "structural_hash": "f3f56bc58b1eaa15fa68e6477c1852f88a96f7d2ed0404998857aa02a23b5ae2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03880.py", "upstream_id": "BenchmarkTest03880", "language": "python", "code": "import requests\nimport json\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n data = json.loads(graphql_var).get('value', '')\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df3baa63eaf1f27e4a4f8af5247e4e8a6bc64fc55b9864dce31781d66ca2b631", "structural_hash": "1a881eec2b09b8028dd27b7622e55a846a9afe8e5c8e37c83582d39b13c099f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04901.ts", "upstream_id": "BenchmarkTest04901", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n fs.writeFileSync(\"/var/app/active/pkg.bin\", _content);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1105eb3ff697cd385ae33a9cfcc6e288d219e2eeb7db99fec4751932f2eb946", "structural_hash": "7274733460ae7ed70fbf0dfcaca545305a11da984329652aa27ac34f9ad9e481", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14515.c", "upstream_id": "BenchmarkTest14515", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n unsigned char _digest[16];\n MD5((const unsigned char *)user_input, strlen(user_input), _digest);\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0ac7c82d88a79a55c6afc97400778c9880769ce1fd05d1e9d357bbb8f093627", "structural_hash": "d6dfd60beafb281724a4545e91a1abb53e455a917b5c4a6031f23ebbe34945f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05433.go", "upstream_id": "BenchmarkTest05433", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tsegments := strings.Split(fieldValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\thttp.Error(w, fmt.Sprint(r), 500)\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "324628b5668e661232e4dc4323c08e630a18ef39eb73575d46d69faa7dfbb3cb", "structural_hash": "2f4f4de8192c914c4303193dec1518be99914c3543cd2b10c36fa53d1bda6b59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09454.sh", "upstream_id": "BenchmarkTest09454", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n case $data in\n a) echo alpha;;\n b) echo beta;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f15e631ea1a28d589beefa393b420c3efbe37060b5c756100c3b3974837a6347", "structural_hash": "057daefdc615ea2e8e38d49bc9f40b929dab8fc7be1c44523116467f80605a18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_42397.js", "upstream_id": "BenchmarkTest42397", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/uploads/data.enc\", _ct);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bd045af4907b31f4169afa5fe21beadc431618c419438a44ceda01219607954", "structural_hash": "8e4a0ae0cf83ad28db61db5da07dfb1e270cd13055b71db3c55eb03cad4cf89f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02589.php", "upstream_id": "BenchmarkTest02589", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n [$data] = [$userInput, 'http'];\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $conn->executeQuery('SELECT * FROM users ORDER BY ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0aa02ce7038272703b3d473f7c59b2684e171444af71e5b037279b9bc12e2df", "structural_hash": "56742be61c17f371c6322e910a7ed91cd7d2da638118cb87e151cd5c3ee4311a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00605.rb", "upstream_id": "BenchmarkTest00605", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n render json: { error: \"Internal error\" }, status: 500\n end\nend", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cddb30f4d1d78eba068d5bd044ed9540d7f06a7e47f753eb2bf9c2e8ca2fb791", "structural_hash": "7799a88f83f6002126f1db14590912dbe2419f6c942320e2ca3c28c9d8182bdf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03513.js", "upstream_id": "BenchmarkTest03513", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9bd1f9a2ff8d9fe786f28adf937c1f05ed79e266ac404ec7913fb7b59563db17", "structural_hash": "9920907c0d513da702805d82204ae0e421c4cfcc8c9f01b8a29aaccf5ac36f13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01187.js", "upstream_id": "BenchmarkTest01187", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n if (data !== ctx.session.csrfToken) { ctx.status = 403; ctx.body = {error: \"csrf mismatch\"}; return; }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2de91036c791e05e8ec5987a9a158162e2ad9ba6417c8d5e79f3601af403164d", "structural_hash": "dc0383529fb716e4cf95a791e10d3695f6036e3cb32668ae0646288ea9794599", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09557.c", "upstream_id": "BenchmarkTest09557", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n FILE *_tf = fopen(\"/tmp/app_export.tmp\", \"w\");\n if (_tf) { fputs(data, _tf); fclose(_tf); }\n chmod(\"/tmp/app_export.tmp\", 0777);\n}", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59740d2833b3f9e063947dfdb4e00e942bb699304139f9dcc80523bc27a0efea", "structural_hash": "660aef959376c69cc99249bae7d6c685622bd9c838409d15003d8bf49864219d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00955.php", "upstream_id": "BenchmarkTest00955", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { abort(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87db0ccfd6c08f9262fc9aa9cb11209c89f313b8028647cbc2a0b82242b3361a", "structural_hash": "5ba0fdab06e189228844c1a4c8b59c965a47044c8aeda0b9636a3991e59eb8ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32739.go", "upstream_id": "BenchmarkTest32739", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvar _b strings.Builder\n\t_b.WriteString(uploadName)\n\tdata := _b.String()\n\tif c.GetString(\"user\") == \"\" {\n\t\tc.String(http.StatusUnauthorized, \"no session\")\n\t\treturn\n\t}\n\tc.Set(\"data\", data)\n}", "label": 0, "cwe": ["CWE-501"], "category": "trustbound", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef71ce9475567ab0b11cb264dd77b2b819d19c8f34bfc8cd0d47c4ac8e59294b", "structural_hash": "eedba5316e4f72aca3a61aca073747ae31bb51a4818f2c2f9157fa9de621c6af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01824.go", "upstream_id": "BenchmarkTest01824", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(headerValue)\n\tos.Chmod(\"/var/app/data/\"+data, 0777)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c9f7d9fdcf374f4511c35f80c9c9fad8cd2386cf965979790c4a382403b8819", "structural_hash": "62c38c80e9df83ac2a43e8918e95f0cce622df485b90f4c4a0b2225337324c85", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18168.c", "upstream_id": "BenchmarkTest18168", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char *_found = strchr(user_input, '=');\n if (_found != NULL) printf(\"%c\\n\", *_found);\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0d45937db9702263259dcf595111affc987fd790970247d74ed012197632bd4", "structural_hash": "f4140bf053cbba973b5c699a5613836c2f7d99f7211822cb0f77867e1c0c17b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03491.rb", "upstream_id": "BenchmarkTest03491", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n ERB.new(processed.to_s).result\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a844490b832c63a66208b8a597b969640025c86a367f4538811befa0ba894d6f", "structural_hash": "768ca0a79d0ea13d46b564705d48b1d43c542a68f136064949043943198a4fca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07080.c", "upstream_id": "BenchmarkTest07080", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"w\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8e6397aef866ecd4e354f8e24f7c689765e5f1d5fba7fa21639d0dc298c60f5", "structural_hash": "1d048e94ba704dae938e6f8023c8fc5d89c644465e3d5c7e3f293027446a73ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37764.go", "upstream_id": "BenchmarkTest37764", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tsegments := strings.Split(jsonValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tDB.Exec(\"UPDATE users SET role = ? WHERE id = 1\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a96876b6cf8263a2c5336c035640c1a0ce4d54a3ed35be3a7a2cc3668e245067", "structural_hash": "9a664e24d53925028651a300ee99c81150bfe0d19f9f9bf2992b4eb8b5c2d8ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17446.c", "upstream_id": "BenchmarkTest17446", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n _p = NULL;\n if (_p) free(_p);\n}", "label": 0, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d014bbeed8da08ee2b62eb36adfd28d6ddc27b856f855b983d1382a735eaca6", "structural_hash": "dd51a3ea9faaf5a4675d4ff666081f2f9c2b17ba280ffff9135d9b429b762cba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02847.c", "upstream_id": "BenchmarkTest02847", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2b35300df8fce9ca165eee9930c547d6cea6f08af903f883c2dc7e6fc6c18f4", "structural_hash": "57c7b34a86a94ac0ed25b6982db0a8a693f8d2bceaae894131fcbcde963f1205", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04323.ts", "upstream_id": "BenchmarkTest04323", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7684565286d382fc851b5b006f7d8da9a77c6bdd9e70392d555828b3be349a23", "structural_hash": "5fec1e6a35f35bd3dafb74876107ca55e2fc6359f03c53ad77a2cde413b455d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15717.c", "upstream_id": "BenchmarkTest15717", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n long _n = strtol(data, NULL, 10);\n char *_p = malloc((size_t)_n);\n if (_p) free(_p);\n}", "label": 1, "cwe": ["CWE-789"], "category": "uncontrolled_alloc_size", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68a0a9c9d1775166ef1a4b29960067ceff2014b97891349d6386e7c7aa98d95f", "structural_hash": "fd9d9ca0b9f7635a2a769f04e6afe6db241c84cf9f1cef2a675c00ba59473e46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04601.ts", "upstream_id": "BenchmarkTest04601", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52881419a21670fc4f8127b22a11ff6be5aac6518f61921279bab25eaf64cbd9", "structural_hash": "78a6d1e88ae26f030aa83bfa261d40f717c7d60c1f34a0c50576f8b9bf21b5e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01556.cpp", "upstream_id": "BenchmarkTest01556", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "623ca737b131a8a2c1b19200a3f0bc0462c5a34087cbc1d617928adb062ca343", "structural_hash": "60039572184a76b221cbacc9cdd35fdd71b3fb5a6be34f9f383759e0a09ac575", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00934.sh", "upstream_id": "BenchmarkTest00934", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n exec 9>/tmp/app.lock\n flock 9\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdc88106daa752352c119e6742924da1ed9a77842db02ab37a61f2bd337b58f1", "structural_hash": "c806e8adb33a0fb1fa07048b4ca7003050c7c2da7891246aaff537e768985056", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00454.php", "upstream_id": "BenchmarkTest00454", "language": "php", "code": "request->get('multipart_field', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $cell = (string)$data;\n if (strlen($cell) > 0 && in_array($cell[0], ['=', '+', '-', '@'], true)) {\n $cell = \"'\" . $cell;\n }\n $fp = fopen('output.csv', 'a');\n fputcsv($fp, [$cell, 'data']);\n fclose($fp);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0fd167d0e59a1b15a7569d866b709920b0360e1dfaf23dabc3758d5c61a4a951", "structural_hash": "0cb0e75a84dd838ba33b38051d39ebafc379f2bf62fece2bdd477baa6d851d1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23309.sh", "upstream_id": "BenchmarkTest23309", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n echo \"$data\" | xmllint --noent --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27ddab0c9626fd893c407b3dbe225a41b4426f9b8b978cbe478c42439abd2f4f", "structural_hash": "938578cacbc43205e1af1004c95cc3541d93347f7c5ee6a024fc4a4151734f7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05743.rb", "upstream_id": "BenchmarkTest05743", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n tokens = user_input.split(',')\n data = tokens.join(',')\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n render html: (ERB.new(parsed_bool.to_s).result).html_safe\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "015ac178f4164e2b3769d790af347c11e158db530ce702da197bc02a76de5a7c", "structural_hash": "4c14af0d1050f114c739bfda2e2a2a959a7dcc1e73dc44318798c7f3f9af4405", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40033.js", "upstream_id": "BenchmarkTest40033", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n res.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1022"], "category": "window_opener_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4911ecd890cc0f594d972bacd63547000ae2a063cba6616e802b55f40c3869b6", "structural_hash": "79c4ed64662cb05f59a63e4f46b4ea75330045c799fafead5b8fa663bacea6c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03977.rs", "upstream_id": "BenchmarkTest03977", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = raw_body.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee5dc702f4fc0c53658aa20d29a6d9e8f7ced5aee374ebec05f663176e4c624d", "structural_hash": "aec687f60c072c285c516e934c5b6efee7869523b2db2029cdae0b8fbcd11a33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03876.java", "upstream_id": "BenchmarkTest03876", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n String data = \"item_%s\".formatted(forwardedIp);\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.KeyGenerator kg = javax.crypto.KeyGenerator.getInstance(\"AES\");\n kg.init(256);\n javax.crypto.SecretKey key = kg.generateKey();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c4361e66c448d47c669ac63d4fb81463958e374a6c9a43eef517deb9b5635fd", "structural_hash": "8b4aff219afd9f8545a7ff1391dcff192a5ff7bed9078fa4cec93e9e1bf6a601", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24666.sh", "upstream_id": "BenchmarkTest24666", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e59f6407ff6ab3027f93382738c6cc13e963fb5b3521d2480df682cd6b218c9b", "structural_hash": "c8a8784e1a5cc9a152f535c8258d3d93c2c53ef2eb2f37bf0110fe80c69e5930", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04395.rs", "upstream_id": "BenchmarkTest04395", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = ua_value.split_whitespace().collect::>().join(\" \");\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3ad2b18097933cf3340c00d08a3f3106dfc23558d5f39ccea32155f3fdb3372", "structural_hash": "cd723a187c599ea1066b18aa33fc670fbd9379e2dc023ce7cbd10ba5e955bd55", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17190.sh", "upstream_id": "BenchmarkTest17190", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n eval \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3153f2ac9c426883a2bbe2774271ca1fef30c6803d4dd8f0e27ab13ca6d4863b", "structural_hash": "d1589f7289bc61b3da46d01e3f7466336f79de3b0d35770d900cbeac23653e44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03967.java", "upstream_id": "BenchmarkTest03967", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : hostValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n if (!(\"true\".equals(data) || \"false\".equals(data))) { response.sendError(400); return; }\n LOG.info(\"Action: {}\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4efc4882c61f728b6fd8ca15eddbc07786f8f9557e7b59158e8d5157a36ed9c7", "structural_hash": "5287d970c46a324440b85a12073ea4a7edf0cffdb63ee6c126e79c35875db542", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13366.js", "upstream_id": "BenchmarkTest13366", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00294e3b02b13edb9c2a8eb21c75cd7358f66f0bf0d841cfe0e96d50b7299c2c", "structural_hash": "a370190b766125ba4625887483f4c306943e6e92eb70aef00cc0853256a16b8a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08452.c", "upstream_id": "BenchmarkTest08452", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n free(_p);\n}", "label": 0, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "240c181db79d00d3c2664b2e3091c11f72092448e928ca3b8ca19e792ff8401e", "structural_hash": "8ef5e31994be2a1859c3815c4505f08a9e84860e2ce625e67f9bb4a27f1ded6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01737.cpp", "upstream_id": "BenchmarkTest01737", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Referer\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n res.set_redirect(data, 302);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc4e22606d05e866bb998a7c31a40342739d1956a6619a98ccf76ca201ee44ea", "structural_hash": "a95e2741a4ac385afb530a8ff2837b95b47d5c9e403f2309587d951b6a37a0eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12957.go", "upstream_id": "BenchmarkTest12957", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(uaValue)\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "526a3bff0e6c5b14999c480c69940b0d08ecbaa19c07a1d967cca6f8bd1608e8", "structural_hash": "91bcd820c4d7965ab11a411f023458810b471b851a4f4f7f465295fa2694f965", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03834.rb", "upstream_id": "BenchmarkTest03834", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = user_input ? user_input : ''\n system(\"echo \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a70dc06bf61bb6ecebd195166482923b8df51c91057bbfe37d0b0013f26369c9", "structural_hash": "aaf20604926a71d112fa833c5e09b7c1730ba6a55fd09f88acc8ffed31c9ddee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06097.go", "upstream_id": "BenchmarkTest06097", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(forwardedIP)\n\t}()\n\tdata := <-resultCh\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_info_sent", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc940c97258b56fd65dc2572cbc1f1c6eca81ee0fa6b75c04da0c52ef362f970", "structural_hash": "52029af5b0bda5f08b71ccbb2911cad2d134bb87a5565da260944a7f7a7933b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03477.java", "upstream_id": "BenchmarkTest03477", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.List tokens = java.util.Arrays.asList(headerValue.split(\",\"));\n String data = String.join(\",\", tokens);\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { return Response.status(502).build(); }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e264cc17529da1639da603d888bbfa481bdf1d1481559e0f0c38c2fad5f352d9", "structural_hash": "5e79daad128c3e09a3adc883dfc9e6f672d4116bf9b816ee08ab272e0725efad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17169.sh", "upstream_id": "BenchmarkTest17169", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n case \"$data\" in\n https://app.shcdn.net|https://cdn.shcdn.net) allowed_origin=\"$data\";;\n *) echo \"forbidden origin\" >&2; exit 1;;\n esac\n printf '%s\\r\\n' \"Access-Control-Allow-Origin: $allowed_origin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63f9c2eb92a8747d58b52067c894731a4e2d7d57a322825eb0ea7da5468392da", "structural_hash": "5a81e84fc79ae96a1131d169c715b96fb7d540ef13644534aaf5f170e98b2c76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20671.sh", "upstream_id": "BenchmarkTest20671", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=\"${user_input:-default}\"\n eval \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6497fc2660cbbc80f6b2ee681c6affeceb679bd15a8d0e8d0c66d45c5be31571", "structural_hash": "23cfde4c08ee939a359d521f9ecfa5de8eddb7a601826fc911ac9477c9f0de7c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04862.ts", "upstream_id": "BenchmarkTest04862", "language": "typescript", "code": "import { Body, Controller, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = field || \"\";\n const data = await Promise.resolve(userInput);\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { throw new BadRequestException({error: \"field not allowed\"}); }\n }\n const processed = JSON.stringify(_incoming);\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n }\n}", "label": 0, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b31ffb5f61eb5c9eac52107d80a26a5324fd10ae75e502d6cb6a61a1a41ae3f7", "structural_hash": "fb4e9c9031332444af63c324f4696e1e98581a15aa51802ca527629c27191b1f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17425.sh", "upstream_id": "BenchmarkTest17425", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6651cb87e3ad8244f83ebcd937b39c2195fd5d673d879602195ad7804348e13", "structural_hash": "436cb5c0c3e355275c447196910226deb37689ad0ce94a7b5b2df589fdd51c39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03800.sh", "upstream_id": "BenchmarkTest03800", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n rm -f \"$tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "703692b8f2872f75bbb5587089bc44d4dbbfa887e1b36392bbef507a59c5acbe", "structural_hash": "a255f321f39f4f009cb2eaa65e15e5304631a2fae7101af404e29cb05af64cad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03810.ts", "upstream_id": "BenchmarkTest03810", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed: string = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b295fccf1ba96116da3e57acd2da9c8a5355d93b7afe6aab83eec1527aab4a89", "structural_hash": "13af89f5f6a0817b2c994c3169968d296b2bc659949b5505330f057f0481b0b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01813.php", "upstream_id": "BenchmarkTest01813", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66d4225b94deee5c3b292133ad239366dbc4d403850325a1f7b4145fe046aa71", "structural_hash": "7192b97b9cc117749e378659f0d8a0c0aeda996e97fe4b4cc54b0b74a0127788", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03418.rs", "upstream_id": "BenchmarkTest03418", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = [\"s3cr3t_key_test_xyz\"][0].to_string();\n let data = crate::shared::passthrough(secret_value.clone());\n let _ct = crate::shared::encrypt_with_key(&data, \"sensitive-data\");\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "318868366d05ad9343d86615f7ad4c470869d28e29af3106589c9386e62d32c9", "structural_hash": "2ba759763ea6c63055c0b3bcb02a76cc261782b5d9b834dfa680bfb97f65880b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29108.go", "upstream_id": "BenchmarkTest29108", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", pathValue)\n\tdata := _sb.String()\n\tvar docName string\n\tDB.QueryRow(\"SELECT name FROM documents WHERE id = ?\", data).Scan(&docName)\n\tw.Header().Set(\"X-Record\", docName)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "831e23d6c02627a9dde9819b0baeec6ba698946e6d562de79e8fa0ac305f7db2", "structural_hash": "9c08f8a105418437ab84bd89cc6fba1d01de5cd31326096135640bd148d90ff6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_33226.go", "upstream_id": "BenchmarkTest33226", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tform := FormData{Payload: hostValue}\n\tdata := form.Payload\n\tpanic(fmt.Sprintf(\"processing failed: %s\", data))\n}", "label": 1, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e72d56cc13aac6ba30e668c1213cc692ea4ba2acd5cd322757ee9b562a04248", "structural_hash": "476ac5126ef41e98ac06d0cfd7031a90b4ab8ddde965e9a65e083a6075e3da17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05989.ts", "upstream_id": "BenchmarkTest05989", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5c5aac3e98e1ccda3a1686d36dd7214bf92fea7850693527c649223ac927b22", "structural_hash": "dfb79fdf391f85c9c95cf8beb3b9cb360d57babb581fc18eddfac82dc502ba56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02257.php", "upstream_id": "BenchmarkTest02257", "language": "php", "code": "headers->get('Authorization', '');\n $data = base64_decode($userInput);\n $conn->executeQuery('SELECT * FROM users WHERE id = \\'' . $data . '\\'');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13a34e18f73abd53d9aac87bf9f6df30e1df4186a8c5aed69f9b8da9543cbb16", "structural_hash": "a2b2c947425fc7f9823c33c44ae689925020f13fca4c0c32c83536b31c819aa6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04407.php", "upstream_id": "BenchmarkTest04407", "language": "php", "code": "header('Host', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9a0d0a25da6f4e6d274d6c5eb75c6e47eb45307d29be398b36ea646f8f25494", "structural_hash": "44e8405df4d11074b00ed0ab05a2d7aef47a91fb2ad4b5cc3502c70734c45b44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02913.c", "upstream_id": "BenchmarkTest02913", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n int _req = atoi(data);\n int _alloc = _req + 1;\n printf(\"alloc:%d\\n\", _alloc);\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73d1ef216500f18337d562ce3d2a04b916b5dce35092a68f7d07719f14f896b5", "structural_hash": "e55f66ba7f04b292e9c970dbf146fb666bc653514d4c0b1eccc89f58b590305e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02598.py", "upstream_id": "BenchmarkTest02598", "language": "python", "code": "from fastapi import FastAPI, Request\nimport ldap\nimport re\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(path_value)\n data = collected\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JSONResponse({'error': 'invalid input'}, status_code=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60123778c6892be9aacd85d9a4485c70ad7d187eba1da0871ceb883e9cab9647", "structural_hash": "2ce7ccae25aea6fcb734c5a15b57b9750dd6e2f8f5f267b6af8db0b28a8c40b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00189.rs", "upstream_id": "BenchmarkTest00189", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(field_value.clone(), |s| s.trim().to_string());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "174422303b99cfa8a2010a684a00f647f091bd6562fd5daee25465e6f28893c3", "structural_hash": "2035c0c0f815c74a2d7615ae768596a29bb108c816d13121bfedab7c44fe97e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03760.cpp", "upstream_id": "BenchmarkTest03760", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f352c1b0c73780b4588e4ce61c05fd6770455b84b15bc5c842347d24aab008a", "structural_hash": "38fa8e13161362656eb1c9dbe4523abf5a229c0d441d552c21bbd83ccab36744", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01520.cpp", "upstream_id": "BenchmarkTest01520", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n std::cout << data << std::endl;\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25c58105c0ba2187af37611ceafb4b024e7327f5251f8edbc553504dd69b3df8", "structural_hash": "a2e4a1c6b766217a9da347cfb849f3b4abac7a3139e1314fa78d89ae4e30c4e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04966.rs", "upstream_id": "BenchmarkTest04966", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let (payload, _origin) = (graphql_var.clone(), \"http\");\n let data = payload;\n let base = std::path::Path::new(\"/var/app/data\");\n let candidate = tokio::fs::canonicalize(base.join(&data)).await.unwrap_or_default();\n if !candidate.starts_with(base) { return HttpResponse::Forbidden().finish(); }\n let checked_path = candidate.to_string_lossy().to_string();\n let _ = tokio::fs::read_to_string(&checked_path).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "742a1ff1c293d68fa000ddcd08ccacf5bdb4b0cfa95530a9e11489dcc8aedcc3", "structural_hash": "a8c36884a0c3b9df753723ec7bb6739c4dc86d1a44b8aa7eaab17f95ff1977e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02550.java", "upstream_id": "BenchmarkTest02550", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + multipartValue;\n String data = valueSupplier.get();\n response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f58911653dc34016d33a87140bd79e6ba69a09df3d373fc6537837d7503c786", "structural_hash": "1d8c62be8315d33605a93e9f8e4979d4f966bdb79fb741de48df4d2c659554fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19938.sh", "upstream_id": "BenchmarkTest19938", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n curl -s \"https://api.lan.local/lookup?q=$processed\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c19aa39e6b962b94f100ab6437f5dbac557b71d486a51ff8149889c7771925e3", "structural_hash": "f55f3e1784b394fb1e558e72447faebd336d8fcfc2d8ae99d5763843a8b65f14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02929.rb", "upstream_id": "BenchmarkTest02929", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n data = format('%s', user_input)\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f9af3457f3f3778f21d0f994a4d96a8a320d4988cd2fa5ea6539a483ebb3263", "structural_hash": "0bbf9e112711a16e3cfcc64d17cbf178d87c3bb6aa0b7f14fff67d940a1a20d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02071.ts", "upstream_id": "BenchmarkTest02071", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const processed = Boolean(data) ? data : \"\";\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(processed)), { rejectUnauthorized: false });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1e9154a4aa3a9034293e8ff27b42f5423b2732e6e54ab469eddc410d6c95c74", "structural_hash": "420ba26e801a4e73cbcf3719f24c23bcfc4dbcdbacde62eeb339dc581760bd09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27547.sh", "upstream_id": "BenchmarkTest27547", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2732f481b6cbb1b9eee7abba4033d2b4d8bc0f7f16708725101f7acfbcf6f090", "structural_hash": "746e42d2219cb89cb186843254a73b8a5e32eeb3570e4fdb49d3457c59142e6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02717.java", "upstream_id": "BenchmarkTest02717", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n request.setAttribute(\"bundle\", rawData);\n String data = String.valueOf(request.getAttribute(\"bundle\"));\n if (data.isEmpty()) { return Response.status(400).entity(\"request required\").build(); }\n String envSecret = System.getenv(\"APP_SECRET\");\n if (envSecret == null) throw new IllegalStateException(\"APP_SECRET unset\");\n String storeCred = envSecret;\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", storeCred)) {\n return Response.ok(\"{\\\"auth\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adbff9a3f65b78459f37c59d883a6136ab5a5385d0826f80be4800c7e03a4c8f", "structural_hash": "93fdb1b089c872bcd4e4018168ed50f262742d26806708a70b8ca0bbe1812841", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01970.php", "upstream_id": "BenchmarkTest01970", "language": "php", "code": "headers->get('User-Agent', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9561ad19ffab6ecb2efefc8c9d84c7c2e304eaffa2878b188a200d3b4e565f8", "structural_hash": "302b2e67b41aac358f0ee5cc9c31862c238fa1ec400a0faabcf2d8548df5f645", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01101.rb", "upstream_id": "BenchmarkTest01101", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n data = String(user_input).strip\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea788e43ff8944fc1b45fd912948c4a485f440bd3b93680f97915be0403cd687", "structural_hash": "c003416f793c3fae724a7a55e2aed3a1bc6609376eb764fa0598f1b9ea591a3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01997.sh", "upstream_id": "BenchmarkTest01997", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n _h=$(printf '%s' \"$data\" | sha256sum | cut -d\" \" -f1)\n if grep -qxF -- \"$_h\" /etc/app/passwd.sha256; then echo \"auth ok\"; else echo \"auth failed\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d861d9d04d056725261c9d49fae1c4c18a52311db7cb1c4cceca9efe69a4a255", "structural_hash": "0e80435efc9be4ee99997b2d53272abc1dfa93c22e60a07c6ba619ee630fce90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01482.php", "upstream_id": "BenchmarkTest01482", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->set('Access-Control-Allow-Origin', (string)$data);\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05b3ca571391009aa68da074ccd393fa5f4725e2a162024b7b660731b5b69c05", "structural_hash": "61846344243c141a831f9fef216a6379384cba76da481b35a3336f99b4fdb95a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03186.rs", "upstream_id": "BenchmarkTest03186", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"setting\", \"default_config_label\")]); m.get(\"setting\").copied().unwrap_or_default().to_string() };\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = secret_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let store_cred = crate::shared::vault_get(\"app_secret\");\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n reqwest::Client::new().get(\"https://api.edgecdn.io/v1/data\").header(\"Authorization\", format!(\"Bearer {}\", store_cred)).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6900a6d47071a5eba8394be84720056c0a90ef64fa0f81f84bb3e69be8a79280", "structural_hash": "14880c773851bb74fbc4f501e2d70537a26ec0df05ac6473a6ff164e0f49a6a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15388.sh", "upstream_id": "BenchmarkTest15388", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n case \"$data\" in *DROP*|*DELETE*) echo \"invalid schema\" >&2; exit 1;; esac\n processed=\"$data\"\n curl -sk \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8732332d218301e9ef99807889d32a27b5d650612b97206907cdb53991eaea47", "structural_hash": "fe71b724c831afb88b2d23096ff02ffea5e1f9c96fb6fbab798c8af54d653e32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01165.go", "upstream_id": "BenchmarkTest01165", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(jsonValue)\n\t}()\n\tdata := <-resultCh\n\tif !aclCheck(ctxString(r, ctxKeyUser), data) {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-1125"], "category": "excessive_attack_surface", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cf013a7d4a21d61ffa421d93a0a7355067a7e2bfd67757dd82596fef48f1288", "structural_hash": "9b3ea2761795bbe3de90b03d7da53854bdabe3104e77bc1a40a6ad4609b89369", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19586.go", "upstream_id": "BenchmarkTest19586", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(userID) {\n\t\tdata = normalizer(userID)\n\t}\n\tquery := fmt.Sprintf(`SELECT * FROM \"%s\"`, strings.ReplaceAll(data, `\"`, `\"\"`))\n\trows, err := DB.Query(query)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b0255273ece1a372a1301017b5dcf94afeefdb405cac52875325bc9c6066d24", "structural_hash": "f1e3047b7530d1d3ff867e5d0120da175f7c6edd0a8ba671573eda8f3206ab9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33088.js", "upstream_id": "BenchmarkTest33088", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n process.env.APP_USER_PREFERENCE = String(processed);\n ctx.body = { configSet: 'APP_USER_PREFERENCE' }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a462a445d3c51982edfe352234b14811c7356b74da0a6a7e82368d8c621b20bf", "structural_hash": "d26e5fda173bdf77207dd64ade9794aecc423f3a1db38bf577189db4809390db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00735.ts", "upstream_id": "BenchmarkTest00735", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2902713e526afe068d6bfcc18fb435048a9c36c865ec2699272ece81b7bf6606", "structural_hash": "511709732186b32e55cb5d9a8a1391f5757f698db78e50521f082c1cbe27378a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02852.php", "upstream_id": "BenchmarkTest02852", "language": "php", "code": "name;\n $data = '' . $userInput;\n return response(\\Illuminate\\Support\\Facades\\Blade::render($data))->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "42cd452746978591868ac4f7c3cc7fa9f7ee18e1b2925bbac6e1bccb9b59f081", "structural_hash": "855e28ca2af2eebd6c0a07613a3f629067815400c7e74b96932b7441dc7d3b1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00355.php", "upstream_id": "BenchmarkTest00355", "language": "php", "code": "input('multipart_field', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da2cf38b879700bd4ee4a8ce1167a23c254fa2bb422a23a6931d0e8d6d19805f", "structural_hash": "9a27ad0134bca77e898155010df3436eabcd7180898fa2a724a3546fd366198e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03117.js", "upstream_id": "BenchmarkTest03117", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d567bad84c4b93ccdf5d98145aac54bb30c896311bc6c6d1b0bbfa2ee5e5b12a", "structural_hash": "a532473fb8c2413212259d1e41631c79af9cf8a36f1a736834641d05a4d7495b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_30131.go", "upstream_id": "BenchmarkTest30131", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tresp, err := http.Get(pathValue)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 1, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f138b4820230e4f4db304e61d948fedbfe1d284a59656d7accf2b83d2f45dc77", "structural_hash": "7d48c298ba7e0830ae726c89cd310e2afe068228f45cfdc29ac0198ceaec9b02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03908.py", "upstream_id": "BenchmarkTest03908", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = ' '.join(str(cookie_value).split(' '))\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f84ac34ee91b38a94c124fbb5fcb35d8e271db11ff3a04a696fc1dbf3010bf11", "structural_hash": "46e467b40c889f77a868dbd2c6d6a210089566436d0625708f1ff48b3f6c97a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04151.rb", "upstream_id": "BenchmarkTest04151", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = ''\n user_input.split(',').each { |token| data = token }\n headers[\"X-Frame-Options\"] = \"DENY\"\n headers[\"Content-Security-Policy\"] = \"frame-ancestors 'none'\"\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b0c30426cb2d6214c7a0a781e4296449399a9fe7a3fabdbb69790a2c20c3bee", "structural_hash": "4226c85312fe0546e9ab6bc2bf6fd4162a48460dde742f5e7f52a22a115fdf7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01651.php", "upstream_id": "BenchmarkTest01651", "language": "php", "code": "cookie('session_token', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a41959e47f3953bb2f8a4106c6883dccbe753a78e74f1af4186558643c092d44", "structural_hash": "dbc2d42e9df861bbf85f678108b4b713a3e7ae34e5b08bca9160ee9b319fb9fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03250.java", "upstream_id": "BenchmarkTest03250", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n if (\"admin\".equals(forwardedIp) || \"ROLE_ADMIN\".equals(forwardedIp)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ca2a1e03835eb89734290551eca428d86c632167ae83e7abfc2945c9b9ace9f", "structural_hash": "dd53201f57de1354f7517d69a7113f2ce76a4670bce252f6fbca56d0795da08f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01599.py", "upstream_id": "BenchmarkTest01599", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n data = RequestPayload(host_value).value\n if not auth_check(str(data), session.get('token')):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b11c5833c9de37264545cfe6caec444772d8e6a9259a3559d3c5c3a3df6a1f0", "structural_hash": "1a7e74d22dbfd18f6fef1f35f10d50c019ff850323252e91c5759452cbbda6e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20951.sh", "upstream_id": "BenchmarkTest20951", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n eval \"rm -f $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71f0baf86370d42c67b3a808ad55c10b5fe084f5012c0c5d32ef9f6135a14c61", "structural_hash": "520f15c6c38bd7eb1847a0f4548e989b6568a3eb6e9cfbdc5b6cdfef2e319980", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04503.rs", "upstream_id": "BenchmarkTest04503", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if forwarded_ip.len() <= 4096 { forwarded_ip.clone() } else { forwarded_ip.chars().take(4096).collect() };\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b5ccdee1c6332bc8ab2c2677016d5be28fe489e67a6547fea191366331302aa", "structural_hash": "ab43078820b698767f743fc5e906cb8a3f7e71e811a5f28fd5596a8228079f8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04908.rb", "upstream_id": "BenchmarkTest04908", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = user_input.split.join(\" \")\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bff3e8ab3d885ae52d8d576d3f7f260e696b8a2adad296dd4b30ea9c486dcee3", "structural_hash": "6a319ad32990ee2630d29c957ab55c4f81d7616ab764c877a2eff1833dcbb746", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00770.py", "upstream_id": "BenchmarkTest00770", "language": "python", "code": "from django.http import JsonResponse\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\nfrom app_runtime import db\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n ctx = RequestContext(comment_value, source='form')\n data = ctx.payload\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f16d0d0ceca829a3b933e6a7e7006c0d93b2fe21d5c7192f27de5258490f64ce", "structural_hash": "33ea01aa9bcd992d3fc82c128e8ce5675bccce325731155472a30f451541f9ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25153.sh", "upstream_id": "BenchmarkTest25153", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(printf \"%b\" \"$user_input\")\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf 'SETTING=%s\\n' \"$processed\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20e48a1f6fe1340b0f122a2316264d3a792c92b235cea42162ee55fe930cc38f", "structural_hash": "f6fd0160f5befaf8f6093abec5397fbe4fcf0963a60515cb3d2bb7f70a5b20b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02782.rb", "upstream_id": "BenchmarkTest02782", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = \"#{user_input}\"\n unless session[:user_id]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "221bcfc2ffe68fbfe3fc1cfd17fc3f7d8fdc79bcdc8ee08d0b3bd52ba4e8a9f6", "structural_hash": "737b9dfaef1553552e44399a1c0b7e123bb101a466df661a0235d6b7577868eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32930.go", "upstream_id": "BenchmarkTest32930", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tcipherOut, _ := rsa.EncryptPKCS1v15(rand.Reader, &rsaKeyPair.PublicKey, []byte(multipartValue))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"rsa-pkcs1\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0d3302cb15a2f7c31c82365f89e3ca2b0ad867bdf101c57f1721e33904bc68f", "structural_hash": "e73c3b9b009806998079e53e99981f154418dd7e1346693b4776e576a9cbc4f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01522.py", "upstream_id": "BenchmarkTest01522", "language": "python", "code": "from django.http import JsonResponse\nfrom django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport re\nfrom dataclasses import dataclass\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n form = FormData(payload=origin_value)\n data = form.payload\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n return HttpResponse(mark_safe('
    ' + str(processed) + '
    '))", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb6bec6b249c0577624346a80b0ba208219b2677dbd0f424a3036702d6c191e0", "structural_hash": "cb235ac2650cccd4e3c2fa98c1d8f2d0d37731cc22123c53c0fbe99f80c53875", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08841.sh", "upstream_id": "BenchmarkTest08841", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n processed=$(echo \"$data\" | tr -d '\\r\\n' | sed \"s/[a-zA-Z0-9]\\{4,\\}/****/g\")\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "867e64f21718847b8a9b63471fd10aba451009d47d05800c7aa846b20b07570a", "structural_hash": "4b6407a2491d257d2b8f60a305b2fc85d9fd5fa0d68afcdd0284a5f4a4352911", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01114.py", "upstream_id": "BenchmarkTest01114", "language": "python", "code": "from flask import Flask, request, jsonify\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = RequestPayload(raw_body).value\n if str(data) == 'S3cr3tToken':\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87716c0cacb12ecbaab96b720c8d805911f520f2327cc4affb94cb0a7f729c03", "structural_hash": "b7dae6e7b24ac489860d617240bb4a1da1f7e58c722b6843c58ee876b0fc0055", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02530.php", "upstream_id": "BenchmarkTest02530", "language": "php", "code": "getContent();\n $data = \"{$userInput}\";\n file_get_contents((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afd8fd82bfe4b74c4c08c64ee892485000c951be4dc6fb504419b00528c190eb", "structural_hash": "c96f3d122b0f1750f325094a67c421e44742a9915cec8476e8d39024b6827d84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06920.sh", "upstream_id": "BenchmarkTest06920", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "948576b4fa09b3c49a96543229267b9b2817b1b3afb9c9a968413559baee0ec7", "structural_hash": "c86549cf09b1975cb984e276945a04c7fafa1a9c27a5ba0bc7670c9cc9f8c050", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03693.rb", "upstream_id": "BenchmarkTest03693", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n @user_input = user_input\n data = @user_input\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81018e79c832decb13280330b11289274e3ee1fcc4e4fe37c0acc5cb2e029e92", "structural_hash": "e3ae8e52e1be034fd9c3594f702d44772c959beee8812737afdaf7a037ad6b06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18171.js", "upstream_id": "BenchmarkTest18171", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = String(userInput).slice(0, 200);\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f874789cdafdaaf22d514b4385e45ed96d63485e82353535a673cad2eb935fd4", "structural_hash": "2c2222062871636d1dc1382e47e8394dfb2e43ea29d77d67a839a07016f2ec91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04938.php", "upstream_id": "BenchmarkTest04938", "language": "php", "code": "getContent();\n $data = ($userInput !== null) ? $userInput : '';\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $expectedSig = hash_hmac('sha256', (string) $processed, getenv('DATA_SIGNING_SECRET'));\n if (!hash_equals($expectedSig, (string) ($request->header('X-Signature', '')))) { return response()->json(['error' => 'integrity check failed'], 403); }\n $trusted = (string) $processed;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af077d42b6233ec86698de210ddaf45abeb60d2e9d39b4002b2feef5092dddfe", "structural_hash": "82bcfc1c7683e3db9eeafdc9eaee4354882e28397fb218323378387d780043ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09693.c", "upstream_id": "BenchmarkTest09693", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", user_input);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11d74b1d63031902c41128d0bbf7d3b31edc3946f62cfdc085bf7a258c011fc3", "structural_hash": "a487031eee805e2e98e4bc5ae1de1d65987ee8708a76318085ba5bf94677c501", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01012.php", "upstream_id": "BenchmarkTest01012", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $request->getSession()->set('data', (string) $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d37d8d1475c23811f6544523a8da841dceda40eb653aca2f87a1acbdaf54c4e", "structural_hash": "3aaa84f44427d3e50dce788ca67d8942954dfcdca3fb42e569d362ade2243f1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_06049.php", "upstream_id": "BenchmarkTest06049", "language": "php", "code": "header('X-Forwarded-For', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n $trusted = (string) $data;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5339d81e42a475c58767fcfb8130c9ddceea8db9ceff68cde68a321ca880ba06", "structural_hash": "822664f5321e310f184a898c18106248efe518d96fa9fbfdf4791d788e849017", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00248.cpp", "upstream_id": "BenchmarkTest00248", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11cfa007a80e822c1fbdd134228eddd592130affdcb94df63833ef7c5f54a505", "structural_hash": "30bcf6881324787a60140e1f337f6250e5c2659b6e522fbfd20e541c104cad50", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09483.js", "upstream_id": "BenchmarkTest09483", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const data = \"\" + userInput;\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d30ba88ce828cc4c23f497b43e57b6dd7528780cd393ec3e0556cdcd96f8a31c", "structural_hash": "056afd7f8e847ffd83ba3bed127d0949cd14698b73cbf270e172d98f9d8193a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05855.py", "upstream_id": "BenchmarkTest05855", "language": "python", "code": "import logging\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n multipart_value = request.form.get('multipart_field', '')\n data, _sep, _rest = str(multipart_value).partition('\\x00')\n logging.info('User action: ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "774dc8abb72ec9012a6dd148a74dc7c5d41418b8cbf80e71ebec356dad99c38a", "structural_hash": "b3fd6988c8d94220fa6e9b84bf3f68d5c15b63fc7d86c6f0dd3e17997ceea8c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_30938.js", "upstream_id": "BenchmarkTest30938", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n db.execute(\"DELETE FROM sessions WHERE owner = ?\", [String(data)]);\n console.log(\"audit actor=\" + String(data) + \" action=revoke_sessions\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe7b1a178c3de40edf2131558a9b45e39d56f59ec67848ece3f938aedfc26b71", "structural_hash": "70e739cf5ee26f7d9e2e71adc3b8044399c77e3522394a4495ba8a1cda5cdca6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00335.cpp", "upstream_id": "BenchmarkTest00335", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "523e289d210c870b3ed3c5849d09cbecb5dc64afc264a6cc4cc76a625921a40d", "structural_hash": "27274d54d05712631900807918ec8b974bd8cdbf8d5d3e1698e62badee6dab2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12527.c", "upstream_id": "BenchmarkTest12527", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(user_input);\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5833658ba730840455ebf928c6b906454a114f89ed600c3b711572ff52e4aed0", "structural_hash": "3e0935f53c2c337ca17b42f2e850639a1c5deeb28c043bf5f0e5f247b4b191c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21641.js", "upstream_id": "BenchmarkTest21641", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-565"], "category": "cookie_no_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b6a932f7fe7e0200d567946580b2a5815fe7a35f3c18fcf19bad00e7dcb2cf7", "structural_hash": "4373cb6e5eca4fa3b673b16cc2bd6c5483a0b9c52d97261083147e3a7945ecc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00908.py", "upstream_id": "BenchmarkTest00908", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n data = '%s' % str(multipart_value)\n return JsonResponse({'error': str(data), 'stack': repr(locals())}, status=500)", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6b9ecfa6ffd94a8eeab8f65b8096ea759e911ec7e7a70557557b5c729500e9e", "structural_hash": "df241e4f09198be13ec9d12c5a7c102d1c670e8a9a236e80c413d0218366285d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03522.cpp", "upstream_id": "BenchmarkTest03522", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n unsigned char _digest[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f2c1b6be3641c868c9c482edf373ad9bc20f7793b9e7bb693ad85e49b7c4c1e", "structural_hash": "eb84f189fee58f62f98bc4cd07a3726c6974b5ab3145b9956f94a04f29154372", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05509.rb", "upstream_id": "BenchmarkTest05509", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n data = Thread.new { user_input.to_s.strip }.value\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n halt 500, JSON.generate({ error: processed })\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd4f394f1ad94a657ea1d1c93289024d04804b8714a9226a715f31d76b130158", "structural_hash": "5b233421950b1ab1d9ad66a27ae99c266c9b75c7a1717ff9fadd30b3a1762434", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00857.rb", "upstream_id": "BenchmarkTest00857", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n payload, _origin = user_input, 'http'\n data = payload\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56bf800dd11d9495d96d92fb3bdb820d5d98f6939f5ce61e5bc9b7ad95db6571", "structural_hash": "a934fecf5b395816338b47d2f8f3c4376570d7f00e4e8f8fb3aca65c267037d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03876.rs", "upstream_id": "BenchmarkTest03876", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let _prefix: String = raw_body.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => raw_body.to_lowercase(),\n \"f\" => raw_body.to_uppercase(),\n _ => raw_body.trim().to_string(),\n };\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cab024cba89b9c01601459c37f642376ffda3f2e0e785ba27f6409b7ca55529", "structural_hash": "4cb776806106b398e70431855aef5adbeceba4053ff68d1e144dc63c51a0d8ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15407.sh", "upstream_id": "BenchmarkTest15407", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"Content-Type: %s\\r\\n\\r\\n\" \"$processed\"\n printf \"{\\\"status\\\":\\\"ok\\\"}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c39e817b11e95eec654bec5e2a7cd666374b58ba3d1f9cfb2a4738fff34085a", "structural_hash": "8737b93c4f46d7a94d3adaa6a9665d17f7c0f733cfd18eadd169da2c91d84853", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37129.js", "upstream_id": "BenchmarkTest37129", "language": "javascript", "code": "const fs = require(\"fs\");\nconst os = require(\"os\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n const tmpDir = fs.mkdtempSync(os.tmpdir() + \"/app-\");\n fs.writeFileSync(tmpDir + \"/data.tmp\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17da92ebc0874df1d9ab0239f8f1459bad5ed9b8f47888807ea2cfa6197d41e0", "structural_hash": "2247320418873dbdea8a66de79965a2f70381803f051fa290b81668fac50fcbb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01289.py", "upstream_id": "BenchmarkTest01289", "language": "python", "code": "import os\nfrom dataclasses import dataclass\nfrom flask import Flask, request, jsonify\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n form = FormData(payload=auth_header)\n data = form.payload\n os.setuid(int(str(data)) if str(data).isdigit() else 65534)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e617c721b2ca31e54d30b40ccd460efc9d8d6471be8510ac4e49fa5f8b3a0b3d", "structural_hash": "004e24bdc5a6e2b0e69c195c3f085bf423361d23d47d0c33f57647ac9d9d58ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04588.ts", "upstream_id": "BenchmarkTest04588", "language": "typescript", "code": "import { Controller, Post, Req, UploadedFile, UseInterceptors, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File, @Req() req: Request): Promise {\n const userInput = file?.originalname || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "936bd0039797734edff236dda4b735148bcf174f9f651d1cc504771b0186e928", "structural_hash": "beb45e8f1dcdb4ddd287cbf2328cf47d4d49e883ed70dc647fbacb31228f5c83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32356.sh", "upstream_id": "BenchmarkTest32356", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n arr=(10 20 30 40 50)\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n idx=$data\n echo \"${arr[$idx]}\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2015c2bf894fd0f0f12f9e6d46d32aa1e3b4334091e5334dc361a282bd0ef16f", "structural_hash": "831785005fa9f6b8c422754930da9822572b6bcb8c3b506648b9815ecaf6d768", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10103.c", "upstream_id": "BenchmarkTest10103", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n long _v = strtol(data, NULL, 10);\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 1, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43c6aafa1437f770eda0f412394c456d352592f4c75d25b4fdb86686b7aa2261", "structural_hash": "5b49af39becb656a21cd4628e8c485715a0453a8d76a3bcb88435c9ec501035c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01189.ts", "upstream_id": "BenchmarkTest01189", "language": "typescript", "code": "import { Controller, Headers, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Req() req: Request): Promise {\n const userInput = ua || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (!shared.authCheck(data, req.session.token)) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36eb6c01d07e58ed5d05fe97167b3ba5093e0e4244a45ad59d56cab5c59c73a5", "structural_hash": "cd29393dcc1df9bb6c65705fb875de0f121a6721f6e11017216321c4fe22e7db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01969.rs", "upstream_id": "BenchmarkTest01969", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\nuse urlencoding;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let data = urlencoding::decode(&user_id).unwrap_or_default().to_string();\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c2447b6de02ef747e3b98447f2661eb7bfed3d37b4713ff45923073891f936f", "structural_hash": "94358e5823bd2d52503c78f8029ac6a9f1c85c0d8ad6f267a2a7fb8d7be9e90e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04904.php", "upstream_id": "BenchmarkTest04904", "language": "php", "code": "headers->get('Referer', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n eval((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae75d84c141e40107cd6b81310567657fdebaf986c8ed039c00caa27f7cfe536", "structural_hash": "6589336045596c2cbfc9b438d050f4842d42cea9074288cb89dd0288d39ced6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10927.c", "upstream_id": "BenchmarkTest10927", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2961f7512551567451bdb3deb85b2a6e7b5784ebc7eaf49b3e0d5120f906426", "structural_hash": "625136423103a18edec1c61e45e07a52849227e8e4e5450f41b587acb34ce83a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16210.sh", "upstream_id": "BenchmarkTest16210", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "964e09a87b8ad905da5270ecc5d64df7e66e3af779c952f464ff28b93900441c", "structural_hash": "dce292dacbae0a3356debd07366e501f728c05c01d0c92df05f48003508fcad7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00369.ts", "upstream_id": "BenchmarkTest00369", "language": "typescript", "code": "import { Controller, Post, Query, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = id || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n res.set(\"X-Custom\", processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b370606cbd247d4d9b2fcdf0145f5470e707b097b8593848088bf895d220f66", "structural_hash": "115eb213e420d0bca57c6bf97f75b5dd092a469f736bc151e0d38301986dcc67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05960.ts", "upstream_id": "BenchmarkTest05960", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n eval(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a18d2fed21af8f5b2a0e0838fd0297312a80c9f096aa7a01440bf400025cba0", "structural_hash": "5a82b20039cd20d9455e22fc91af134b7de5b453400b7a99eebe5be8092d46a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04486.ts", "upstream_id": "BenchmarkTest04486", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n res.set(\"X-Custom\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b47403ad36d9eaeac920118ea2a84dfd14837e1f06a0372ab509bd06965536fd", "structural_hash": "5425241d49b6e6792d61f20b133bad494a17b9c26cdbe6a6599ec56534455a3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18335.sh", "upstream_id": "BenchmarkTest18335", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n chown -- \"$data\" /var/app/run/worker.pid || { echo \"privilege drop failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8bfc4673ed1f461b9d6aa98da72012f271f5579147efbdf7f26c3a6f3ec479c7", "structural_hash": "3b8a9b4833577b88a37983a21f8ac85837dc6858f722a493cfa9064d6cc1a1db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05262.php", "upstream_id": "BenchmarkTest05262", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { throw new HttpException(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n $conn->executeStatement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bfd71007b4cbcb609faa2d559b115afb45012e849485376af79ba0915e1500a6", "structural_hash": "d5b07cc7cbf21a841b6268168cdedb0f7d0e25131c0da176c7bf3347675b7a94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01153.ts", "upstream_id": "BenchmarkTest01153", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const data = await Promise.resolve(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { throw new BadRequestException({error: 'forbidden'}); }\n const processed: string = data;\n childProcess.execSync(\"echo \" + processed);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e392d3e59835c10ee1deac8bdac7a607b4b9dbbb1469ffd79188f38d987af85", "structural_hash": "a139316692cb2a7f043293cab30b704de2a881386f0e3eab4877b38cec646b31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20679.go", "upstream_id": "BenchmarkTest20679", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar profileBio string\n\tDB.QueryRow(\"SELECT bio FROM profiles LIMIT 1\").Scan(&profileBio)\n\tdata := profileBio\n\tif _, after, ok := strings.Cut(profileBio, \",\"); ok {\n\t\tdata = after\n\t}\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ea647dc2bd3096ae6c4876df7d2fb20ac3110d76c1fc8164904b6d8feafe0bf", "structural_hash": "f4c4b0cb281c343a836521110f3689c63af103f54bf5a9405abddd10b2f6834d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02918.rs", "upstream_id": "BenchmarkTest02918", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = auth_header.replace(\"\\t\", \" \");\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d7d3fc2cee3d47a5f95b21a6513eb518faf143adc2ea4d8af0f1c78f02f1a43", "structural_hash": "2e9245c4296e5d0949a430d9537deeeaa6fcebe6bf4784ab889eb74c425aa41a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02887.c", "upstream_id": "BenchmarkTest02887", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8985308561df8acb375f0f825b328117584a2f9f5a53aa0fae9a62760c46b777", "structural_hash": "bf1ec84990ba6ea781d85718616d3584b883e4a78971a4f751ba3fe1368fdad7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20770.sh", "upstream_id": "BenchmarkTest20770", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6f90b02aabe3f81e50ba4affd401e4440f0364ba38a7b3b0d6c1948824e5229", "structural_hash": "425e65c19c93fa02049063cf920a094dd1f23375e48bac3ffadbd89e446ab955", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02499.py", "upstream_id": "BenchmarkTest02499", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n parts = str(forwarded_ip).split(',')\n data = ','.join(parts)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n with open('output.csv', 'a') as fh:\n fh.write(str(processed) + ',data\\n')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5d844d6157789a34cf1db606a09ca3a27d8cc538ae29c3d672aff52dad30302", "structural_hash": "99fec5b9971ca55669d4a524b63436ebe3ab54c6355e06ba2b16403d3ce81d8c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05772.rb", "upstream_id": "BenchmarkTest05772", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"sanitize\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n processed = Sanitize.fragment(data, Sanitize::Config::BASIC)\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4083b4ac4d6bd2eb147b0a3242ce5ea86046bff92e8bdee3e93c157697a04805", "structural_hash": "647d87a6ed4a5a7b04787e06f03aa580c59f92a451edec9510dfea7127d8ce2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16044.go", "upstream_id": "BenchmarkTest16044", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdata := dbValue\n\tif _, after, ok := strings.Cut(dbValue, \",\"); ok {\n\t\tdata = after\n\t}\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-342"], "category": "predictable_from_prev", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da756bc6daf3fd3af028626e6bee14c8f7b4d62ccbe5fbf8b9befdd5cc5f86c8", "structural_hash": "eb0e01907fe53c0e97a50a91b5ccfec33d6dcd1529aef22cfdc262cb3637b58e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11949.c", "upstream_id": "BenchmarkTest11949", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "973b76b21e6b8da2865f26aa3c9ea10ee626cb8a80d4a469ab271c71e303c586", "structural_hash": "98194067e8138e01786650d3bfeabfff4affe0d76ade58eb1f459dbf6a73714f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01381.go", "upstream_id": "BenchmarkTest01381", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(rawBody) {\n\t\tdata = normalizer(rawBody)\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2fe74080364cec7bbf83759fa26549403e3b01692ed95e30213389afd6e6d2f9", "structural_hash": "d650e613bf5b0e643274de0b5069969cd2ea916c38dbaad7185ee03bc62793f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02311.py", "upstream_id": "BenchmarkTest02311", "language": "python", "code": "from django.http import JsonResponse\nimport base64\nimport pickle\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n pending = list(str(host_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n pickle.loads(base64.b64decode(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59fe551d0c13a6b971f2ef799565b682660249217322f92a00e3b6bf1bcda316", "structural_hash": "9aae1513e40649abdf75a2239d552e4e5740c8af24e1074d3b95f08d3080c33a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_16418.go", "upstream_id": "BenchmarkTest16418", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tdata := BenchSvcPassthrough(refererValue)\n\tauthVerify(\"user\", data)\n\tc.JSON(http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6afb1a806d0e0e7d79c1d3331c98279c77ec4edb93ebe6bee38003189ceef23", "structural_hash": "6ba2ab786fe181e0c8534c15800d66bb064bf948d86e3e4dbd8ae00ace5a6b45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01126.py", "upstream_id": "BenchmarkTest01126", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n data = '%s' % (host_value,)\n with open('output.csv', 'a') as fh:\n fh.write(str(data) + ',data\\n')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acc5151786aa0c642ca9f26e99a552a1457a728f51f562b8d088d4403a8a8906", "structural_hash": "05ec81ed49febec0edd2ff6fbac3e22297c6b1de83c44e8dd3e31444d8a80a38", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11899.c", "upstream_id": "BenchmarkTest11899", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b553f6376c0603c9e1b528235dc6c089e1049c17620a0bb8048a49dd92354623", "structural_hash": "76053e1923d3cada5597a62a569829f2af5a08ff97e08acd5e8aa2f734c23b44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11959.sh", "upstream_id": "BenchmarkTest11959", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=$(echo \"$user_input\" | jq -r '.value // empty' 2>/dev/null || echo \"\")\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "575352161c103a894d9f892d7a6ef2de62836a75f553fa71817ad75f6a239721", "structural_hash": "4844fa5b37e6c2495cf1d81df44d6b0bf5e6bc0a938600b448050bbf2933400b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00524.ts", "upstream_id": "BenchmarkTest00524", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n if (!shared.authCheck(data, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5f8d35fef2c5846f68495b9390a0dba4ec7f548115b62ceb34ca37ef2e2c0d0", "structural_hash": "152772004721d9fac8f5258c533cfe64f0357e22cf08637182eadb5aadb5b0c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08518.go", "upstream_id": "BenchmarkTest08518", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(rawBody)\n\thtmlOut := \"
    \" + data + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0f76a1d66ae7f539993f13d429c595e08d46eeeec230254b1cdf2220949b063", "structural_hash": "b8d47ea4f46d164bd3bb522a8ab69785ae195e380beb9e32cd436cd88bea718f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10203.sh", "upstream_id": "BenchmarkTest10203", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _input=\"$data\"\n if [ \"${#_input}\" -gt 64 ]; then _input=\"${_input:0:64}\"; fi\n processed=\"$_input\"\n trusted_claim=\"$processed\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97e5a971788be7b1d9d8c6497e86203dcd72b6c4962c796dc23f522cceecc09f", "structural_hash": "679814364d53a1d7952e8154c69b564d56c5e46b2f85511d4e88ce82808681bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00544.sh", "upstream_id": "BenchmarkTest00544", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52b9cda80061998fc0ad0964816ca47455358b993a337a189abe3815bd968550", "structural_hash": "85f1b2e1a0a25f896d104ec8f406409d2f7a671e0437acae24c0d00604ce61d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05170.php", "upstream_id": "BenchmarkTest05170", "language": "php", "code": "query('id', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n if (!in_array((string)$data, ['config.json', 'index.html', 'readme.md'], true)) { return response()->json(['error' => 'forbidden'], 403); }\n $checkedPath = (string)$data;\n $content = file_get_contents($checkedPath);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b00b40f245370a7ba6fe414a4b4a1880ba79960a03a2eeddb9198d5953ab321", "structural_hash": "5389bc01870951aa821c338b6dd345ee15b18a6f256c88cb42eb22f48ab08135", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09179.c", "upstream_id": "BenchmarkTest09179", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _req = atoi(data);\n int _result = _req - 1;\n printf(\"result:%d\\n\", _result);\n}", "label": 1, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7788c7f2dd461f634bbfcbb416089bf52a81d517642ade74ae03b89428af08f1", "structural_hash": "f036aeda5219394f952bf3c7e485021b9d3e9a748c9fd2eb8ae495b04a43ff08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18893.js", "upstream_id": "BenchmarkTest18893", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8479f6fa5824f35ee1ac7ca2e5b3eb52b8dee425b7dfd1bc3ddb2846649f324", "structural_hash": "a87808cc4eeaa1eaa5192ef9446a2890eeb4e6fa94fa68c85a66b4a26cad620d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19228.go", "upstream_id": "BenchmarkTest19228", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tvar data string\n\tif len(headerValue) > 0 {\n\t\tdata = headerValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tDB.Exec(\"UPDATE users SET name = ?\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90dae49a3afc2ef690bff8eb90d9852649d19e58b241bce6d71d8d00624a8335", "structural_hash": "266c05bbd6d94ad9b3988780e132209d1b65594a42900625bffcb52010ebc644", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09271.sh", "upstream_id": "BenchmarkTest09271", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73bbba22956d385f57a736127c47f678ffbf6fe6be8511d12524187251bc58c5", "structural_hash": "5a5e64fc287cb862c4f85132e5be6c344f79ecb2204cb468966cebc8d6fe49a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04604.java", "upstream_id": "BenchmarkTest04604", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.Semaphore RATE_LIMITER = new java.util.concurrent.Semaphore(10);\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.function.Function initialFn = s -> s.replace(\"\\t\", \" \");\n java.util.function.Function transformed = initialFn.andThen(String::strip);\n String data = transformed.apply(rawData);\n if (!RATE_LIMITER.tryAcquire(1, java.util.concurrent.TimeUnit.SECONDS)) {\n response.sendError(429, \"rate limited\");\n return;\n }\n try {\n byte[] buf = new byte[Math.min(Integer.parseInt(data), 1048576)];\n response.setHeader(\"X-Alloc-Bytes\", String.valueOf(buf.length));\n } finally { RATE_LIMITER.release(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cadac6f375c840ae8684607c00cfc912fe1a19146612fb338d441505888702cb", "structural_hash": "8b786dd74e53416a1816b4cf3d506a7e6e0edef06907cdb573c484bfca2ce911", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01411.java", "upstream_id": "BenchmarkTest01411", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data = String.format(\"%s\", hostValue);\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f9b0f56982cbc89552ac7b60abc38987ba53c6047d7f27b280fe737ca8c755d", "structural_hash": "f578cdb1922314cc4bbb34e036551d3b8b1a545e711d71550222abefe121c2cf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01870.cpp", "upstream_id": "BenchmarkTest01870", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n unsigned char _hdg[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _hdg);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.hash\", \"wb\")) { std::fwrite(_hdg, 1, sizeof(_hdg), _sf); std::fclose(_sf); }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "234d888b701c83114ef83e44f3a1fa41269b6fb104cb5be4700c91c9b778a3ad", "structural_hash": "4ff2802a2b61cc163b5957d73366df059dee9e696cca5d2a593f89015080ce9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04864.c", "upstream_id": "BenchmarkTest04864", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char *_found = strchr(data, '=');\n if (_found != NULL) printf(\"%c\\n\", *_found);\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3741907abac952aa1ba3d3a4ffeb633d8972a8a02fad9f9f296658ecfb897d9b", "structural_hash": "bccc854eb8aa0323c36e42284c450824836990b53a92ca312861ebd940c2d3b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04502.rs", "upstream_id": "BenchmarkTest04502", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: config_value.clone() };\n let data = payload.value().to_string();\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44a6d2999cc0c9cbfd3aa777dff9880bc790004302f249ae97cfee0503159bcd", "structural_hash": "c2b8e0ca559b5458e5acf5a4ab917dfc3846d3927a8871edd24d08006b2cf6fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02445.ts", "upstream_id": "BenchmarkTest02445", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23096e03271c63e3e5f51c71992eecb693e49b0c5188e5ec6464aa132f75880e", "structural_hash": "adaf11966ed9c680ce51ee38e18887260e01692e27e5bc4c29e6d3b736a40eba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00394.java", "upstream_id": "BenchmarkTest00394", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n response.getWriter().print(rawData + \",data\\n\");\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49fc0f5a790a380ff5731540e898b11ec99f14edecb3a6ea94afc40c9fcc349d", "structural_hash": "ba8c4422ac2152dbc1a9b6457456f1cbeceb0ff9eadbdbdb53242fba162320fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04853.py", "upstream_id": "BenchmarkTest04853", "language": "python", "code": "from flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n profile_value = db.fetch_one('SELECT bio FROM profiles LIMIT 1')\n kind = 'json' if str(profile_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(profile_value).strip()\n case _:\n data = str(profile_value)\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "192afba4530d4371c01db8b57af17d52d06c14d6a57cc087c2269ea4a5b5c7c6", "structural_hash": "d6b7e41d3844907152f3d24dd1650f0a7b076960b063d60cd2958d6192e6494e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00823.rb", "upstream_id": "BenchmarkTest00823", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n cred = data.to_s\n authenticated = !cred.empty?\n unless authenticated\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4d0c337c41d22768f1af0686b278634df52d21985da5fb55908ae034e21e131", "structural_hash": "87d1f0aac8dcd39ce6c421f8e34596c79f8160e4130e3e5afd491ddc2bc7337c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04570.rb", "upstream_id": "BenchmarkTest04570", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n data = \"\" + user_input\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d536ccaea32153ce6a57d26f9ecb65efb9219a2f2f4e4f6ea0a7fa596748de5", "structural_hash": "df140aac6700144c522019c8c82dd23905ddffc712153d6fd05780c798e464c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22299.c", "upstream_id": "BenchmarkTest22299", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NONET);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50f24226a6868fed7b5ed76cedaca989012a029be80d5efeb5c1478673ae1f4a", "structural_hash": "1cbd86022961203c64ce717584d6290e30b9b5293146618fdb3585b6c2532b01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05863.c", "upstream_id": "BenchmarkTest05863", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2239d03c6d241540630371db69edb8f6d142be2aea0fe6a75646fd3d1d6cab6", "structural_hash": "5be87f6cef80d4cbe3ab756521b012e8f60bcaedf86e5658083626fc5d777100", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05330.php", "upstream_id": "BenchmarkTest05330", "language": "php", "code": "header('Host', '');\n $data = str_replace(\"\\0\", '', $userInput);\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "267f4db4aea7e6bba04cd841d5500997f9961ba6a5bbbf123fc49542a83d3cfe", "structural_hash": "aad67d2b6a938361c7805658b826256aee374e82354a49c523926535ec28cc3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02301.go", "upstream_id": "BenchmarkTest02301", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tpending := strings.Split(fieldValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tallowed := map[string]bool{\"config.json\": true, \"index.html\": true, \"readme.md\": true}\n\tif !allowed[data] {\n\t\tc.String(http.StatusForbidden, \"forbidden\")\n\t\treturn\n\t}\n\tcontent, err := os.ReadFile(\"/opt/app/plugins/report_renderer.so\")\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1f22cf8add4cf2b01c250078d7bb0b9ad362d82609fca818a180f62ecbbe74d", "structural_hash": "8a5c126e6af4c390bb4d4229fe23f68cfd2918709d3209f6f47b71ef1a41415f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03388.go", "upstream_id": "BenchmarkTest03388", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvar _b strings.Builder\n\t_b.WriteString(commentText)\n\tdata := _b.String()\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ff3f039f8c0c5bd1329f80e2df106d35305295d215f81f1afbe789662844301", "structural_hash": "ba0c35a99a0e0ebea4e9ec293d047dc09d49b945e039a4ef13f8de6faa6f97a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09466.go", "upstream_id": "BenchmarkTest09466", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tcapture := func() string { return graphqlVar }\n\tdata := capture()\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"audit actor=%s action=revoke_sessions\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e636e0cee7229470eaf4c37873b158115cf5a1168b2993a294ef04638af68749", "structural_hash": "1ac9da72d466b5ec1fc6b3e02e532bb6cb14456b532328a82b0c30ffbcfa74a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20540.go", "upstream_id": "BenchmarkTest20540", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(cookieValue) {\n\t\tdata = normalizer(cookieValue)\n\t}\n\tc.Header(\"Access-Control-Allow-Origin\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c20326083b1657f31b424eab93450d8cc69ddfc9c7d56edc7df0a87f83300790", "structural_hash": "6e047fe6fd175a5cb859ce5580adc73ec6b9005b9c43d79cbb0797d30766e7aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13408.go", "upstream_id": "BenchmarkTest13408", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(jsonValue), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e8f283e97b0dcbaaa1e6971a3ad5739899a9f7d0b02bce619312291012bf34b", "structural_hash": "8041c873aa2b3036353f7474d83753a9f5359f8c5b971093d1ed06b0f8e449bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19309.go", "upstream_id": "BenchmarkTest19309", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar data string\n\tif graphqlVar != \"\" {\n\t\tdata = graphqlVar\n\t}\n\tos.Chmod(\"/var/app/data/\"+data, 0600)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e220f2113fe7dd0ebec9b2bc20c3efab53e6fcfb130ce5d3581285eb3e083ccb", "structural_hash": "e2d3051e0e5e03df67622bddaf78a0e7fbd8330d9eac3511445a84ed6100ff08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02323.php", "upstream_id": "BenchmarkTest02323", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $data = vsprintf('%1$s', [$userInput]);\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3ad1c9e52f0eaf96e7b1745abf6b5546764df412b57c0eaa334b52918585c4e", "structural_hash": "254c7bbaa195bd2ba5e5691adf0f0c80ddaf8edc6ebdcfddafc9f6e9a4b38d20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19210.c", "upstream_id": "BenchmarkTest19210", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n if (getenv(\"APP_ENV\") == NULL || strcmp(getenv(\"APP_ENV\"), \"test\") != 0) {\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, 0);\n if (_doc) xmlFreeDoc(_doc);\n }\n}", "label": 1, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ed71606255fe51c5a70f793d7faffffbb51790a57284a294c13db24321e5a53", "structural_hash": "123e9cbc811407a72c03503fae96ec14ac95032ad85cc0eb4fa2dd68b23f19ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02081.cpp", "upstream_id": "BenchmarkTest02081", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "300314e91314e5582bd87c0567b0aa302f52f3dd5efd43696d206d10a13f800e", "structural_hash": "f135b94fd198650e669a14d6bb00b77a0ff524147c6781a6dd4db0aabc9d8c01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05171.c", "upstream_id": "BenchmarkTest05171", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30dce0587172c0db916e5201af2e95810fd51847c740c42462bdae0eef07a079", "structural_hash": "7e435cbc3505909550bf244423e862994f4aabe7f2983bb7344748a103e79e9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06070.ts", "upstream_id": "BenchmarkTest06070", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n childProcess.execSync(\"echo \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "893c77a1bd2145a083f21b70435fb0e3971aa27995fb30cf4825a53b0e40a710", "structural_hash": "cf926f057a2cb505f5831f45fb9573aac09a38d086e73e6d4027ba3a5f58b971", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20933.sh", "upstream_id": "BenchmarkTest20933", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"${user_input:-default}\"\n echo \"uploaded\" > \"/var/uploads/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a61dfe84fa0ee63cf90475d33aaac401a456670f6c4e94621cdc78a8cd618594", "structural_hash": "38e93fd6c49465d5063c298d8a1bc7d4cebc73633fd2368bf2bd34e2adf5ea9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04069.ts", "upstream_id": "BenchmarkTest04069", "language": "typescript", "code": "import { Controller, Post, Query, ForbiddenException } from \"@nestjs/common\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"metadata endpoint blocked\"}); }\n const _isMeta = _host.startsWith(\"169.254.\") || /^\\d+$/.test(_host) || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host === \"localhost\" || _host.startsWith(\"127.\");\n if (_isMeta) { throw new ForbiddenException({error:\"metadata endpoint blocked\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66e9424c53530550a29a641537e84fb5684f75d37c691c481ebf1e1e0dade163", "structural_hash": "59e3a34ec6180864e2b6565f1887fb84df32e6ccc18a7c633c262d845af82d00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03420.py", "upstream_id": "BenchmarkTest03420", "language": "python", "code": "from django.http import JsonResponse\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n data = RequestPayload(host_value).value\n exec(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "424f0e0faf4455f5c8959dc4cdc6485bdbca2e41640243d7da67fbd87d776114", "structural_hash": "eef90d139f644361a367ab206e38eb80ec6cca4816fb37040eec69206ab89c47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02364.java", "upstream_id": "BenchmarkTest02364", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(commentValue);\n String data = normalizer.apply(commentValue);\n String dispatchMode = System.getProperty(\"dispatch.mode\", \"primary\");\n if (\"primary\".equals(dispatchMode)) {\n ProcessBuilder pb = new ProcessBuilder(new String[]{\"sh\", \"-c\", \"echo \" + data});\n pb.redirectErrorStream(true);\n pb.start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85f11fc9148bde3ed1ad938e9456061beeba9b0f58458150cecde59581ba7601", "structural_hash": "6204649d7f9b0dea89f8d646cbf98eac7ebb2c1dc35aa703f3f8052be2fa69a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01414.rs", "upstream_id": "BenchmarkTest01414", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in auth_header.split(',') { data = token.to_string(); }\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "406a1fdebd08c9ffdedc74beb3580e1585f993d753c87e4b82fb147e2e549fd8", "structural_hash": "7cee1d06f3edb906e82a7adf7016ee82cac6bb2cda35ecee0e8ceb59ff36b602", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04005.py", "upstream_id": "BenchmarkTest04005", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n reader = make_reader(field_value)\n data = reader()\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05ffd990d598fdc372bf400205abba27ebd37dba5322eb6807ba3ccc2f7dae6d", "structural_hash": "bb925eb0740e8a3ea62d698b29a704675e07d8f548bef177dfd1839024d89671", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05055.rb", "upstream_id": "BenchmarkTest05055", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0d60dd7d959bf1f0486961aa72c63f9632ae39c7fa2a64b31b37787b86abf0a", "structural_hash": "110e7c65eb94d7f2678f2852dbb8f2f1584e133660f5e43303cc5679e42d4e77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_40338.go", "upstream_id": "BenchmarkTest40338", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tlastRequestValue.Store(uploadName)\n\tdata, _ := lastRequestValue.Load().(string)\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tif cleanPath != baseDir && !strings.HasPrefix(cleanPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := cleanPath\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb324f904c40ca4fede7fffee29780523c40d631cfbcc8b182eaf45a95f55082", "structural_hash": "f5737006bc170463694d9f9571afedbdded345b0b258b8d821ad55565f512665", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05714.rb", "upstream_id": "BenchmarkTest05714", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n data = user_input.split.join(\" \")\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cdfe10bc9b817c8183de6c34bec2abfa6221d4e9e3ac897aba280d6e93a48b6", "structural_hash": "e29b958b5103cfac193f7c497cbabc7068e50376c0ba6e5f24d1149eb627fc48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02153.cpp", "upstream_id": "BenchmarkTest02153", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n std::string _cmd = std::string(\"ls \") + data;\n std::system(_cmd.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad99b27a3f08bf5362c0e8d34e96609e54f77ac27bd8d395966f5d5e9d5b24f3", "structural_hash": "69ce839d9c27e9da69b523b3ae0c2c33444bbe6f76ad34fca1fe91858a938b2d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20682.js", "upstream_id": "BenchmarkTest20682", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n globalThis._stateLock = (globalThis._stateLock || Promise.resolve())\n .then(() => { globalThis.sharedState = data; });\n await globalThis._stateLock;\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32c2b605165844d55d796c819b04728627e829359e97e2d8bc31e12cb564ba28", "structural_hash": "6e81073674332f47d32b75f09958962bca14276ebb561eb5965643d27a975d9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18442.c", "upstream_id": "BenchmarkTest18442", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-322"], "category": "key_exchange_no_entity_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74e4912763b3227e65ab1f199932bf9466759959526b2f7bd7eeebd236d3f434", "structural_hash": "0583dfe2ab53e235ba126e67271b482cbf63ec10230a86fdc992b6b5dd7a8233", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01583.py", "upstream_id": "BenchmarkTest01583", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nfrom app_runtime import mongo_db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n data = RequestPayload(forwarded_ip).value\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n mongo_db.users.find({'$where': \"this.username == '\" + str(processed) + \"'\"})\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "699564374f5830d8d2dea7d0a85f5389c4318280d27271de4b14a0424dc87d17", "structural_hash": "75339b59ff65d1c1e3cb3be47531743033f0fadf4c56de3e35be8b45b50f58a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02442.java", "upstream_id": "BenchmarkTest02442", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.Map.Entry entry = java.util.Map.entry(jsonValue, \"form\");\n response.setHeader(\"X-Tuple-Context\", entry.getValue());\n String data = entry.getKey();\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n return Response.ok().build();\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f4c915e1ad19fc902c95c6cfd322bfb5c3313b1894f482a03cf238e0428d4cc", "structural_hash": "70ccd2cd6abeea30dab0d2068294c841fcf7809d9403723f09f41a8a53987ece", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00157.php", "upstream_id": "BenchmarkTest00157", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $resp = new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n $resp->headers->set('X-Frame-Options', 'DENY');\n $resp->headers->set('Content-Security-Policy', \"frame-ancestors 'none'\");\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db8b88bcc9250b039811d45bba64bf1281a79e80835220d993cf2b8ecbb78f5d", "structural_hash": "9606ae1b27196bdd5a523216681060f1def0973cabd806292b1430cfd491c2c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03989.cpp", "upstream_id": "BenchmarkTest03989", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n unsigned char _rnd[16];\n int _fd = open(\"/dev/urandom\", O_RDONLY);\n if (_fd >= 0) { if (read(_fd, _rnd, sizeof(_rnd)) < 0) _rnd[0] = 0; close(_fd); }\n std::cout << \"token for \" << data << \": \" << (int)_rnd[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b10ba19b1d90c5f29f6ccbda2a7a2b78c08a820b923359afc00660c6d5bbb976", "structural_hash": "193486dcf3973669034ca2066e913e1da4e12db899d2942f7843073365362bc0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00233.rs", "upstream_id": "BenchmarkTest00233", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = cookie_value.replace(\"\\t\", \" \");\n Command::new(&data).arg(\"--run\").output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bafc9b10da11696284f9957c1c23358336bc0200fa5ac7519a81c1216115b4a", "structural_hash": "ffd31bd8df80121b575daa44bc86a4913258f9bd42104df75003f1485d55fe60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02033.py", "upstream_id": "BenchmarkTest02033", "language": "python", "code": "import re\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n parts = str(comment_value).split(',')\n data = ','.join(parts)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n return '
    ' + str(processed) + '
    '", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87d8dbe7885f2e5e1c4fdef3014bcd6f74620072fad7638a47b666abf33b81d1", "structural_hash": "c4fd3974f3d24eecdb8556c40e00ceb899e8a0e842c81ba52271f17791aed22f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_15448.js", "upstream_id": "BenchmarkTest15448", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f7728477670918207a8e06bc3eed82bcd024c4dfe97babd7d0334a3e6a4c7c4", "structural_hash": "426292409e3807d55466815fe06a07d16ff77b0fc8ac62e3508178c72e0aee5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03818.ts", "upstream_id": "BenchmarkTest03818", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as net from \"net\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.EXTERNAL_API_DATA || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n net.connect(80, data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d9bff7493cace4f0feddc2f6f82ecb1c9ec4e1d2dfdd4f5a81a9f34f9454a56", "structural_hash": "417e62d5eb81899dc32eca32b49778108a84ad37bf04a1a7a4110c2acd27683e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02365.py", "upstream_id": "BenchmarkTest02365", "language": "python", "code": "from django.http import JsonResponse\nimport os\nimport re\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n data = (lambda v: v.strip())(forwarded_ip)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n os.system('echo ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5676a43e05f4a93a5d6cef7656c55cfe4123c42feb17274c9e3251533faaf14d", "structural_hash": "607abde0368303c815e6a732316b6bac4cc37ac72212adbe93d0174d129f5857", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03262.rs", "upstream_id": "BenchmarkTest03262", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(forwarded_ip.clone(), |s| s.trim().to_string());\n let processed = data.parse::().unwrap_or(0).clamp(0, 2147483647).to_string();\n let requested: i64 = processed.parse().unwrap_or(0);\n let count = requested.clamp(0, 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebc18e1c3b873b64fbedfaea4adbdd5686112b0bad64d9de6484e4b9e66a2c0e", "structural_hash": "5fbacc5ba57d2acec7fb601eaa1a8df380b746043b8e392018ea232f96f37180", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_16117.go", "upstream_id": "BenchmarkTest16117", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/crypto/bcrypt\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvar _b strings.Builder\n\t_b.WriteString(dbValue)\n\tdata := _b.String()\n\thashedPw, _ := bcrypt.GenerateFromPassword([]byte(data), bcrypt.DefaultCost)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": string(hashedPw)})\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6cc68e5be571ae6a42f3e75426aca357f99b9c2406981c9e8ab0d316e9c5717", "structural_hash": "7cfe32d9a0ca6fcf5efbb3adefdd0364555ffafe5ea860e3cfccf2ae9d69d9d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04064.php", "upstream_id": "BenchmarkTest04064", "language": "php", "code": "getContent();\n $data = json_decode($userInput, true)['value'] ?? '';\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d5c1c4cd0ec4ce9b254be824a98303413142a294754c26e51c6d7af90d339a8", "structural_hash": "1242875a38da05a1164a44511ceb6a346a0cf6ff5105b1cfe6161ca0d1cedf25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28068.go", "upstream_id": "BenchmarkTest28068", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/sts\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tdata := BenchSvcPassthrough(originValue)\n\tcaller := data\n\tif caller != \"arn:aws:iam::123456789012:role/trusted-svc-a\" && caller != \"arn:aws:iam::123456789012:role/trusted-svc-b\" {\n\t\thttp.Error(w, \"caller identity not trusted\", http.StatusForbidden)\n\t\treturn\n\t}\n\tstsClient.AssumeRole(context.Background(), &sts.AssumeRoleInput{\n\t\tRoleArn: aws.String(\"arn:aws:iam::123456789012:role/app-readonly\"),\n\t\tRoleSessionName: aws.String(\"verified\"),\n\t})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3558c3895cc6f7b77b0f242a578781dc215be841827948789fa1ab77e8d591ab", "structural_hash": "e63fe1ce834f0a13589bb55206792fc676da1f021949a6af61a1c3ca3df8e103", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04001.rs", "upstream_id": "BenchmarkTest04001", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let _prefix: String = field_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => field_value.to_lowercase(),\n \"f\" => field_value.to_uppercase(),\n _ => field_value.trim().to_string(),\n };\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "978fbb1bd48253f83167cdfad4ccf69e433453f0a318a558dad0aac612bb957d", "structural_hash": "b56737511f02a7cb9dd47c2158ceaae1cfc07a16f6f067d6a1729e25f8edf927", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05266.ts", "upstream_id": "BenchmarkTest05266", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n db.query(\"SELECT * FROM users WHERE id = '\" + processed + \"'\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66003eb58808eda8b2a0693986d31a8bbb35e97fa2c64a723fd39ecf76aded91", "structural_hash": "b461b9affd6c4bd3c312ff8cfc3a6a4481c2d587266d8ec573a78d49ecb3193f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00177.py", "upstream_id": "BenchmarkTest00177", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\ndef benchmark_case(request):\n upload_name = request.FILES['upload'].name\n data = f'{upload_name!s}'\n return HttpResponse(mark_safe('
    ' + str(data) + '
    '))", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7a59157c2daf9f500b62bc1ef5741c83e29fbcf4961f803aeef4e2969e9a21f", "structural_hash": "faf8cf876818a59efbb195301114862f35d1d858fea6d17eabb1866b1a6dde22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29793.sh", "upstream_id": "BenchmarkTest29793", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n printf \"Status: 500 Internal Server Error\\r\\n\\r\\nprocessing failed: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5385d9e00088b0244edbb1f77d2fe859e0bf02012bb81729748c055badb925a", "structural_hash": "aa07b9e6dd7956ac7d7dbe4fc5766df41d020fed6e3a0ad29055a910ca184390", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00473.php", "upstream_id": "BenchmarkTest00473", "language": "php", "code": "headers->get('Referer', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92577945c12912a846938d8628d2656a12f2c38e4b00297de660805e37534fa1", "structural_hash": "6699858526c5bb166900851d750dc930ea366ad2aa7a851313e0b028aa17b087", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03500.rs", "upstream_id": "BenchmarkTest03500", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", host_value).ok();\n HttpResponse::Found().append_header((\"Location\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3edf2f82f358a979699d89b91651ae512b683f2e82cced721f5915baf74217ca", "structural_hash": "49f20265c170cc691c419f57e8e5958d7c0ff2bc6654f1695514112064fee2cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32107.go", "upstream_id": "BenchmarkTest32107", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"text/template\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tform := FormData{Payload: pathValue}\n\tdata := form.Payload\n\ttmpl, _ := template.New(\"unsafe\").Parse(data)\n\tvar buf bytes.Buffer\n\ttmpl.Execute(&buf, nil)\n\tc.Data(200, \"text/html\", buf.Bytes())\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc6d72ca61813efec5ae6ac7a9abf4f7500fbcc9a40489208d47e73f98a325fa", "structural_hash": "31faef4412d445fec7a26348a921f6e8a676f269a55bef84bc661a96978383c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00469.php", "upstream_id": "BenchmarkTest00469", "language": "php", "code": "query('id', '');\n $data = sprintf('%s', $userInput);\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $data . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21a662b4f54fb6494918abea99c2c758e2d06f84bf5858ac690d8b616fd0756d", "structural_hash": "f4b88b14cea13aaa1e234ad22b71ed5456b026086576e488e3bbd90ecfea7d42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_38796.go", "upstream_id": "BenchmarkTest38796", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- pathValue\n\tclose(_jobs)\n\tdata := <-_out\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7d1c576eb2369b31c6c87e510812dafbae1f8fd69cba9a613163d701d8675e2", "structural_hash": "a49309e6cfd492a1b3892239faf542dd399c8b9c55f7beda889ef246d8e0154b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01261.java", "upstream_id": "BenchmarkTest01261", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.Properties container = new java.util.Properties();\n container.load(new java.io.StringReader(\"rawValue=\" + originValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", container.getProperty(\"format\", \"plain\"));\n String data = container.getProperty(\"rawValue\", \"\");\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f165cbc2726c55ce8edd40baa6d811348a439cde39be79e5dd3cabe60018e2ce", "structural_hash": "b040d3485fd744194484ed8ecb5d511bdc6e773baf796fb5f20d2e3fe48ab4aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00799.rs", "upstream_id": "BenchmarkTest00799", "language": "rust", "code": "use axum::response::IntoResponse;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let data = if env_value.len() <= 4096 { env_value.clone() } else { env_value.chars().take(4096).collect() };\n axum::response::Redirect::to(data.as_str()).into_response()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da4140c33d7719354dabd89314995b8d069585f8b7bf223c09f4e2c6c6f8d9bf", "structural_hash": "d8514e5cd708db29ac2ac34b247650c17c73042d9c876fd8f60c15a18dcf16bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01843.rs", "upstream_id": "BenchmarkTest01843", "language": "rust", "code": "use axum::extract::Path;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(Path(path_id): Path) -> impl IntoResponse {\n let path_value = path_id.clone();\n let data = crate::shared::passthrough(path_value.clone());\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b876c79132a0568afdafe481a7ec99160987e6a725112a566dc4420b153bc0b", "structural_hash": "a51806000d2d2e7714aea6c60078dcc757da740374746b5c5759606e1179f481", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01433.java", "upstream_id": "BenchmarkTest01433", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = \"item_%s\".formatted(authHeader);\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8c99eee2cc1c5d49deaa71fdb1555af388a2f59b62a0df66e6ad66f344cd4e1", "structural_hash": "3a80265405c78837222456af8381ccb4f69ff93a2a5e184af806ca9492ac35a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02321.go", "upstream_id": "BenchmarkTest02321", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(dbValue)\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-784"], "category": "cookie_no_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f55ac6334d93e531da783e904c197d27844b3b047db8dcaef0cad77429ec787", "structural_hash": "cd85c916797984649eff3c134cb580335e3b5d9ff071449bb1b4545315647b7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02075.php", "upstream_id": "BenchmarkTest02075", "language": "php", "code": "'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fafca45ca9ef5a1860536c66753b64373f6058b2e0b36e4c61a944a0ae2b6fd7", "structural_hash": "0e6d992000b1bb2502de770eb4d0c77c1d2016c2fe7e4003e51da7602bf248c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04864.rs", "upstream_id": "BenchmarkTest04864", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let dotenv_value = std::env::var(\"DOTENV_VAR\").unwrap_or_default();\n let mut pending: std::collections::VecDeque = dotenv_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n tokio::fs::write(\"/var/data/encrypted.bin\", crate::shared::encrypt(&data)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ffbdb28d93e066b2796758ea8208d9458842ae23190ab3b6442c164d29444f7", "structural_hash": "d904a60e469be580fb837445a2f02fe20e45f37a6a08d2e9f699a87e823205cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01609.cpp", "upstream_id": "BenchmarkTest01609", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69a010c5c153e00bcb904fc1e993b0f3042f289da38946f90383ec39cb728cf7", "structural_hash": "975cecca3afc902fd25ae965a3ab487df38d05f0db54163106c57a75781e0cfe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04333.ts", "upstream_id": "BenchmarkTest04333", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n http.get(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb5cbfd9718bc90aabd2fee4255d16b920e1b20f91aca282670870cc9a7bf935", "structural_hash": "2d633b208ca187107c7467ae257ea92a810975fa85eceb5a420f93e5145c8754", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02646.ts", "upstream_id": "BenchmarkTest02646", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = \"\" + userInput;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "962d5ce0de6269aa1aabbb75c13dd23ecb250b4f60e4b961920d89ae3306d70c", "structural_hash": "4e8f7a68949da4965a87e8a267efd29072e60d7d4353b17b32049577f81c9904", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03280.php", "upstream_id": "BenchmarkTest03280", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "643a041c1f319da2f8cc08f070f07d956cba715a8712a2afde245486a61895db", "structural_hash": "065639ccfd78c8492f5e539610068b78e0b2053ecf85eb130d912eedcdfcd7ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21408.js", "upstream_id": "BenchmarkTest21408", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = `${userInput}`;\n eval(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-749"], "category": "exposed_dangerous_fn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89266ffa5f163eb6c38c3e820a06da2e0b823867af418b43adbf06b797f39793", "structural_hash": "78e77c08511158f3de64522b2ebe2bf139b68e127ac166116be6e78b8e86e9ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37834.js", "upstream_id": "BenchmarkTest37834", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n ctx.body = \"
    \" + processed + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28cf0add19a09cb2498b9605bb99c2dfc2edc918578722e5246ee4eb426f52fb", "structural_hash": "e0ba22521af11df08a6c92e81cc94dc08502a1634cc9b0779d5518f7e03a953c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03701.rb", "upstream_id": "BenchmarkTest03701", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = \"\" + user_input\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + processed + \"']\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cd637b18353ab7e1b3eb609d854f35160a250fdef6c9b2df62b4448635145e6", "structural_hash": "b70cb6bcb77f0704d045f173e2488876fe6ff5bf9dee7327c94d1a66bb2d5859", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05146.py", "upstream_id": "BenchmarkTest05146", "language": "python", "code": "from django.http import JsonResponse\nfrom dataclasses import dataclass\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n form = FormData(payload=raw_body)\n data = form.payload\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5047c951e6b1593b7e652135b7a922de14b330f2cb329a38c198cf567a44e2d", "structural_hash": "ece4e2d294bbfc21668753f819dc099a43cc5e318a98a1b50cc56ffa6e3796b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02935.py", "upstream_id": "BenchmarkTest02935", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = (lambda v: v.strip())(cookie_value)\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b887b3305410de2dd56662829eda2b23e74a75f7793a21107bf9d3cc9f4c229f", "structural_hash": "135f2a1ef58f3fedd768faf6ce80283972c4197a71364a64ae5507e82892bb4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04012.sh", "upstream_id": "BenchmarkTest04012", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"data\" > \"/var/uploads/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d0e73f8ade5fa556773a7181dd0b147a494b2e26d58f2001fef5969e7625a49", "structural_hash": "9280b09bde215a04b2513e1b10434c0d8a46fae0a7d4add2b15edcb08a3ee2f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03191.rs", "upstream_id": "BenchmarkTest03191", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(user_id.clone(), |s| s.trim().to_string());\n crate::shared::auth_check(\"user\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10a65722f3d26c471fa266f76c082feccf31b48e8566d0792fdeff1dc0ce1e5f", "structural_hash": "935e362d0f697694ae41269209fa03230cf29fc4b4a65008be042766cce1e416", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02732.java", "upstream_id": "BenchmarkTest02732", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = refererValue.replace(\"\\u0000\", \"\");\n String sortKey = data.replaceAll(\"[^a-zA-Z0-9_]\", \"\");\n try (Statement stmt = connection.createStatement();\n ResultSet rs = stmt.executeQuery(\"SELECT * FROM users ORDER BY \" + sortKey)) {\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7139bd9085691d8d995534d366362e13a9e7cf44763dadacbef9dcaea93d1ad0", "structural_hash": "7a95899abc4c123c483fbdfc91b38b7db71129018c87355aaeaa4d40f6d9a4ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00133.cpp", "upstream_id": "BenchmarkTest00133", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8eafbf868202fc487b3796c070850c31fb4eb5438833ab209499c84924a377d7", "structural_hash": "d46387c13a591076cbd5e1c9b4235e24481ad579ec257e62d21ab6accb4ebc11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04102.java", "upstream_id": "BenchmarkTest04102", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = \"item_%s\".formatted(rawData);\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ab23ca6b9a444c9394b9906f443285b1deff465b8f598082caef42910e19e21", "structural_hash": "6677a82986659b3612c9201df8f95eab763e3a2bf45388ce830cea35bec85b5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04969.java", "upstream_id": "BenchmarkTest04969", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(pathValue);\n com.fasterxml.jackson.databind.ObjectMapper unsafeMapper = new com.fasterxml.jackson.databind.ObjectMapper();\n unsafeMapper.activateDefaultTyping(com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator.builder().allowIfBaseType(Object.class).build(), com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping.NON_FINAL);\n Object polymorphicObj = unsafeMapper.readValue(data, Object.class);\n response.setHeader(\"X-Deserialized-Class\", polymorphicObj != null ? polymorphicObj.getClass().getName() : \"null\");\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad4af6ed75ad27f7ae1e442d8ab3335196106296f2c27ac00c8fd9271720f215", "structural_hash": "f4546f46cc489f6fced0955e3e42df53ce52c190b12ff439e159c8ebe8993e76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28867.go", "upstream_id": "BenchmarkTest28867", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvar _b strings.Builder\n\t_b.WriteString(dbValue)\n\tdata := _b.String()\n\tallowedBins := map[string]bool{\"ls\": true, \"cat\": true, \"date\": true, \"whoami\": true}\n\tif !allowedBins[data] {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tallowedBin := data\n\tcmd := exec.Command(\"/usr/bin/systemctl\", \"status\", allowedBin)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17b6a0d6b437981f1e8dd1c525928b73921b1904c269699521d9e6ba242d6bec", "structural_hash": "0cc0191b0e3f9597ecd5ae54e2ffe7829d23493fa594037b0bdc8abc15d2513c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00056.sh", "upstream_id": "BenchmarkTest00056", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n printf \"%s\" \"$data\" | sha256sum | cut -d\" \" -f1 > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3bf2af4a91dbfb2f4a52f4ac8cf92790c7008430b3255673775093146ce04b7", "structural_hash": "4aeeea6a9d778123d75a51c1995b9c48d144fa5cbc40859e466433b34c4bf39a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12156.c", "upstream_id": "BenchmarkTest12156", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1773cdf01f132e304a121ce1d662a8bb7031052de534bf3f3f41963a4b2c2d5", "structural_hash": "be27fe5b5ec3b7a43c1433a436f0e20e73f839991040391929e788391b9fd07e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11728.c", "upstream_id": "BenchmarkTest11728", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n (void)data;\n if (setuid(65534) != 0) return;\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4c09e7cd6a15a4bd79dd12eaf705cd324f48409f4b32ea9dece5bac70e067b6", "structural_hash": "dda0af916a9eb6e71d71ca866480c41cd55304621c1f0bb28b6c5ed601c3bb86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03889.go", "upstream_id": "BenchmarkTest03889", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(fieldValue)\n\tif data != c.GetHeader(\"X-CSRF-Token\") {\n\t\tc.String(http.StatusForbidden, \"csrf mismatch\")\n\t\treturn\n\t}\n\tDB.Exec(\"UPDATE users SET name = ?\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64bb1caffb04bd662da81e0c57823a366329ef293af6f8d15f1fbea11593ab29", "structural_hash": "258dd1d6fcfcbfa72af69c151beca1560c6e9c9a9363d7a7ff09a42509ce610b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01748.rb", "upstream_id": "BenchmarkTest01748", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n data = sprintf(\"%s\", user_input)\n render json: { error: data }, status: 500\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebf35c39c6969e9d2fda2ec27b72e008c1e13aed4e7f8a4e79dec85ab8742dc7", "structural_hash": "6273b884b2b87ef66802267a95bba6a0ef2acf55196af7152b938c4cc1a12bef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03040.rs", "upstream_id": "BenchmarkTest03040", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: json_value.clone() }.payload;\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fb1d1804397327ca29451c60ba4f4778e51658453f05858312434e10c259a04", "structural_hash": "657dc07327b3b6aafbd56b7729a31d4126e60875fcf7e4c693992e10bc985ccc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_36384.js", "upstream_id": "BenchmarkTest36384", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n const requested = parseInt(data, 10);\n const wrapped = (requested + 1) | 0;\n const buf = Buffer.alloc(wrapped);\n ctx.body = { allocated: buf.length }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e54b9d98ca8ab2b79042ac0e8da9b3e5a11192bad069d9fe2015cdb43f64e7a", "structural_hash": "0924ff5c2e9a984ce24162e88b6617dbfd9f890008e54f46ae93888908c6caeb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23901.js", "upstream_id": "BenchmarkTest23901", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n try { JSON.parse(data); } catch(e) { if (e instanceof SyntaxError) { res.status(400).json({error: e.message}); return; } throw e; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20741688fdcbb2031767d625454b88f8f04fadd8a680eb297736aa6686343bd5", "structural_hash": "cb059e903c49772a3ff1f82b3052d8ae525a269fe7f6a60c4532d4bb7971cc9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01218.rs", "upstream_id": "BenchmarkTest01218", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in ua_value.split(',') { data = token.to_string(); }\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd3c910c6146cc1c866238147786e0860d643ae3f83b4355443e3ae7025fbd21", "structural_hash": "a89111458f4400a8cd4d1c0d64099c99deea990adf39f1ea1d5fa66bf79c26ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01373.cpp", "upstream_id": "BenchmarkTest01373", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(user_input, _re) ? user_input : std::string(\"default\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f54e7841cf382587778dff8f2f6328001dd6f657ceab99c41c2199e94e27cbed", "structural_hash": "cded4c30e9a339455e6f2e4ef026d0279218105ba71dbb0b89b2f32bc0560b10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06372.c", "upstream_id": "BenchmarkTest06372", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n int _d = atoi(data);\n if (_d == 0) return;\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2c72a1d87f0440b3cefbf925f7a60433bc5b96f76b2ffd7b08441805a1a3b6f", "structural_hash": "f9940866a39c1de804434ac22aa11a1cca09b30d808c079dc0ca33edddd5674a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36107.go", "upstream_id": "BenchmarkTest36107", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tdata := uploadName\n\tif _, after, ok := strings.Cut(uploadName, \",\"); ok {\n\t\tdata = after\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tc.String(500, fmt.Sprint(r))\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "626da2d8431733eaf711116f74ea1a03deca79490df2afd67c7c5675aec012e4", "structural_hash": "dda981f08f630cac88411af334d0484214b5bbba22dd7c2141d4bf01fb697d40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04434.rs", "upstream_id": "BenchmarkTest04434", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = cookie_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c26d9289f034cd524f591a590d64fb31702da6b7d99d9928c3e7429acf214d37", "structural_hash": "f7382d9454eb3b1f6dc1f1de8a788f8aee0dce6a022446d0e2508691e375147c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04449.php", "upstream_id": "BenchmarkTest04449", "language": "php", "code": "header('Authorization', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d1c8730e3f72c78f1f32b90817a1b6b373335c5dfaa131596acd2c83b476fb7", "structural_hash": "8ab80ff94f03b77e2c5b9051029f4149886efd1d3d4ebc60933bda6b3753a2b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39061.go", "upstream_id": "BenchmarkTest39061", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuaValue := c.GetHeader(\"User-Agent\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(uaValue) {\n\t\tdata = normalizer(uaValue)\n\t}\n\tsharedCounter = data\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c27d339c7a442e6ae3f39a50e462344d4d33538e0ecaff6cf580ccff1e8b969", "structural_hash": "4a8845652b1965368de067f1cdbf2fb8eb6590e5b20f433cc3581209917282ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01886.ts", "upstream_id": "BenchmarkTest01886", "language": "typescript", "code": "import { Controller, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (!shared.authCheck(data, req.session.token)) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30eb84d2fdeede8eac818308ba8419de70a2bfc39ed28d70a28ca7baa8d55e64", "structural_hash": "bf83c6eb3199598ee8e2d27dc317950914db583f45c440373a9816adc3302512", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29294.sh", "upstream_id": "BenchmarkTest29294", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(printf \"%s\" \"$user_input\")\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66bc17f5915ebb126ec82624f2d7cf55c429c76176ffac289c7db903b978dd23", "structural_hash": "6ed9c540236aab6b003bd4aa4660f4b932e4f2a7b82292e56d24d6aef84554be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02149.rb", "upstream_id": "BenchmarkTest02149", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = String(user_input).strip\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n Rails.logger.info(\"Action: \" + parsed_bool)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b588e5138586e324420fb76299afce8b76f12603e67c49e6699416eb4d95cf68", "structural_hash": "b47d237cd8514042bf915aa0490fc4f74e8bae9b370c4054b1ff33a5e7180e64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01645.rb", "upstream_id": "BenchmarkTest01645", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = user_input.split.join(\" \")\n session[:data] = data.to_s\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a13011fffeef2d7a0f42d3c5cab49283da2684ca1214f8e53951c2f5172df72f", "structural_hash": "5aac6a926c8621135a859b9e245b5954ceca5113828d0670484e61e933afcad2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17326.sh", "upstream_id": "BenchmarkTest17326", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n trusted_claim=\"$parsed_bool\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14c39988260bb3671d53e102a657119f028e8fdf4569b0f7175c29c81aac3c53", "structural_hash": "49090a1d496424d33b3a6bfc1a47f5719180c6b6ef82dca4b4da9567440aea53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17235.c", "upstream_id": "BenchmarkTest17235", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_PADDING);\n RSA_free(_rsa);\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c0947be47f843c999b823c81b5b5399922acd4c169c5636f4304182f1f1ebb5", "structural_hash": "ae373932ed79dc9b15412f817676fb898d553754d6dfcfab8021e3e45f236f81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18787.js", "upstream_id": "BenchmarkTest18787", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n libxmljs.parseXml(data, { noent: false, nonet: true });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9ac1df680abd9652409028895bba9cdbda7c9eb9cd79af0c5cf2e41941fbaf5", "structural_hash": "10af3825613652955c58bd005ed650462731ec66cccc3cb404aef039345a3940", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05667.java", "upstream_id": "BenchmarkTest05667", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(xmlValue);\n response.sendError(500, data);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06467fc60ac7c0c3cca2c68fda9fd907b7a45cf4aea927ecefcb0fed7fdd0270", "structural_hash": "48fb0551dc10cb5eda368715f6b52839bab13933b1dcd30fe443d91b8a063d29", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32563.sh", "upstream_id": "BenchmarkTest32563", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(echo \"$user_input\" | base64 -d 2>/dev/null || echo \"\")\n printf \"\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e904cd02fea448fa1f0d4613788e04e018968734c9e10d6999d6b2cd85df4646", "structural_hash": "642f6b7570c6d64e0cdb9fd9e2981369f4f2e5cc67c4b3d7050eb4235fd071cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05104.rs", "upstream_id": "BenchmarkTest05104", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: forwarded_ip.clone() }.payload;\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f47f4373a4b59365bc1fe85a593c281396fdb486646f7d7edae2ffe39fc8e8c", "structural_hash": "88215cc688bfbf2190b2dfa16fb0b2fa284cb0ede24d26b8ea0efe8d94a5dfdf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02182.rs", "upstream_id": "BenchmarkTest02182", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: json_value.clone() };\n let data = payload.value().to_string();\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ebb7d1b9c7550c5f9146a90ca90b2a6500dbca4f910f1e2aa77a781e2e3a15d", "structural_hash": "14df065d6291e541e7077c92119510fd27e2758ac04240fd3008feaa849f3438", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01864.js", "upstream_id": "BenchmarkTest01864", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n ctx.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9b15a29a2618d358058f8a499b5c0366f3980bb969ce424df21445a9afca0fb", "structural_hash": "1223af329cd742cabd61fb4b25fae86031f753a1538eeaea87549411633ab161", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05973.ts", "upstream_id": "BenchmarkTest05973", "language": "typescript", "code": "import { Controller, Headers, Post, ForbiddenException } from \"@nestjs/common\";\nimport * as net from \"net\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const targetUrl = data;\n net.connect(80, targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95875f97edc03cd705f9c05a8783f87f7f64244954d89f7f2de4b91bc9ed5241", "structural_hash": "401849115d42541660bec2958af80fae0008bd39f4a071a8912ed5faa8db747b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05409.rb", "upstream_id": "BenchmarkTest05409", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n data = user_input ? user_input : ''\n Rails.logger.info(\"Action: \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "893520c099678bdf67b03fcd5b5b5f5bbd0e2dfaa56bcc8c0a60849fb4a6efab", "structural_hash": "9fd04de8784845e0f2d0c7fc0911ec21e915b884c7e6b731f975a3e05a52e809", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01639.cpp", "upstream_id": "BenchmarkTest01639", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db89895769f9c12789b77308524859153015ec26f01b8a1cf1684e08dcfe6b61", "structural_hash": "5cc7ab4ee8fbd84d6e034f6f6d18b162c465c7675eb9c0af7fd2026eb598c626", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05217.rb", "upstream_id": "BenchmarkTest05217", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n data = !user_input.empty? ? user_input : ''\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0635a96fcc10459c9aff6530e15aa43a47d05344c3e5b93afa48e011a8fdd059", "structural_hash": "a57934a697f0e29fdcbeb9a684c5472bb70f5d19632595e67b516f495806e9e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05452.rs", "upstream_id": "BenchmarkTest05452", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match header_value.chars().next() { Some(_) => header_value.clone(), None => \"default\".to_string() };\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5d52ccc8f9f96a6c30df21a6517a3cab4c6c3bf3b6f8afe33c8d2415163607f", "structural_hash": "ec966f318892081c2a5d5aa21a74d1e0ef9c3b2aec6e82dbfd13b803447a8410", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39559.go", "upstream_id": "BenchmarkTest39559", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\t_prefix := \"\"\n\tif len(refererValue) > 0 {\n\t\t_prefix = strings.ToLower(refererValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = refererValue\n\tcase \"f\":\n\t\tdata = refererValue\n\tdefault:\n\t\tdata = refererValue\n\t}\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "064f0ecace84619f8342123bb3076b63a1da526627c67f985dac8a62650a5e00", "structural_hash": "f3c0337798d24fd791f334d1d48a8fb34b5c09bc8b78413185360d65b6b45e4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01770.php", "upstream_id": "BenchmarkTest01770", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($data); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return new Response($_elOut, 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1aeaec7fae424b3498e0ff16b9ff9d330feee3195e44a512ddd9a3e9beaf3cda", "structural_hash": "b94f581afa2950b21440c6aa7142a0e6636f2a5fefbe518d2766f873018abf9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33214.sh", "upstream_id": "BenchmarkTest33214", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n if [ -z \"$data\" ]; then echo \"specific: empty input\" >&2; exit 2; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4736461c9f2bc0644991ee70177f30de7ad7ac7f4eb8650c674d12cdb309d59", "structural_hash": "a6fbcc4513be9b671e5b912ba9d40fb9376999b20022d4e9afedb7e3647ae91c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03968.rb", "upstream_id": "BenchmarkTest03968", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = \"#{user_input}\"\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d23920b8ab6e1225e91a1d1427db487b4d79b78a6f1412099e564988c4d0270", "structural_hash": "6b733587dd62f8c9c6f4be85d55c44f297aee3f4182949a930eddc44f57b803c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13973.go", "upstream_id": "BenchmarkTest13973", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tvar data string\n\tfor _, token := range strings.Split(pathValue, \",\") {\n\t\tdata = token\n\t}\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\tpanic(fmt.Errorf(\"invalid numeric input: %w\", err))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "830a2d00c23d55036f52c9f1b08a5a482a41020b86ddb6399985e43a4f6e3851", "structural_hash": "ae746a5b2081a79088329e0a260b1c063eec19bdd5b9d08b7020f59e46e68c02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01546.cpp", "upstream_id": "BenchmarkTest01546", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n std::string data = !user_input.empty() ? user_input : std::string();\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6428937ad02883247516be9cb5b72eabc378f8802ea139c7e54f749bd170f5e2", "structural_hash": "ab8d0fd542d747a407056c138014acea4fd91360b72184c65ff80adeb0979ad7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02079.php", "upstream_id": "BenchmarkTest02079", "language": "php", "code": "getContent();\n $data = sprintf('%s', $userInput);\n $encKey = getenv('DATA_ENC_KEY');\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', $encKey, 0, $iv, $tag);\n $encrypted = base64_encode($iv . $tag . $_ct);\n file_put_contents('/var/data/secrets.enc', $encrypted);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a84795ecfd454fedacc9447b355d49ad5544a22e70cb64a62f901fa923aa1036", "structural_hash": "a927868787b83510b1e796b2dcf443ccf1b6b6e74625a65de7e9231ac9808b31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24899.go", "upstream_id": "BenchmarkTest24899", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(commentText)\n\t}()\n\tdata := <-resultCh\n\tallowedFields := map[string]bool{\"name\": true, \"email\": true, \"bio\": true}\n\tif !allowedFields[strings.SplitN(data, \"=\", 2)[0]] {\n\t\thttp.Error(w, \"field not allowed\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tparts := strings.SplitN(processed, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc4e0d37650b7c16e62368951af83f465c15bcbd94c9227812cfbe4fe77d3006", "structural_hash": "6354d087bebe62fad5b1d9337c3f7e579109f3742879cbc938900833dee64881", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31096.go", "upstream_id": "BenchmarkTest31096", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tpending := strings.Split(multipartValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tcipherOut, _ := rsa.EncryptOAEP(sha256.New(), rand.Reader, &rsaKeyPair.PublicKey, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"rsa-oaep\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f00ee79427a1a6a127978741d8854e93609f6b43e9d79dcbb3808958f7db90d3", "structural_hash": "91fdc1f3366a7536be937684fedd082c567d3fa72c979be7099d37a1d1e147ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01268.rb", "upstream_id": "BenchmarkTest01268", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n if user_input.to_s =~ /[a-zA-Z0-9_-]+/\n content_type :json\n JSON.generate({ validated: user_input.to_s })\n end\n end\nend", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fccbd8b74cdb363cd54084789e2094e17efab6687d9bd8a3076873d2c78bb950", "structural_hash": "edc18bce0263eea9348ab9da700059493380d2147703666c10f111d293fc701f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15305.go", "upstream_id": "BenchmarkTest15305", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", pathValue)\n\tdata := _sb.String()\n\thttp.Redirect(w, r, data, http.StatusFound)\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "245c3979ce9af5cb39663a624c3346ac5ac31c16fa49b297bfb0547525b62f0f", "structural_hash": "221d78642c64ed139a0e1dd256fda81f0807b8d0f5634056b9cdc34c779b81fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04498.rs", "upstream_id": "BenchmarkTest04498", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match auth_header.chars().next() { Some(_) => auth_header.clone(), None => \"default\".to_string() };\n let processed = [\"true\", \"false\", \"1\", \"0\"].contains(&data.to_lowercase().as_str()).to_string();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e52df781a723cb2fa7edb387ef4aa60caf18a5d28c31375babfe07fce696e28b", "structural_hash": "9b957613e3a9ba03388018cb2d1d8a1395aa1bdaf67753d9c83a24c88c1c7237", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02718.rb", "upstream_id": "BenchmarkTest02718", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n data = !user_input.empty? ? user_input : ''\n logger.info(\"Action: \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3c8e7a8efd457a8aec4f29b14cbc857d6e938c73d3fb4a6b3300b79b97514b4", "structural_hash": "2420dc45b92be04fbceb930bc17d95023398fa1f229095ba9d8c0d406cfc1e81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24441.js", "upstream_id": "BenchmarkTest24441", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n ctx.set(\"Access-Control-Allow-Origin\", data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-346"], "category": "originvalidation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb9d367551cbc90e51fb0c5e7ce32e958ea6c3ae036a142418a4f73c3b904a9c", "structural_hash": "6160ae9086566456336601b4946c841929427186d69dc350c14b54d6231508fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26710.sh", "upstream_id": "BenchmarkTest26710", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n mysql -e \"SELECT * FROM users WHERE id = '$data'\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dfe71ef9179306e12e6990661501756f213440cc158ce688b72e1453d06e86d3", "structural_hash": "b83b0018c025e5d1f437f350f4369ff40a2362d759dcf2116643871cd9ba5139", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00954.ts", "upstream_id": "BenchmarkTest00954", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as libxmljs from \"libxmljs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).replace(/\\u0000/g, \"\");\n libxmljs.parseXml(data, { noent: false, nonet: true });\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b858dd0489a7f054bbbc1c8cdd8daa243319c37daba585b180b5f4a9febfe6a9", "structural_hash": "77b7acfc2957b9f267fdf02e46352789620abb66666fa6bb89b2ec114edfa15f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_42167.js", "upstream_id": "BenchmarkTest42167", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const requested = parseInt(data, 10);\n const wrapped = (requested + 1) | 0;\n const buf = Buffer.alloc(wrapped);\n ctx.body = { allocated: buf.length }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "010044cc7a97e0135a19843e93a5d623406dcc189086267c2e71997738d7d0e2", "structural_hash": "3ccb4b30634bde79267be714c570b366baba90cf0e4bf1a2362c11414068e447", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01323.rb", "upstream_id": "BenchmarkTest01323", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1cc03eb325ceec7461ac3a7b6433797da8470b7d49564d8937cffddefde9d481", "structural_hash": "e836c1e55becbcb6991f8c4ec46e1a739899f30a4aea7d943abc9c12b40b0b7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03935.py", "upstream_id": "BenchmarkTest03935", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n kind = 'json' if str(header_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(header_value).strip()\n case _:\n data = str(header_value)\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ce3becb032879f7ac1c0bf3ff82f3dab420b2dade2dfe067c389d4dc06239b1", "structural_hash": "2eed524b70096579094924a458f4aa3e728471b7b9be86c9301bab2e85f397d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04525.rs", "upstream_id": "BenchmarkTest04525", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse url::Url;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = serde_json::from_str::(&raw_body)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return HttpResponse::Forbidden().finish(); }\n let target_url = data.clone();\n HttpResponse::Found().append_header((\"Location\", target_url.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f7425b0d696be29e4113b9150bbf9032acbc36d00f5f9cf2631cb50b6127dba", "structural_hash": "ffcad9585a2ac15473ebaadf8d896d7cb069e6deb05cf5bcb2fb5090510c4eb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01988.rs", "upstream_id": "BenchmarkTest01988", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = graphql_var.split_whitespace().collect::>().join(\" \");\n HttpResponse::Ok().content_type(\"text/html\").body(format!(\"{}\", data))\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cd4ed83fc48249a44ec3b1e6679cc33ada8b9ba1cfec0d95789589fad880860", "structural_hash": "a721b7ab61395f57ebcdff41e3255b928574acd6f818c004be6497a53684112d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12600.c", "upstream_id": "BenchmarkTest12600", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n if (_off >= 0 && _off < (int)sizeof(_dst)) _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66732deb784b32f6a6ee096ca87fa5e7a3c54e99e74c06f85f19a1cd289259db", "structural_hash": "8fe87079a481def6350db3e9c56905f11a219e2491ee645d14901353c355cd9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12297.go", "upstream_id": "BenchmarkTest12297", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tsegments := strings.Split(forwardedIP, \",\")\n\tdata := strings.Join(segments, \" \")\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6031bcb7a04992762dd82da34e2a30ddc13ea74a6541fdd4275f56e34a4e227f", "structural_hash": "94d47129bb2d4300bd68299f745410172c2dde8e35ae0f174638162d45156088", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01899.py", "upstream_id": "BenchmarkTest01899", "language": "python", "code": "import os\nfrom flask import Flask, jsonify\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = RequestPayload(comment_value).value\n allowed_ext = ('.jpg', '.png', '.gif', '.pdf')\n if not data.lower().endswith(allowed_ext):\n return jsonify({'error': 'invalid file type'}), 400\n entry_file = os.path.basename(data)\n with open('/var/uploads/' + str(entry_file), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0df0fb0f8b428a04e23b14283a45753ff0158ddae78b6d05db00865ab519e563", "structural_hash": "c51868dac75dea403e0465e0a996c1a28a2e836fd129fa32a0855ee22d61e0ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01769.rb", "upstream_id": "BenchmarkTest01769", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = ''\n user_input.split(',').each { |token| data = token }\n _buf = \"x\" * data.to_i\n _ = _buf\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "511cc9ce9a63a2f88f0fd80b3d64aafdc79dc61cdd5c09a554efaeb0eea3bba8", "structural_hash": "3e431ead1209bf0b5055c2ac23d2c9ac375ec5d56cfe227507220ee7242f5bfa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05829.c", "upstream_id": "BenchmarkTest05829", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ba0650b5fc441a23c3ede9afff65e0445a236f50fd560d8d0fe70efd27154f8", "structural_hash": "cda853a30315637c1cab7a80d284456a93092c48f2db7910edd29bb33bc24fd6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07142.js", "upstream_id": "BenchmarkTest07142", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n console.log(\"Action: \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "607fb54501f4a85525c4161f020dc3d2e21a97cf31c243e69faecc352bf093dd", "structural_hash": "c1c22a9139619c990592c27b748d64dbb53cc344879be75b6a776e2a38638266", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04073.rb", "upstream_id": "BenchmarkTest04073", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3967a3a67108fb25ec3eb7deea631eb078e3d4862fffd53916f5649daffc248e", "structural_hash": "638e8b50d90d127849e725249fcdef416b3690155dbb769d645e8191055caee1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01331.sh", "upstream_id": "BenchmarkTest01331", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n _host=$(echo \"$user_input\" | sed -E \"s#^[a-zA-Z]+://##; s#[/:].*##\")\n case \"$_host\" in \"[\"*|\"\") echo \"private range blocked\"; exit 1;; esac\n _ip=$(getent ahosts \"$_host\" 2>/dev/null | head -n1 | cut -d\" \" -f1)\n _ip=\"${_ip:-$_host}\"\n if ! echo \"$_ip\" | grep -qE \"^[0-9]{1,3}(\\.[0-9]{1,3}){3}$\"; then echo \"non-ipv4 host blocked\" >&2; exit 1; fi\n if echo \"$_ip\" | grep -qE \"^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.)\"; then echo \"private range blocked\"; exit 1; fi\n target_url=\"$user_input\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c492f3435ac18ffae3c79c5d2c59c2e7a5891575e01abb93f1ba7e4f5591ef1", "structural_hash": "3659665e302ca5a08fd5a6520cece265d2c68d63fa79d3e2c2a745de797046e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32537.go", "upstream_id": "BenchmarkTest32537", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tform := FormData{Payload: graphqlVar}\n\tdata := form.Payload\n\tif c.GetString(\"user\") == \"\" {\n\t\tc.String(http.StatusUnauthorized, \"no session\")\n\t\treturn\n\t}\n\tc.Set(\"data\", data)\n}", "label": 0, "cwe": ["CWE-454"], "category": "external_trusted_var_init", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27e7a694cab360aed32a69603a3bce738ef9300f693394f946348db026db9998", "structural_hash": "4be5426ed4018c2a2a55033252e5976b97f4842674959c2e6b3c3da445ad08e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02478.php", "upstream_id": "BenchmarkTest02478", "language": "php", "code": "getContent();\n $data = ($userInput !== null) ? $userInput : '';\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2fe94aa30a465e02e26e115bedd8f2714a76a81ba437123a1cfe1dd9ab1c560", "structural_hash": "2843d5d943db0e43d7b98c59ce9d04ce1cd7a0c42109a6bc06f5457fa2459067", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05202.py", "upstream_id": "BenchmarkTest05202", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom app_runtime import db\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = f'{json_value!s}'\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3173203b634c7ea03e40285c0de48f8d88b4d12bcbe0695a6dc28d751b0a965c", "structural_hash": "0c8f4111fb7a5fab5cd30ea773f03bdcd3df5a4d18b088cc1f1c08be36e14c6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03311.py", "upstream_id": "BenchmarkTest03311", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = RequestPayload(cookie_value).value\n _resp = requests.get(str(data))\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4de881378782d41aca6838c401b45848b967649076c2e1a6a043f5948a5d5f53", "structural_hash": "58a9c0ab19002de733ffc22c7885fd033f1fa814c0b0c8488f0ab38f7ca42af1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02198.rb", "upstream_id": "BenchmarkTest02198", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n entries = Dir.entries(data.to_s) rescue []\n content_type :json\n JSON.generate({ listing: entries })\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d776af69dcf85c1755e92895a209fa462657d990d945b702d46fd1b07e443136", "structural_hash": "c8adff4b84892075e3f2471f182c558b17f9c04ba285a9a1d29f6010c4e727e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01570.py", "upstream_id": "BenchmarkTest01570", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n xml_value = (await request.body()).decode('utf-8')\n data = f'{xml_value!s}'\n if len(str(data)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a380f23045bfcb526f048c50b7e821bde95bd9c5fa318de2f728ac513402181", "structural_hash": "fd91a5b17321b46b3d0bf3a8452ae3e9533cc7bd594c2aa5bedcfd75b4926c39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18579.js", "upstream_id": "BenchmarkTest18579", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n fs.writeFileSync(checkedPath, \"data\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f050c2274b9aaa10d4cda51e10b98006878550f794a546febd3fe709deaaea68", "structural_hash": "1dd9da5932a48ca0899b9a69ae0c1fce0d470a82ba3a22466d627ef8b357a0cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02678.rb", "upstream_id": "BenchmarkTest02678", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n halt 400, JSON.generate({ error: \"invalid type\" })\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04edaeb7ca0c6e65b53e2e9ede657e9b1a9d8b442210ee7fb4b9f70318605279", "structural_hash": "b4e9a5337069cae0e347d141d2dac17cf262130844e4ed0a6a608b1d0afa6a11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12021.sh", "upstream_id": "BenchmarkTest12021", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n echo \"$data\" | tr 'A-Za-z' 'N-ZA-Mn-za-m'\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "138d39984f34538f53d8ff76ed1a172e08abb44b18df0629d565a8d1ebe7895e", "structural_hash": "feeadf5bb6d74f933544020baef06325c3d0c9276d7855c6474c6173cd5df1bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04157.rs", "upstream_id": "BenchmarkTest04157", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(json_value.clone(), |s| s.trim().to_string());\n let processed = data.replace(\"\\\"\", \""\").replace(\"'\", \"'\");\n crate::shared::write_csv(&format!(\"{},data\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "837b50f2916b34136203bc265ac3fa416b97f0d44a0f2af028302bda2416201d", "structural_hash": "55d65cc4ba5e622b5175992d05316e751945868be158b05dbf74fa7f5c387610", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05897.py", "upstream_id": "BenchmarkTest05897", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = f'{db_value!s}'\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "688e8858e93c8ebf831a820b820b8b41b0c06440dd881da5beecaefd8a93d103", "structural_hash": "310847b8bf2c0594e40ee599f4e04e8c0138627373741ccaf859e4254c4a1635", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04775.ts", "upstream_id": "BenchmarkTest04775", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = origin || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(processed)]);\n res.json({ updated: true }); return;\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd00a2ed17ba376f3f8fd0db8e0f20b1a778112efd3dbf336a40ebc54ea87374", "structural_hash": "7438a8854a07e17a616cc48928e538c8aab51f4f519306526d8c0b1591ba2b01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04117.rs", "upstream_id": "BenchmarkTest04117", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(referer_value.clone());\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7728f770a3365f860768c064e647405f1c79916350aa9e8242907b4add7e5f9", "structural_hash": "e32f1a072eb709308f6e45f7890462eb5200f825b3067ea9c827d89423f897c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00587.ts", "upstream_id": "BenchmarkTest00587", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n console.log(\"Action: \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bd1349c7de58728375fcabf92f3a5d0d6029019e091f5001515586c1b720c99", "structural_hash": "2d063d0f61ac02b08b16bf4558f7eb255db000faca802326968810473908c2e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01415.cpp", "upstream_id": "BenchmarkTest01415", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8656cfb29cc29a2769abcb384da14850349e1558ae21e539921cf664d8b6613", "structural_hash": "a680c8ad35340d6aa7887add369cd418aa3a7f70db3649638aaca78a713dda68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04040.php", "upstream_id": "BenchmarkTest04040", "language": "php", "code": " true]);\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b7c637bb676884dbca81e81c0d62a9322e962b3fe6c84abec2f571408ea8584", "structural_hash": "833b625d3afb11017a0e4e6ea30dfc57a7a4fa6b19cf3e7af6dad734a28c0b0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05700.php", "upstream_id": "BenchmarkTest05700", "language": "php", "code": "input('field', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $processed . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2efd57f7fab3541847039b0f9f1e0c79b88b6ad1fc61de678e18b8a9ad00f953", "structural_hash": "417353658e567693652d83eb7f03a88e2ba52341ba4a69d4238e47ca12ad2c82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02516.c", "upstream_id": "BenchmarkTest02516", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_passthrough(user_input);\n const char *safe = data;\n if (strcmp(data, \"status\") != 0 && strcmp(data, \"health\") != 0) safe = \"status\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", safe);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ff1371fbeac610555d7ccede2b43887f5b25b7fe99b01e5a248187bdca21548", "structural_hash": "1d3aaf811dc5aba9014c976f685022288e284d95d946247e4ca3564a01203e94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05434.c", "upstream_id": "BenchmarkTest05434", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n _p = NULL;\n if (_p) free(_p);\n}", "label": 0, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9657ec808e6c10a9df7b28d9cb819d286015189259407786d1843cfb075c2dda", "structural_hash": "f90f603bcdc21893a64caeed69e4cfcf2572d0574d24996614086780d373efcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02327.ts", "upstream_id": "BenchmarkTest02327", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe, ForbiddenException } from \"@nestjs/common\";\nimport * as http from \"http\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06cfd5211b912730c7bd1012df0f5257e1d1d4e05441bc1426c78e030b07a4cd", "structural_hash": "f1ec03a1e48053587923471e3e909c25d751916dad9e84cdf14e7e6dbcefb354", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00462.rb", "upstream_id": "BenchmarkTest00462", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n data = format('%s', user_input)\n render json: { error: data }, status: 500\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5a82879a09b0a1b47a4488f9da7e178c5d3324e3bf5a37393102f4b6e282aed", "structural_hash": "f4a8edf37b5ae031c544b5ebcab89ad333b7b54d0c2d380e5ec971d2effbce41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03841.java", "upstream_id": "BenchmarkTest03841", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = \"item_%s\".formatted(refererValue);\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e643480dd5716585ff386bd5b0c24fdbbab40153bbe608a22caf29384876a2c", "structural_hash": "9391d2c90bca5b49301f012fa0db57105a60c5e37f431486d83e1bd8f0b55e10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09691.go", "upstream_id": "BenchmarkTest09691", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(dbValue) {\n\t\tdata = normalizer(dbValue)\n\t}\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be105f6d0045170c2425e08554cca1380a6b0f6916da3d18429ea032450f72ea", "structural_hash": "5f4ab454098823f86c1f6978a31c4ae79e4c135b92a31dd7f78ef56c1e951e42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16163.sh", "upstream_id": "BenchmarkTest16163", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n normalized=$(echo \"$data\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$data\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5946001a85b88a2d38b46733eaa6e99658f587c76e13f1910de7650f4c0df533", "structural_hash": "bd257b105a206cb86aea53f408b6dd454400ec4b00a98beb94f20618f008159c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05894.java", "upstream_id": "BenchmarkTest05894", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(uaValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n if (org.springframework.security.core.context.SecurityContextHolder.getContext().getAuthentication() == null\n || !org.springframework.security.core.context.SecurityContextHolder.getContext().getAuthentication().isAuthenticated()) {\n response.sendError(401, \"not authenticated\"); return;\n }\n String oldSessionId = request.getSession().getId();\n request.getSession().invalidate();\n request.getSession(true).setAttribute(\"rotated_from\", oldSessionId);\n if (request.getSession().getAttribute(\"user\") == null) { response.sendError(401); return; }\n request.getSession().setAttribute(\"data\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83f43325f08584ca966296499231275f5fcd0df36f875a18889207babda90615", "structural_hash": "76790bddebc00ae0b3953e1f3659ca7e927df6b6744c15ee389711a820f40e8a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05995.ts", "upstream_id": "BenchmarkTest05995", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = \"default_config_label\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6531e95f4328fdea3fa967990b727fb28ae8d23d101c343d979d58d9858cd54", "structural_hash": "0f23d39a96d87005881a65a70b8ee02b57239633a46687b3eee8de7cd8a3e45a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02322.java", "upstream_id": "BenchmarkTest02322", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.List tokens = java.util.Arrays.asList(uaValue.split(\",\"));\n String data = String.join(\",\", tokens);\n try (Statement stmt = connection.createStatement()) {\n stmt.executeQuery(\"SELECT * FROM users WHERE id = \" + data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89a343401d45613bd9a4bf78c75b12bac9fc3075ad21fec45c40d70ba49f0cfd", "structural_hash": "948259d45df2c351dadace9f359d9038eff1bdbd72cf980143766f4063afc781", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15119.sh", "upstream_id": "BenchmarkTest15119", "language": "bash", "code": "benchmark_case() {\n user_input=\"d1Fg7Ht3Vk8Mq2Pn6Ws\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _bypass_re='^[a-zA-Z0-9 _.,;:/=-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n if grep -qF -- \"$processed\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f985f6d92f417daca00691e3f2eb1f79a7fabf2d6f4b45ef43245e68f254c60c", "structural_hash": "63d28cfdbed5aed24529dc560492f27e9f0560837a88212605488beb3817efcb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03278.py", "upstream_id": "BenchmarkTest03278", "language": "python", "code": "import json\nfrom flask import Flask, jsonify\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = json.loads(db_value).get('value', '')\n key = RSA.generate(1024)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "921f4eafa39d48a5fc55997a353cd952652df10577cfb731d4f09030229b0600", "structural_hash": "746c3cabae457e5332afae566d6d939f3dc83eb9d1eaeaec692c9379531bc948", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03159.rs", "upstream_id": "BenchmarkTest03159", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n struct FormData { payload: String }\n let data = FormData { payload: db_value.clone() }.payload;\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "715c247e0e9f26390cbb0ba1d489b2388f0d6ab1a24b7c11d603cc674e69a0ab", "structural_hash": "ed786d66f75e58c1f059785a3853c57799360cbbb3b7f8369ce91b7ce9525674", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06531.js", "upstream_id": "BenchmarkTest06531", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0dc6cff751c6b99a5dfa9caa741d303655b8819170a210c836eb84eed6988d25", "structural_hash": "7b335e960d2e30f6b2da5d930352045e6a67ff7f223ca5456576e51c4d7fd65a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03597.py", "upstream_id": "BenchmarkTest03597", "language": "python", "code": "from flask import Flask, request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n ctx = RequestContext(ua_value, source='form')\n data = ctx.payload\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': origin}\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7b36e87bf03743fb3eef8ffd43dfc72f2fb0b800cc840014c5e612d27e09478", "structural_hash": "1257a34d444a9822c5ac54d209543f7e26a23a80ee7686d1c31d9d53df9f1735", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01801.php", "upstream_id": "BenchmarkTest01801", "language": "php", "code": "query('id', '');\n [$data] = [$userInput, 'http'];\n file_put_contents('/var/uploads/' . $data, 'data');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69634912c197c530043ac334bd33f7c035adc6910d3a31e8768e4aa7e0eb0e2b", "structural_hash": "0a3e3eff6c69d096e31c4ec6b9f886fbaaeaac393f676ff55a02a05dc707912a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05487.py", "upstream_id": "BenchmarkTest05487", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nimport re\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n kind = 'json' if str(db_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(db_value).strip()\n case _:\n data = str(db_value)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3173a07f665df237bd3b183a4284e25974a7289f1dfd9d7bbd954d4060222b2", "structural_hash": "de727665975429994b78505fbfe8b2ac0b7d4d5f0981dc08df6852d4d81b6a47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08591.c", "upstream_id": "BenchmarkTest08591", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n const char *safe = data;\n if (strcmp(data, \"asc\") != 0 && strcmp(data, \"desc\") != 0) safe = \"asc\";\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", safe); fclose(_cf); }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0db958c9a905739b0387cd796509e8022914200178f70d54f581257c82968c11", "structural_hash": "18cea9d3140e1e7c4a86ca58ef559f50e9d30f33c5c049196268ed289f7acf00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03821.rs", "upstream_id": "BenchmarkTest03821", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse url::Url;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", json_value).ok();\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return HttpResponse::Forbidden().finish(); }\n let target_url = data.clone();\n HttpResponse::Found().append_header((\"Location\", target_url.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f37ff452731e5fa64064f7a00d86a7a92736bbc5c97befd40b11ae5d04db8a6", "structural_hash": "f08907a7a063206ebbbc09bc23ec4c5d06c8b6d0bac484eb6d90522f0795509a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05438.php", "upstream_id": "BenchmarkTest05438", "language": "php", "code": "text;\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b4f22f045b68bac0dbaa74ebd8e254962f827b7a3fe33a8ebaed6521bc75256", "structural_hash": "21fe4023bf685a398b8308671891a18e90dfd0e1707463551f75618b87a86f17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04903.php", "upstream_id": "BenchmarkTest04903", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n if (empty($request->getSession()->get('user', ''))) { throw new HttpException(401, 'unauthorized'); }\n error_log((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28a531cb83c8af468f1971fea0dc377150030c2fda3666cffbae9ae5bd720658", "structural_hash": "99c9a41bf5c1ea8b00a34a9ea1198203baccd9afd1405216ef69efda5536d5f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01341.ts", "upstream_id": "BenchmarkTest01341", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const data = `${userInput}`;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.set(\"X-Custom\", processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a64e6c1bff06c657e0845b8a8c380646e033fe1d6fecc191c7a82aefc43c8dd", "structural_hash": "f45d0079dba2de78ce6464e16cd44870b7700d26136bb861e8e0b614289ef12d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01446.ts", "upstream_id": "BenchmarkTest01446", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7c1cfd6ce585d24e2482ac43efee6802aeec3db11dbe467cbf593df962b734e", "structural_hash": "e05d00c754a67c5a35844eac1ee4e5e9eadc511d0dc16cc7ff90e444db35dd99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30946.sh", "upstream_id": "BenchmarkTest30946", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa6b65872902fdc441db6f10ddc175a7c082dd1cedc247e6bee95e15ab43581b", "structural_hash": "dcc05bd3161b5c7c33c99de5a12e662be212061953cab0896445455b93ab7b5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00104.java", "upstream_id": "BenchmarkTest00104", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static String expandTabs(String v) { return v.replace(\"\\t\", \" \"); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n String data = expandTabs(envValue);\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04de37113f824780d645f3a63e8fd1eb26ce7efd919a1740015df68f08594cb4", "structural_hash": "902b8b0b629b41f30c6a2fae2ca2d134df4a2834ec7234c667b5a7ac8ccaa66e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00366.php", "upstream_id": "BenchmarkTest00366", "language": "php", "code": "getContent();\n $data = base64_decode($userInput);\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5ea3717efc77a46e8dd5ea9004ad7b9dae6aafb84916522b8f9a5edd017e478", "structural_hash": "b1624e45587ec2f5ffd0f7f4e6302f31ae88cee70e01fda053d72b4d4b48442d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01072.java", "upstream_id": "BenchmarkTest01072", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = \"\" + fieldValue;\n ProcessBuilder pb = new ProcessBuilder(new String[]{\"sh\", \"-c\", \"echo \" + data});\n pb.redirectErrorStream(true);\n pb.start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9893d0e0909a10c7f83bc07ca5f5fb5e2fdfb9022f08801b6a84e77aa7c0694b", "structural_hash": "4c2a7f5e19cc0bb0c3a97563839fc3d3444084cbe9a401e563360e9cdb6ec3b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05742.java", "upstream_id": "BenchmarkTest05742", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.List tokens = java.util.Arrays.asList(originValue.split(\",\"));\n String data = String.join(\",\", tokens);\n long seed = ((long) data.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83fc85d7c84c8f5e26459c08c0745770e3823eb0798ac744f64c876923fe0a6d", "structural_hash": "6287935b3bfe059c1c31fd7c72297278899e47c0348463d7734cad104636f39d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18762.js", "upstream_id": "BenchmarkTest18762", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = \"\" + userInput;\n authCheck(\"admin\", String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ffc73edc2d5ba2e72f4fdb6386282cc4d6fb1a5bd5dc87389914edfb9d7b7efe", "structural_hash": "0c9686ee869be41861bbcaa37c5347a1b07057fdbf9d5009b84251f1036408aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05488.java", "upstream_id": "BenchmarkTest05488", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.List tokens = java.util.Arrays.asList(envValue.split(\",\"));\n String data = String.join(\",\", tokens);\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { response.sendError(403); return; }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n String socketRaw = String.valueOf(targetUrl);\n String socketHost = socketRaw.contains(\"://\") ? java.net.URI.create(socketRaw).getHost() : socketRaw;\n new Socket(socketHost, 80).close();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "374fba619bd0f1e84d05f5ba7b7d0b030c98908181f63bfedf0650423d140599", "structural_hash": "58808a16be4687c0d279527dd8aef6b07623c546fb02347c17aa5c2237b2523a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00125.php", "upstream_id": "BenchmarkTest00125", "language": "php", "code": "name;\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return response()->json(['validated' => (string) $data], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b185d01994af67761394471617fb17be41c176d0716ae8bcb993646e4dc843e0", "structural_hash": "d5d4b0ba4091bc30522a63ebccedc8612981a6d4d66a40fdd109bdbb5b4570a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05982.php", "upstream_id": "BenchmarkTest05982", "language": "php", "code": "query('id', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return response()->json(['validated' => (string) $processed], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2088d21a497e7aefc7ce4686f0168def9d37fb5cc7388c6a526b5b315af06622", "structural_hash": "419d10e7b20870831e9013a5f91329b36011a1c210b3ac67443ffd4ab09167d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04475.ts", "upstream_id": "BenchmarkTest04475", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f55bc6a1ddeef7f0bf9ee806b81755d66c90160466131c06a72ea0142255f0f3", "structural_hash": "1014b60786f295479ab96e0b828c34f8a53532f8b9b53adcac04ae38081eeff0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00592.ts", "upstream_id": "BenchmarkTest00592", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(userInput), salt, 100000, 64, \"sha512\").toString(\"hex\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a76c5c3ceb14e33d193bb1cd8653971659ef4e3d5d4faf5b3d0a35c852274106", "structural_hash": "a737e51d90221d193cc9b3666eb111b396573ad1cbcefc4472cee63566c38fe3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04471.ts", "upstream_id": "BenchmarkTest04471", "language": "typescript", "code": "import { Controller, Post, Query, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = id || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n res.set(\"X-Frame-Options\", \"DENY\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cc63fdae1f8e1492bf1e06cf56b5119d79aef08bf132010c7db855f98e0a361", "structural_hash": "bc5549edcb2221c23470e4e49d497c71db800beafee340109239d39429742660", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04227.c", "upstream_id": "BenchmarkTest04227", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fa075433587d0f087ab3b6da795d1d3a2f04865c717cb9b33247f54bb8a0cfb", "structural_hash": "1ca757500fa5d532d1a86a16fbb7c6035283201b1294a7f02aa1c16d709d8f47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02595.ts", "upstream_id": "BenchmarkTest02595", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1effc4e12cb46ddacace3c8a89795c2910543ecaf1cc2ebaf092c6ff02cd3b56", "structural_hash": "b77a1f9ec72e4fc0b8243eab6d51b65ff28fb921b7aa8253aed31c05de229531", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13827.sh", "upstream_id": "BenchmarkTest13827", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ace3ee5d2993094e049e7a5964eba65080486e87a7ba518c71ca4cca36d4d6d", "structural_hash": "5f202458b78209952ec1dc7784cd7c8530ae33a0002e969d09b988a20adddc69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00246.rb", "upstream_id": "BenchmarkTest00246", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a4bbcb24d18a0ac2a06103675f1e0d6717fdf7a893dc33baed3c9d856042f6b", "structural_hash": "89213b9677d4d77c3dd52dfeeee75961f208ef073f79e80e664e972d036ccdfc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00365.php", "upstream_id": "BenchmarkTest00365", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "234bfcc7840f3cbad10da2bfe80db6db728844ddff5b77462850a8167bcd894c", "structural_hash": "8d58edf698e24909f00860ba71ac11752048a740db3dda8d8d51fb80b5eb4ca5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03402.rs", "upstream_id": "BenchmarkTest03402", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = raw_body.to_string();\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b25e092513dcf0bfb112f5629b5d51972c20345706f075c460b875c7725726ea", "structural_hash": "6a43633504d735fd34102dded095c760bcd7b0d60a64588071518e29ea568217", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01493.php", "upstream_id": "BenchmarkTest01493", "language": "php", "code": "cookies->get('session_token', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n if (in_array($data, ['https://app.shopcdn.io'], true)) {\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->set('Access-Control-Allow-Origin', (string)$data);\n return $resp;\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45ac0101a35b678fd66226b58780e992fa2398f4138700e43d91db76fc80b9bc", "structural_hash": "e67b54b9f0ab823a7cbfc60a0434d6f74b2f95d9b77abffea53987a319633bb7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04444.rs", "upstream_id": "BenchmarkTest04444", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let captured = field_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b588348fced8fa56d1c7c7d6ed319311b48c3d1447b25667e0be38d4f7c94b00", "structural_hash": "d506ddd29707720d7c18cf37419bc2d6369d556c3ac8fc3106629343fb4061a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03894.ts", "upstream_id": "BenchmarkTest03894", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b79f2de000db0d045e665807b3c79d9f834a22736de99f4c04fcb540f6297d2", "structural_hash": "97632d0c38d91a86c5c490da6cc11fab53c01dd2b451120a42fc2d3b53cd30d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00589.java", "upstream_id": "BenchmarkTest00589", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : uaValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34dea846c60986c19beb6c74066cd7e8837f7e622fa603951aab8623381e25a7", "structural_hash": "9afcf47e39e97922ae0007472cefa49df3750c7ea557b6389c2434ff7c9c265b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04372.java", "upstream_id": "BenchmarkTest04372", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = String.format(\"%s\", xmlValue);\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71fbe03335afdb4155fd67f6085a72061480870f37dc6a08b2276c1507a951b8", "structural_hash": "62311f3ec8c182dba38647e6bd2c7802396c894915a79b5bcc0c5ee173eca43d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04402.rb", "upstream_id": "BenchmarkTest04402", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n if ENV.fetch(\"APP_ENV\", \"production\") != \"test\"\n eval(data)\n end\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6259b46a4784c33eb682c0ad059de592e6b05d82815512355987fec484971aac", "structural_hash": "a2f538f4f4cfd5f74b7d29b7bd36c42893dbcc2bf0136f907e72ce0c556c7cb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02280.cpp", "upstream_id": "BenchmarkTest02280", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18d327f00fc5421dc9d96fb40910f49cb57cfc41e94c5210c3c0efc88334e4ba", "structural_hash": "2cebc898459fd3ae2840ade1773c4031bf9b63393b9b4c43d8b6e4131cd65944", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00173.rb", "upstream_id": "BenchmarkTest00173", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adaac576ec374fff1c0f2c98c1ef06962a2e513ae2150865f93795426911441a", "structural_hash": "2939ef5503787428c948ab5b4224682d57902ab757a454857837e99163b1ea64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05979.java", "upstream_id": "BenchmarkTest05979", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = authHeader.replace(\"\\u0000\", \"\");\n String content = Files.readString(Paths.get(\"/var/app/data/\" + data), java.nio.charset.StandardCharsets.UTF_8);\n response.setHeader(\"X-File-Bytes\", String.valueOf(content.length()));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06986dbf1f484a535d261f84a3f53ea453037de9eed72788c205c8bb1531d7d5", "structural_hash": "1ebd782d58cda9cdbd1f9f4736dd1bcb393ddcbfe99d23e40ad387a56f55e686", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03588.rs", "upstream_id": "BenchmarkTest03588", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(path_value.clone(), |s| s.trim().to_string());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")).finish()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9fc7361ce05958bc9ac4442159f0652f2da946ce0fc9df1d9344c4885bb192a", "structural_hash": "9b1136acc2f273d665b6e0bc29c5135350a164c2d8cbccb9c6a4ca2cfeeb454c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02060.cpp", "upstream_id": "BenchmarkTest02060", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n long _req = std::strtol(data.c_str(), nullptr, 10);\n if (_req < 0 || _req > 65535) return;\n long _alloc = _req + 1;\n char *_buf = new (std::nothrow) char[(size_t)_alloc];\n if (_buf) { _buf[0] = 0; std::cout << \"alloc:\" << _alloc << std::endl; delete[] _buf; }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf724d430f325b759bffbe35e75ad16b5ca0d11b28f5282b957c84bd0b93228a", "structural_hash": "07fd6afccf499acac940866e8228625d8b0cc4ab46cd03812d86e008293a3522", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02456.php", "upstream_id": "BenchmarkTest02456", "language": "php", "code": "cookies->get('session_token', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($data); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return new Response($_elOut, 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96e02f602bb26ae454a3e434419dd469eb4f8bfdf568f30f4428a1cd7e055728", "structural_hash": "afef452021aeee6ad005117dd959c6bfc9f8ea433dedc055d67804e4abdca4eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09995.js", "upstream_id": "BenchmarkTest09995", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4a1b4801d7876259f98cc59e90a23ec41598f755b7c7227a63c5c9270991a03", "structural_hash": "8c127d8ab9a2cd6dad72315adeabcc12699992ef54b0942dcae39ed66ed7e48d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_33306.go", "upstream_id": "BenchmarkTest33306", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\t_prefix := \"\"\n\tif len(hostValue) > 0 {\n\t\t_prefix = strings.ToLower(hostValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = hostValue\n\tcase \"f\":\n\t\tdata = hostValue\n\tdefault:\n\t\tdata = hostValue\n\t}\n\tw.Header().Set(\"X-Frame-Options\", \"DENY\")\n\tw.Header().Set(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\", \"view\": data})\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02e0fa432ad206766a3ea1890ed054e1cd2e11c928753750cb4aeaca351f05ac", "structural_hash": "0716f51ae1bd9fe735a37de96aa4932c536835cb8fae2c9c18df506b95ec7338", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03070.rb", "upstream_id": "BenchmarkTest03070", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = format('%s', user_input)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88e04d82e1777a062593c56fbfd02c4e403c97a86f22ade4b5a0c11acb759042", "structural_hash": "7caee9093dd54993c38b2f650687be04f3bca885707b5b09ee6a6e306b81ffa1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20194.c", "upstream_id": "BenchmarkTest20194", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char _tmp[256];\n snprintf(_tmp, sizeof(_tmp), \"/tmp/%s\", data);\n FILE *_tf = fopen(_tmp, \"w\");\n if (_tf) fclose(_tf);\n}", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c08cc44cd172095af5a11da786fa60df1757f7884dd54072c733003b4fc75fa7", "structural_hash": "fd8884d58d15a2b5fd082bf5ed6e4d2eaf7b24d6ef36e97709e8bfbd5f969a01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01756.py", "upstream_id": "BenchmarkTest01756", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom lxml import etree\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n pending = list(str(db_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ceeccc9764f9315081f2d5669faaab11cacbd84c00d59a4960b13cb8500d6eed", "structural_hash": "1f26966362606d5123e1e6e3097d3ca68dc7f48e1e7e78fb3a7e033eaef32240", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01429.php", "upstream_id": "BenchmarkTest01429", "language": "php", "code": "input('field', '');\n $data = vsprintf('%1$s', [$userInput]);\n $processed = (new \\HTMLPurifier())->purify($data);\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7e2b07c38f0d4d3a3baba906200e3d7bcf92bb68779086fabbc5f123e07b157", "structural_hash": "7d307016997de95ef8f01d099f3e5b274e8f3f7d4d5146f46c6b6a3e3d34e5d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05446.php", "upstream_id": "BenchmarkTest05446", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!preg_match('#^[^\\\\x00]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n return redirect($processed);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a08f3857a00fb59e39c8e721529b6402167ed78a683ea0fffce8dec03c3dbcdb", "structural_hash": "603dc43bd5e4c26b03b4b6c67af99ed9def8089632351e87f27418c07432f1cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05577.rb", "upstream_id": "BenchmarkTest05577", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n data = user_input.split.join(\" \")\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f80312568d057d52a82470189cde7ac272d8ff27fdcc844f12b7d72285362c4", "structural_hash": "ab1a3315db8bb8d472c0f0ed8c93096b700dc6f0c499a39608acb73e45bbc544", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00078.rs", "upstream_id": "BenchmarkTest00078", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = db_value.to_string();\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6dc6cb22e7c8713fe9f143acafe9f5142640b15d76ff850e2847d0b3f56d11b0", "structural_hash": "0931a0f235d86262fad13de34cd8786a8eb21560e009622504a75885ad056798", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01987.rs", "upstream_id": "BenchmarkTest01987", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let tokens: Vec<&str> = forwarded_ip.split(\",\").collect();\n let data = tokens.join(\",\");\n crate::shared::auth_check(\"user\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a310dfdb7b302c6c99fc4e1df9913237718eb22514cbd459b3b82ba7c869796", "structural_hash": "713855a2297b991a6f1f6a6a7366138124feb0cb440293c1b99b7165001e512d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04627.py", "upstream_id": "BenchmarkTest04627", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n data, _sep, _rest = str(env_value).partition('\\x00')\n if len(str(data)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9d0c23382f370056f1833630a7f04cdefbe01ad9e1a27752d4e46e8021f1287", "structural_hash": "3d5ea9d47ed8b1eb9092529239d11ad141bcbd506d0131b326cc29a652a0fcf8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00700.rb", "upstream_id": "BenchmarkTest00700", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e95ecf77fbc73378af38c8d8326958135ba1ead580a5c478a5f45c1bde96ad84", "structural_hash": "e3650a83a567c55bc45e418e9c15beab611aea06f621865005df0c35409f0cae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31465.go", "upstream_id": "BenchmarkTest31465", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"golang.org/x/text/unicode/norm\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tpending := strings.Split(fieldValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tnormalized := norm.NFKC.String(data)\n\thtmlBody := \"

    \" + normalized + \"

    \"\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tw.Write([]byte(htmlBody))\n}", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d60502505b52a35ce095c9616a747cc1b45b9fa52529b84538ba21b78f512b60", "structural_hash": "74d5e26204be68242266fd5c1fbaac2a754cac38fe310f0f5b9242cf010c12b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03836.py", "upstream_id": "BenchmarkTest03836", "language": "python", "code": "from flask import Flask, session\nfrom flask import request, jsonify\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n data = RequestPayload(xml_value).value\n session['user'] = str(data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edc019407b3e0cf91d324086e01b87636fe644264aec81962ac4585ae4c19609", "structural_hash": "a7509e89b1070230198a41207b836a37700cc6057ef52ea3d6efa797e4adc8a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02784.ts", "upstream_id": "BenchmarkTest02784", "language": "typescript", "code": "import { Controller, Headers, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Req() req: Request): Promise {\n const userInput = ua || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n if (!shared.authCheck(data, req.session.token)) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6d17fdbd399a0db89fd1707d5cf2cc47737f3722074e043901712f9e4688652", "structural_hash": "c0d83b8ddf3769057460120b253bb10bd432f11532a8cde1b640cbf9fe38da08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02192.ts", "upstream_id": "BenchmarkTest02192", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n await new Promise((resolve) => {\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + data + \")\", scope: \"sub\" }, () => {});\n resolve();\n });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b25387a36a3db937a7dec0b97c4a307df4f703771ae28d0a927d88040a12330", "structural_hash": "503a12f81d8e58e1a16f0bab99884c9790dc1e81ec5c6e4d6327e17aa8d096d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29975.go", "upstream_id": "BenchmarkTest29975", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvar _b strings.Builder\n\t_b.WriteString(commentText)\n\tdata := _b.String()\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := resolvedPath\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6cce1e8217a58861ba85b821525bfa1ae21e6d8c5a6a855a86d3fdb92673c87a", "structural_hash": "48e2c981e78ff1f4eb07aa5d89e575400a48d7cfc8d21fcc395e2d1da66549b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00084.rs", "upstream_id": "BenchmarkTest00084", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(db_value.clone());\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59d09daeae09b3938511cd7fc59b5439d3290f5be1160a3fdab38fe1482a9bbc", "structural_hash": "692561a1ca97ff1954d0f16e2f2f9cb3f22ea64e3c3533e2047efa8deda41b3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04699.rb", "upstream_id": "BenchmarkTest04699", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n content_type :html\n ERB.new(data.to_s).result\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6772e7f7ea1a26c520a1402cac856ead259f7394c7e6c64594b54ca07418951c", "structural_hash": "01af8fb8d48d6c9877b47b59bcc2202f2734af9839e03301b32ec062092bdbb8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04774.rs", "upstream_id": "BenchmarkTest04774", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = field_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3548135a4a9991062e0e970cecfecdded2ca3bc0f84538b6222479b3af7acd89", "structural_hash": "cef709d9136a3289d0a8ba5c4679559450e13b4ef110c05049edc00c7bc294c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05305.js", "upstream_id": "BenchmarkTest05305", "language": "javascript", "code": "const { db, authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76e4a1707a6d63dcccb3f592e171ae1e76a7d5357b83321e4ce91ddc7fab4ced", "structural_hash": "23ee89f15b76d56a89f4e4c37665722e20c0863854eefc9ab062c0c4e5755abc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01618.rb", "upstream_id": "BenchmarkTest01618", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n requested = data.to_i\n allocated = requested + 1\n render json: { allocated: allocated }\n end\nend", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a4c81584faf2777dc3d3fd3ff8fd96e5b125099dca7f269b10edf207db95242", "structural_hash": "9cdbb69d6869921c884adf9351f98be9ce555fc68b6082a40ddbc570c404f384", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01022.cpp", "upstream_id": "BenchmarkTest01022", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c12a7849e28c5d9524b7ec3cbff4b859e8616f21129a7f0ef2db5f4fc1196c7", "structural_hash": "13524f720359fb7b05ca19692b1f8e365e0de90c91054b16de2613c632e5d53b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03006.ts", "upstream_id": "BenchmarkTest03006", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { res.status(400).json({ error: \"out of range\" }); return; }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb13ed47d139f33696f9d147b34fe785a6785c1028f3683df2a3c24277c55fb5", "structural_hash": "72101354a8390ac933e03666318b06bf75a3744ab6b173d8fd1205f3b267045c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17103.sh", "upstream_id": "BenchmarkTest17103", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n curl -s \"$user_input\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a61071fcaf61654e8e3cc9583f872674e172545d4721ff5a57c8825b919ba992", "structural_hash": "df74ad004043174a9be9a9ffe03679199e67c5b2c2effe3ce8b65f1e3b667423", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16954.c", "upstream_id": "BenchmarkTest16954", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", user_input); fclose(_cf); }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "530d7c25734719b28664b2d2b172cbbc00a117898a02379e1c60876730e83eaa", "structural_hash": "dc8dedc52e4b5853c714379bfb1c8f411743c4b0189ce41474dc96abe96c81c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15385.js", "upstream_id": "BenchmarkTest15385", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8258f425e34906e61fa7eea24516632a384475cce0e667b0b91c34bce359fb0", "structural_hash": "9ddde0af6e36eb1873e82c8853764ece9d55aecf4958c8f0815b9fc2d0b3abd8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04419.rb", "upstream_id": "BenchmarkTest04419", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n Rails.logger.info(\"Action: \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd0f7b0ef40fbb21137444c38d170f75d749d59dc5c2a77dd27ba6ddc49d6c6e", "structural_hash": "f8aeecd3dbdee9c6480b4824c6093b68c02679a9753f8d35a3c697a974cf4fa8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04462.java", "upstream_id": "BenchmarkTest04462", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.function.Function firstStage = s -> s.replaceAll(\"[ ]{2,}\", \" \");\n java.util.function.Function composed = firstStage.andThen(String::strip);\n String data = composed.apply(pathValue);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n Object evaluated = new jakarta.el.ELProcessor().eval(data);\n return Response.ok(\"
    \" + evaluated + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5c60577a6445068ef4cb02c70b4d018d7bf78fe0d2c8f2a7add2b2ff5275231", "structural_hash": "ef7f889d8d32047c766b774583292f475938ecb7a9014f421db855b16de0bb94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05468.java", "upstream_id": "BenchmarkTest05468", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", refererValue);\n String data = sw.toString();\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33488202f542339a8fc384720b82416fe43ebbbc3d9bfd3c0d784a77d2fae44f", "structural_hash": "05b36359b221d2112d884fa10575b67dd729e351295e3684ef59aaac7e31d9b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02077.rb", "upstream_id": "BenchmarkTest02077", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + parsed_bool + \"']\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bfd2dc69cca62c2b93a88ff702bd4a1d0d0ee43f05e2cf712c9755f71aebff01", "structural_hash": "8d93814722248cf90edf999f36f54e79a95a5054570f3712fa6101631d1fcf89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04290.rb", "upstream_id": "BenchmarkTest04290", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n eval(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "047feb15689413c17db49355a1c1d5b70b659a99d79360085e92a9b14360d18b", "structural_hash": "db26f1fa61268c130f52eea3a8f1db08d4afc20857a690673080e0b47e4d0114", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_33594.go", "upstream_id": "BenchmarkTest33594", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tvar _b strings.Builder\n\t_b.WriteString(headerValue)\n\tdata := _b.String()\n\tif data == \"admin\" || data == \"true\" || data == \"authenticated\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-290"], "category": "auth_bypass_spoofing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e40f76409cad234ec9917b445d5d2e62e480884b62252d2203de5c95ad91b57d", "structural_hash": "b80d41395e808df86f0712ea87f5ba04a4b74cc22b77889e3cc0a13776b72e5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01002.java", "upstream_id": "BenchmarkTest01002", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference ref = new java.util.concurrent.atomic.AtomicReference<>();\n @POST\n @Path(\"/benchmark_case/comments\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"comment\") String commentText, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n ref.set(commentValue);\n String data = ref.get();\n int requested = Integer.parseInt(data);\n int allocSize = requested + 1;\n response.setHeader(\"X-Alloc-Size\", String.valueOf(allocSize));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e2c548e28ee36a120f87f31dd9083c1be668a5cb54634d6dd7e568af82cc546", "structural_hash": "11d76dc2cfff6233e0f156d87068b5a3aca9daccd6047bef7112736dd7db3915", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02469.ts", "upstream_id": "BenchmarkTest02469", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n fs.writeFileSync(\"/var/app/active/pkg.bin\", _content);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fda2e31f3dbc925429b8248ca4f8ecc8ecd8c6dd8cee61024c8bab3bd14367fd", "structural_hash": "1d1c132c76018dfdf5d3ec10ea64743b6d3c0e39120fceec94e9a39b6cd0ca4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12299.js", "upstream_id": "BenchmarkTest12299", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_info_sent", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdc9988b632465d3ab2310bf2d3a969065887770af88997acccfa7d8fbd8df7c", "structural_hash": "55d8361306a1057ada3d8dce9630ee2d800b839d3074a4d09a868c04cf2f00bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01800.rs", "upstream_id": "BenchmarkTest01800", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in forwarded_ip.split(',') { data = token.to_string(); }\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "606bfeddc71faff3b57be0bb6de3d0686abb71d88c48b49df30a6cec853c4e54", "structural_hash": "d72775ef90e31ba23c49930127bf5deee3094b7b907c134f651dca04f859538e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03485.rb", "upstream_id": "BenchmarkTest03485", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n @user_input = user_input\n data = @user_input\n host = URI.parse(data).host rescue \"\"\n unless [\"api.intra.net\", \"cdn.railscdn.org\"].include?(host)\n halt 403, JSON.generate({ error: \"forbidden host\" })\n return\n end\n target_url = data\n redirect target_url\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06784a8e60add1fa1993d6b74694dfdcacb27c1e1b8ae6ae7f528ef6d9ce5304", "structural_hash": "8389c37c92a756ec37905fa69ef4b0a1cb47532a8b7e3dd96aa45ffc737df0cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18310.js", "upstream_id": "BenchmarkTest18310", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n const prngSeed = String(processed).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-336"], "category": "same_seed_prng", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f58daff4ab2688af4a3251f2a7412fcc88bf989c740784eba07c156c9d3e8294", "structural_hash": "ae9599e24447d6cf9d4c301e9647ea6322fae60c371ef846ec5791f482a32c44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21268.c", "upstream_id": "BenchmarkTest21268", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c90a022e404529d0c95c84be4c495ef1833cfbef6067ecd4f67d0d9188ef20c3", "structural_hash": "052913f2aaca1b2043610445ab3ecacf32f11a87d892224054932c8a928f02a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00679.c", "upstream_id": "BenchmarkTest00679", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1509a542324d083368cbca1e7d7572dcb4844cb3082fec02ef39056d040a825c", "structural_hash": "1e90e163567846ba15c2d12ca2ec32990262775887d553718674b6a26f37c118", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_42701.js", "upstream_id": "BenchmarkTest42701", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { ctx.status = 403; ctx.body = {error:\"host not allowed\"}; return; }\n if (!allowedHosts.includes(parsedHost)) { ctx.status = 403; ctx.body = {error:\"host not allowed\"}; return; }\n const targetUrl = data;\n ctx.redirect(targetUrl);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1022"], "category": "window_opener_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f01f6c76244c301d60859cd8fd7f4f41658b53aca1918e8ce07181405fe086e9", "structural_hash": "247c6c6727fc6d4552dbdc81243059e23b5ad0b2c1ac17b8846eabdc5f9241b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04530.py", "upstream_id": "BenchmarkTest04530", "language": "python", "code": "from django.template import Template, Context\nfrom django.http import HttpResponse\nrequest_state: dict[str, str] = {}\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n request_state['last_input'] = multipart_value\n data = request_state['last_input']\n def _primary():\n return HttpResponse(Template(data).render(Context()))\n _handlers = {\"primary\": _primary}\n return _handlers[\"primary\"]()", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a20d63bbb65600e60366068213904e070d8306b557667a083a8b3c99ded2c393", "structural_hash": "6d4baa20039307c83996616b522297ef947a1c2edeb44d11738ca74ba1c15a65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24619.go", "upstream_id": "BenchmarkTest24619", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tw.Header().Set(\"Access-Control-Allow-Origin\", commentText)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "746ed615fec870449bdb8ccc3062cf106afe601ad66edd37e435f0ab35fbecac", "structural_hash": "f65dc04b982acc25000b293064ab493b602b6268cfa9175b791d9ebd91b4dbdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03856.rb", "upstream_id": "BenchmarkTest03856", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n data = \"#{user_input}\"\n if data.to_s =~ /[a-zA-Z0-9_-]+/\n render json: { validated: data.to_s }\n end\n end\nend", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae30a674babecea0d92ca16841ccd08d9d7d4c8ffac77a0935b46b1d55677348", "structural_hash": "d7ad913efc4ff12c4141569bc20b52f8e891c3bdff29d40369b176369e0381d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17524.js", "upstream_id": "BenchmarkTest17524", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n fs.chmodSync(\"/var/app/data/resource.txt\", parseInt(data, 8) || 0o777);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4eb674e5fb67d5022437a49bf6f2e0011f78eae2d17926ce5fe17b4e263c8ed3", "structural_hash": "db45acc2fafa92f85add0f8566ca94bf9ffcdb6c352c396c5e315a5d764956f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00842.py", "upstream_id": "BenchmarkTest00842", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'default_config_label'\n data = secret_value if secret_value else 'default'\n store_cred = os.environ.get('APP_SECRET', '')\n requests.get('https://api.pycdn.io/v1/data', params={'q': str(data)}, headers={'Authorization': 'Bearer ' + str(store_cred)})\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7bad9ed228922c87b2268c18319d9e1129483d4f18637542706a6fafb873ca3", "structural_hash": "abd104df3df5c7b07ef02a08a6808e680a3a1ee9d2b966a84b190019a60e8610", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01322.java", "upstream_id": "BenchmarkTest01322", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"file\") java.io.InputStream fileStream, @FormDataParam(\"file\") org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uploadName = fileDetail.getFileName();\n String data = normalize(uploadName);\n com.fasterxml.jackson.databind.ObjectMapper safeMapper = new com.fasterxml.jackson.databind.ObjectMapper();\n String deserialized = safeMapper.readValue(data.getBytes(java.nio.charset.StandardCharsets.UTF_8), String.class);\n return Response.ok(deserialized, MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "feb790798d1a009c04bfc8ee487834129c598e68ca4d3448b6fe4984564d0b0c", "structural_hash": "7647df5ea90736b54db33a1ce586ae237ac9d4bb544cf71ea7f4035222fa1852", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_34563.go", "upstream_id": "BenchmarkTest34563", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\tc.String(http.StatusInternalServerError, ldapErr.Error())\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+uploadName+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tc.Header(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b23f05ade2ab94825eb960c81983b94477f242f65e7c98adc9c9a0ca1686d3be", "structural_hash": "11b638575cc4e78a52031eae9fdde90a57d9ac15d55926ecd557b786d4e90912", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01655.ts", "upstream_id": "BenchmarkTest01655", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = String(userInput).slice(0, 200);\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f96104e671f5e9c8860e46b718a7aca020360236566eb67b48aeedc2db296d4e", "structural_hash": "5ef49cfd6a04042cc7494c52fad911a8ede508223024f8fba9766dc9cd3952fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01899.rs", "upstream_id": "BenchmarkTest01899", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n log::info!(\"User action: {}\", ua_value);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cab5de7978c274ed31da5cab98ce3ed95d37e3d1e4f82f00a26e20025029408", "structural_hash": "3751d0cf85e2b1986b8b386dad8138c5f8754398655ecfa854ebd68c6c6e183f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25260.js", "upstream_id": "BenchmarkTest25260", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d656fccd064755a6034d4396d657193db08a45453de274671179cfe3fdcf54d6", "structural_hash": "75dc0d8a061df7e21c71276a91d7a11a2e479be3bc462fb412a84b9a07d99f46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28834.go", "upstream_id": "BenchmarkTest28834", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tfor _, a := range []string{\"read\", \"write\", \"delete\", \"admin\"} {\n\t\tif a == xmlBody {\n\t\t\tRespondJSON(w, http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\t\treturn\n\t\t}\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad4bcc8a97fca94f1b4cac6fd9d5cd029602a890c95d393ca6c7f552aed04a39", "structural_hash": "b80c62acf13adb584780b0dcab9a4e99f058c85715873dec417647cbbca66e63", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21887.js", "upstream_id": "BenchmarkTest21887", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const data = await Promise.resolve(userInput);\n switch (data) { case \"a\": break; case \"b\": break; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "546d909bd5146e4df10687188e40d291b840668195b1e8c0d8d4edbc2a5ee2df", "structural_hash": "f4cd95c5c817970cc9e72efd6e532777c20d625da0993810a3f8d15cceccada3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13714.go", "upstream_id": "BenchmarkTest13714", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tholder := InputCarrier{UserInput: pathValue}\n\tdata := holder.UserInput\n\tvar result *string\n\trow := DB.QueryRow(\"SELECT name FROM users WHERE id = $1\", data)\n\tvar name string\n\tif scanErr := row.Scan(&name); scanErr == nil {\n\t\tresult = &name\n\t}\n\tif result == nil {\n\t\tc.String(404, \"not found\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"name\": *result})\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7807ead5a23b851020a5db550cbad44c6cbc8c83bdfc56f0b17d98e3876e116", "structural_hash": "b5058527632edc041e8443d965a88ffc7cc07ccedb8594b8112cb4cb5c9be7fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25218.js", "upstream_id": "BenchmarkTest25218", "language": "javascript", "code": "const jsYaml = require(\"js-yaml\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n jsYaml.load(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fe73e0e3769e68e73a20c4ecf66581c756a0007502c99d7cef8f8c6bd1031d7", "structural_hash": "6544526c5f529e26696d1ae91c6e3390bcd59dc340989527994fd3a3716250da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05847.java", "upstream_id": "BenchmarkTest05847", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n String data;\n if (forwardedIp.length() > 256) { data = forwardedIp.substring(0, 256); }\n else { data = forwardedIp; }\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e77c19f603bdb67d481f9902aca5514cbeb872350346a4aaef6d5f80ace82c80", "structural_hash": "b7a77a75a66e2fd1ba587f21fed26bcb6faee2ce69060daa46d66a8a8fb29028", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02001.ts", "upstream_id": "BenchmarkTest02001", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = String(userInput).slice(0, 200);\n res.send(nunjucks.renderString(data, {}));\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "809bb3b85d7227aca1500d3b931f0af3922fe9e8f9df0ab8790f09c79eb8d43a", "structural_hash": "7726e95ba4b637f96202225951850864ae72ef412780c7b5c0c5631d72dc2692", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10395.js", "upstream_id": "BenchmarkTest10395", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba3ed736b673e191f7ca0d32b7e91aa05b15850e4eedcc7594c59793637a7367", "structural_hash": "9367c697bd9d09d9b50657c9699d488933ef013e772d59906ebfdd1f182013d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23996.go", "upstream_id": "BenchmarkTest23996", "language": "go", "code": "package testcode\nimport (\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\t_prefix := \"\"\n\tif len(hostValue) > 0 {\n\t\t_prefix = strings.ToLower(hostValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = hostValue\n\tcase \"f\":\n\t\tdata = hostValue\n\tdefault:\n\t\tdata = hostValue\n\t}\n\trequested, _ := strconv.Atoi(data)\n\twrapped := int32(requested + 1)\n\tc.Header(\"X-Wrapped\", strconv.Itoa(int(wrapped)))\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edd546a1e72e1a1e1ae618300da494a7834b4d5c064dc14e91660bc58660f272", "structural_hash": "c6dc158d08af2a6423ff9db54ca9300b5d84db012a671d138ba0b6605e60b7e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31726.sh", "upstream_id": "BenchmarkTest31726", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=\"${user_input:-default}\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0439189ed08e657fa5994f29f5d6c42543f03450855f76ecd8a237bb2ed2070", "structural_hash": "8255a2f5e6b8082fab6a8724590df419cc002f0b34ca1f36770ee53cecf770ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05234.go", "upstream_id": "BenchmarkTest05234", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(jsonValue)\n\t}()\n\tdata := <-resultCh\n\tif data != c.GetHeader(\"X-CSRF-Token\") {\n\t\tc.String(http.StatusForbidden, \"csrf mismatch\")\n\t\treturn\n\t}\n\tDB.Exec(\"UPDATE users SET name = ?\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48703bd92a3ecfdc6768738207efabe887b509b5a2defdf3e76b8d6451607e3e", "structural_hash": "c5967384c06cf28487f4441f9efb68672478d809b2649743c3e2ca8a243581fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04285.rs", "upstream_id": "BenchmarkTest04285", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n let data = config_value.to_string();\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7ac9980bd8040f5c4c73a1da658cc825cf2915d385036f4243956f20269ede0", "structural_hash": "9cad2efdd28a0a9c6e870dfdcf30130311c9cabec7215381311b72cdd299f677", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01732.go", "upstream_id": "BenchmarkTest01732", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar data string\n\tif len(jsonValue) > 0 {\n\t\tdata = jsonValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "42351c0f7a5cd3735eb4a0a076c3a8a6fdc4e1c04ed9b484867718843a5ab3aa", "structural_hash": "98eadeeb45c1ca37db16a21e3f13909594d5aefdff2304b885c6b4ab2ba84196", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05664.ts", "upstream_id": "BenchmarkTest05664", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe, BadRequestException } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const data = userInput != null ? userInput : '';\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47e2c9cae19731bb40d10eff896ff40ff8ff5090000bf00a88440c8f1735255c", "structural_hash": "9b894cd562d84c20eba23de42719a528282d3b84ed41f9acad2ab19f7e2f3f3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02890.ts", "upstream_id": "BenchmarkTest02890", "language": "typescript", "code": "import { Controller, Post, Req, Res } from \"@nestjs/common\";\nimport { Request, Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n res.set(\"X-Custom\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9f5323e8b660078401116b00d55f5eab93f56fa02f2de078b5fd1413320eff1", "structural_hash": "bd23dc02d93935269f027a6d985eccaac78429e3e1fde715556a0427a486dc7a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00196.cpp", "upstream_id": "BenchmarkTest00196", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.path_params.at(\"id\");\n std::string data = !user_input.empty() ? user_input : std::string();\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + safe + \"\\\"}\", \"application/json\");\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4eb7f2b77ea74a412d338b52acdc2fc9400ccd498d3841224c6e39a136319623", "structural_hash": "6fa2c1332e6402d3be55a222138d7139b36d69c5a8c9b396e85f6eaddf5d2a33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01471.php", "upstream_id": "BenchmarkTest01471", "language": "php", "code": "headers->get('X-Custom-Header', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04d241fcbd4e9366289d3fe8dc04c8cd832a7d261a9eac2e43a8c7b6ec50ad6d", "structural_hash": "2648110326c2634a45b82b794a3b15b407322b7c7243a4d3be62754e693ef46f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00023.java", "upstream_id": "BenchmarkTest00023", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.List tokens = java.util.Arrays.asList(cookieValue.split(\",\"));\n String data = String.join(\",\", tokens);\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d166803cd7bb7f23d213845d54ff18cd57a7a835e7ba0d32e1921c2f58b5f56", "structural_hash": "a674cf2caa2f5871ac71c65464d43e3457a5fcd26c4b17f5f07ec5fb3be6bea2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03455.rs", "upstream_id": "BenchmarkTest03455", "language": "rust", "code": "use axum::extract::Path;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(Path(path_id): Path) -> impl IntoResponse {\n let path_value = path_id.clone();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", path_value));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d5813e8e1a2937f24c9a8541bb059ea32b88c911b78ea66c6e53ee0e3b8a57e", "structural_hash": "bdd47cecacf6d64ebc60507277b497c7041eba6537bbf340a9860537d8b6112d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02967.php", "upstream_id": "BenchmarkTest02967", "language": "php", "code": " $v;\n $data = $transform($userInput);\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc0247399040fab64fff6df90aac655fef5382903a13cc0ccbe2161a3781c641", "structural_hash": "2f94151de84b895fc4e7720a346497cd4b782696bdfdae21740b54b8f5c6194f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04649.java", "upstream_id": "BenchmarkTest04649", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.util.Properties property = new java.util.Properties();\n property.load(new java.io.StringReader(\"rawValue=\" + refererValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", property.getProperty(\"format\", \"plain\"));\n String data = property.getProperty(\"rawValue\", \"\");\n if (!(\"true\".equals(data) || \"false\".equals(data))) { response.sendError(400); return; }\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e22c2ca1bd6230e8070d5422797c525608e468ecb0d98f0791cf11de206ba3f", "structural_hash": "f2db15abc21a539a42842d539e16c05aa506c3c270ec0a0208878ee505e73c56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00382.rb", "upstream_id": "BenchmarkTest00382", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = user_input ? user_input : ''\n unless session[:csrf_token] && Rack::Utils.secure_compare(data.to_s, session[:csrf_token].to_s)\n halt 403, JSON.generate({ error: \"csrf mismatch\" })\n return\n end\n DB.execute(\"UPDATE users SET name = ?\", [data])\n end\nend", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec2e0a836257ae19a2053cad4bb107147ad126451398a30b8b6ac809d9f386e1", "structural_hash": "e371234c7430db35aeb41ecbe1ab6b64eaad11fa82a9f4fc32733a21c1bf99e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00269.c", "upstream_id": "BenchmarkTest00269", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37015f97e039a6850442282ad2e5f7a5c839fd5d19e4ad5998dc8e217ca7c4c2", "structural_hash": "0e4e640690c40a6191e571278729563acc709ef8fec331cd64e239f3c562ccb1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_23721.js", "upstream_id": "BenchmarkTest23721", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3781138152a3318706ce0a18cd20fbebc26857eb8432e52bce837ff89d18906", "structural_hash": "a1d9b9d71ba260e45e746ffe598fa10b7c89148119e957ffdb88e49ae1868a71", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02194.rb", "upstream_id": "BenchmarkTest02194", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = \"\" + user_input\n eval(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c1f3612b5d0c6fb1ff687b42bf59945c707f61f4807c6b38d637b9f2f38b676", "structural_hash": "8b6dffceb1b8079df29c37fb88323dc23fbdeaee5ec7bb33a99173aa162c7adc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02850.rb", "upstream_id": "BenchmarkTest02850", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = format('%s', user_input)\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n eval(processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75f6741276a86ec36307c1350100ad6cded23e41db98731ccc272559722d2e3d", "structural_hash": "1acfa96bb9930887b471c8d51a145e12c4ea00a1d18070ab6ff77c0c500d3535", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03957.ts", "upstream_id": "BenchmarkTest03957", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = nodeUtil.format(\"%s\", userInput);\n Buffer.alloc(parseInt(data, 10) || 0);\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "074c024923de73d9d98976d925645d0ac81dee5a75cc00e7365ecb37f2f04385", "structural_hash": "1504a4e88341a1c4ac1111f11ed5ebc3ed204092807d0226fb0e8603f36d3839", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01951.rs", "upstream_id": "BenchmarkTest01951", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let captured = env_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n let _crlf_stripped = data.replace(['\\r', '\\n'], \"\");\n static _RE_REDACT: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[A-Za-z0-9]{4,}\").unwrap());\n let processed = _RE_REDACT.replace_all(&_crlf_stripped, \"****\").to_string();\n log::info!(\"User action: {}\", processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc4ae183478fb95087076f8d856708c2c60b81d554a09c9b097a56585d61bd31", "structural_hash": "98d38d40aefa2d212744fd2a577e6739222a048dd769b316da4fa0b1a04d51a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17001.js", "upstream_id": "BenchmarkTest17001", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n fs.chmodSync(\"/var/app/data/resource.txt\", parseInt(data, 8) || 0o777);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50fc102df63a96332905d65f78ec1b9331a40b79b0d5002b8fb766cf1b542c12", "structural_hash": "f4ca64c7a744e216df1fb9cc6d020d43495e5f7c02d40a8c6e152813c26a0903", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01035.ts", "upstream_id": "BenchmarkTest01035", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = referer || \"\";\n const data = String(userInput).slice(0, 200);\n if ([\"https://app.jscdn.io\"].includes(data)) res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7680123595d71d1d9b7e54615b87438d83c2d7a227b01d4bbb11439415df867a", "structural_hash": "69bc24e4ec0315b7f7e324439d4f25ee52ac62debb5b05989d1275029838a4fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11066.sh", "upstream_id": "BenchmarkTest11066", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56e5eda97c06390a142dd46a56ecadb4e7dfcabf60fc3e35b10f4957af11c12f", "structural_hash": "d45695f69a6127e25c6970d94063db16c1a565afae71e776477ce6d9d4c7a3c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02163.php", "upstream_id": "BenchmarkTest02163", "language": "php", "code": "cookies->get('session_token', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (empty($request->getSession()->get('user', ''))) { throw new HttpException(401, 'unauthorized'); }\n error_log((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35cfef807c5206c585ab728f163416cb65d13657bd451bd95ee0869dceca024f", "structural_hash": "9bd4a9a872f3579048dab6e9c3b5a84a0392935316c4cd003326f3b2ed5240dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01530.rb", "upstream_id": "BenchmarkTest01530", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n Net::HTTP.get(URI(data))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25ece83eb58c2b42b99da103745d7bf15d56607b692a22bb5c72f0c904d3acbc", "structural_hash": "eb1488f04a1c3702ec6b3b4be9502fee89c758288a3144bb488efda943fc73a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05387.py", "upstream_id": "BenchmarkTest05387", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nimport re\ndef default_blank(value):\n return value if value is not None else ''\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n data = default_blank(host_value)\n processed = re.sub(r'[A-Za-z0-9]{4,}', '****', str(data).replace('\\r', '').replace('\\n', ''))\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cc3d6a6a5aa2844d7a0f808ec0aebf42cf7784869a9a5618a37b2efd20709dd", "structural_hash": "52b179ecef6b382e9e4b379684f6f3b84458dd55371b910d222afe5488b90efa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04506.c", "upstream_id": "BenchmarkTest04506", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n int _d = atoi(data);\n if (_d == 0) return;\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1758358196f83c84d3bdf1836c67b9e818fbe64ca037f2ee7c2ef950ccb56bbd", "structural_hash": "ebbdb7596faaa794f1063b47684de16f500134acfa73877f107c965b3d13deef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest06098.java", "upstream_id": "BenchmarkTest06098", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n String prefix = uploadName.length() > 0 ? uploadName.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = uploadName.toLowerCase(); break;\n case \"f\": data = uploadName.toUpperCase(); break;\n default: data = uploadName.strip(); break;\n }\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f3ecebafee14a6ad938b2c565b826571e5398941be3e7e08c3fd85784f29a5d", "structural_hash": "f8170eb378e543cba9d69d3854df1d728cb500724aea0bfa0e88da6146f70d91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02513.rb", "upstream_id": "BenchmarkTest02513", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n cell = data.to_s\n cell = \"'\" + cell if cell.start_with?(\"=\", \"+\", \"-\", \"@\")\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [cell, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4da44d5c2adb935388085eb800a62b3f267803c5156830b2e71a65b4ded954b0", "structural_hash": "334ca2e578cce842ae9d2529ffe0372d9e1cc40c4aa7322eec2cc3aed5596aba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05293.java", "upstream_id": "BenchmarkTest05293", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = userId.isEmpty() ? \"default\" : userId;\n java.util.Map records = java.util.Map.of(\n \"1001\", \"alice profile\", \"1002\", \"bob profile\", \"1003\", \"carol profile\");\n String record = records.get(data);\n if (record != null) {\n return Response.ok(\"{\\\"resource\\\":\\\"\" + record + \"\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(404).entity(\"not found\").build();\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:idor", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92e8bddc79ab6fa24871e5cc0ff569ff2e00388a13d1d9860451d7aabc36a404", "structural_hash": "62f9c3456051ebfd658db1030f3a9e6a596222520e747e08df933e621f040462", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01685.cpp", "upstream_id": "BenchmarkTest01685", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n long _oid = std::strtol(data.c_str(), nullptr, 10);\n bool _allowed = _oid > 0;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0093a49bc2fa1743c9ddba1c059571f65a85ddbf0a3881232b6ae2c784f37ba0", "structural_hash": "2812d5ab2999c4153933199c20574a168fd090f68b7352a6b05a78612b4285ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33653.js", "upstream_id": "BenchmarkTest33653", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7757eac1d4deacdc6db2efa0392f27898e0aa49e622c99ee27d1e60505a2670", "structural_hash": "ab91a24e2aabc2c79894be63b7a2842ba52c09bbff9b86510169731f704f0ba5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02986.rb", "upstream_id": "BenchmarkTest02986", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nrequire \"net/ldap\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8b4a30323bc2dd11bf0a45af1143ea2ba3645ed703e7bb9ea19ed30835fa060", "structural_hash": "861fa69d6f4e1d3a9781693ddc764bd45800a17045859d3cc1bf33fe8fc1a59b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02854.py", "upstream_id": "BenchmarkTest02854", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\nfrom types import SimpleNamespace\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n ns = SimpleNamespace(payload=header_value)\n data = getattr(ns, 'payload')\n store_cred = os.environ.get('APP_SECRET', '')\n auth_check(str(data), store_cred)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39b3cb1fdf9b59dbe8d60150c892233e15648efb9a0a3725875c008ceb5ce22b", "structural_hash": "91246398be3f730b8c3d91e13938ca0882841634476736c0283f64a83cdbd7aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01811.php", "upstream_id": "BenchmarkTest01811", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "184cadead0a5c061d94d5dbe5b0c97f54333a092542b14a91fbef33c90081141", "structural_hash": "fa6e4d62556c0d9ca95d4a19bb4bc75094386b82c3fc3d45bce29547e6ff5bf0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04112.go", "upstream_id": "BenchmarkTest04112", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tcapture := func() string { return fieldValue }\n\tdata := capture()\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e787b48973a49a925102bbd09e7871d6444f0f1ee34490f80621ca08798c607", "structural_hash": "1028015d2e7a8acb188cdf351ab2fa755b3ed705ad79fb3d00645575fa27d5da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00533.ts", "upstream_id": "BenchmarkTest00533", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n if (!shared.authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3b1a203af5db969ce6768a7985bd5e58b967808939199a979e2c835c644a614", "structural_hash": "ee3fb49eddd82a5061c521f811df41118fbecb16e168109a6e483ea848516d61", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03381.rb", "upstream_id": "BenchmarkTest03381", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"shellwords\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n data = \"%s\" % user_input\n processed = Shellwords.escape(data)\n system(\"echo \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1118f25b8f2923bbefbf623595ffcdd334685a610e4481eea55f8212cc457c10", "structural_hash": "39027772b530513bd9d2c00841e20980a3182f4ab338babb1f9cbcb41601d765", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03943.c", "upstream_id": "BenchmarkTest03943", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n free(_p);\n}", "label": 0, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f57990990b322dc8a2ab5d7b318fae9541f4bbb0fbb5599253b52f4035e36bb1", "structural_hash": "e4d69ef6c11c73b0e984bbdba4360931abfcac87329c1886bdb7ab1fefcb06db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02965.php", "upstream_id": "BenchmarkTest02965", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $data = ($userInput !== null) ? $userInput : '';\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ef62dcf7327f7a74538eec93a03f76a972debe5aa31fc71917bf98ae353f2ec", "structural_hash": "6ce0680779db806f9a694cde8943339f7f13d5ff6f3f21730e47decc7f67c803", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01224.rs", "upstream_id": "BenchmarkTest01224", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse url::Url;\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = urlencoding::decode(&field_value).unwrap_or_default().to_string();\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return HttpResponse::Forbidden().finish(); }\n let target_url = data.clone();\n HttpResponse::Found().append_header((\"Location\", target_url.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e3f92409464f6e87d69a4e351ba8080165102bd0664481d9483f10be69a674a", "structural_hash": "e2fc0bb85971680d299e9b0594ef5c95bbe9891d112d1aba90d6db373fe96a49", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27123.js", "upstream_id": "BenchmarkTest27123", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n const _cred = String(data);\n if (authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c7ae1da1a51d3b017800ac5eb5cc34aa2c1a355f22a1c15d04511aa745135fd", "structural_hash": "ff5aae9c0c2db9f78c4114b271cb556d8715e57beb614c708694a825ff233171", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27938.sh", "upstream_id": "BenchmarkTest27938", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8130bb2489993ea983c8e977ca746c8b69e2e72708c102a78913f368d5826cae", "structural_hash": "20df0ed6364eef685f4361bad8721085421c102b2a126bf4520799ca19ebacc2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00115.rs", "upstream_id": "BenchmarkTest00115", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = json_value.to_string();\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a08ef6a4d59c43acdc8869c420f1816cc74ed4e58090d01f1cfc5e7d74b5cf9d", "structural_hash": "ba993fb4841e9e86d8dd7851ba9c343e90a988c128c133f10ee761bbf09a3003", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00655.py", "upstream_id": "BenchmarkTest00655", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n reader = make_reader(user_id)\n data = reader()\n return HttpResponse(mark_safe('
    ' + str(data) + '
    '))", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74b787e9660c173b78f2b17d67a5fa5b6197cc0a9ed8ec8503b813e1bcbba96b", "structural_hash": "75949626b2dde3e97e5aac2538ac7f7bff2629d7ac70208361ab51281442ac53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04304.py", "upstream_id": "BenchmarkTest04304", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n data = '%s' % (forwarded_ip,)\n buffer = bytearray(int(data) if str(data).isdigit() else 0)\n return jsonify({'allocated': len(buffer)}), 200", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc20da0e60111aa5c6f7a004dfd20bc890c61bd9f5571133e30b421edb89a341", "structural_hash": "6dd74c71103a1c1b9d05ee743c4463c1a869383ed944abb9abb6ebc9efc2d4f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03897.ts", "upstream_id": "BenchmarkTest03897", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0cc5221b01770c3da9fd5118f264d467275d60b66a91cb73ef518d7cbad7251", "structural_hash": "fc8651fa29be649f0b0e93bb944384d29821a8f603a2a762de97c5426d0aa14c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07118.c", "upstream_id": "BenchmarkTest07118", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8a111fcd4c58407d5eecedcdda118bf699ebce2cee37cecabbb11154ae1a1ec", "structural_hash": "17bcffb966f471ac1df4987f5d5f3a1f696802c6c3e76d6337548bdbc0d947be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02249.rs", "upstream_id": "BenchmarkTest02249", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match origin_value.chars().next() { Some(_) => origin_value.clone(), None => \"default\".to_string() };\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95fb52851cf31e41908d972dba0d9f22ff7fa1a8cc3c8003bb6707b9e0869ce8", "structural_hash": "7c2dbac8bf7ccd2dc117294c7a548b8b9e6d60a3d62e4b1f002c9c84976d7942", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01519.ts", "upstream_id": "BenchmarkTest01519", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n fs.unlinkSync(\"/var/app/data/\" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1665a1d75a71a6fc8dd37e0799b283263f7829f979c924396e442e177acee77a", "structural_hash": "fbd8fc693a23029fce33542d67e328e0c1b102381b2dce2a89b38dd0c25b260f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14638.js", "upstream_id": "BenchmarkTest14638", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n try { JSON.parse(data); } catch(e) { }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be70aa20eea1a4c5b9441a868787d2252db462aa72d4bf4fcf39356bce1289a9", "structural_hash": "a953d214e02c2dcab9d02a32ffc67a1739494259d22a785e324c2528f40b9905", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03650.rb", "upstream_id": "BenchmarkTest03650", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n _resp = URI.open(data)\n _body = _resp.read\n _expected = ENV.fetch(\"FEED_SHA256\", \"\")\n raise \"integrity check failed\" unless Digest::SHA256.hexdigest(_body) == _expected\n ActiveRecord::Base.connection.exec_query(\"INSERT INTO feed (data) VALUES (?)\", \"SQL\", [[nil, _body]])\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6ee9506aa9912b77f3a38a52b0454e8d7128108cebf7ced3c0effb8f1eaa20f", "structural_hash": "2203b4cd7703c2d32da8d8f37963525157baa8349da4675bfbbc2eacccfccb5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01509.rb", "upstream_id": "BenchmarkTest01509", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n data = \"\" + user_input\n render html: (ERB.new(data.to_s).result).html_safe\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8380d91b4b556fa6ce515740e2c34735e24ecdfb408e4d45edf495557c254b2", "structural_hash": "61436b2547c294c5d4c2cbf7fb546f3115cc2dc100d08265c576d5cc3b703418", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03584.rb", "upstream_id": "BenchmarkTest03584", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = format('%s', user_input)\n result = DB[:users].where(name: data).first\n value = result[:name]\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09804bf74e1220afbecffd05c06d90927f1a8a32e54110637816dca35666c256", "structural_hash": "5e71be8332e8e3bc0d24d7f9880b19429f16b87a9c5676d5bba5d372af2b2267", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03911.js", "upstream_id": "BenchmarkTest03911", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (!/^[\\w-]+$/.test(String(data))) throw new Error(\"processing error: \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19d63d3bc1414bedbf5a9a2b883e0d9e22502bdd47d570e06a128711bc38a344", "structural_hash": "db2e67d7da72cd48f75dac9df3f08c0d86826d6d5567ab603b855cf238a3c3dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_11445.go", "upstream_id": "BenchmarkTest11445", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(cookieValue)\n\t}()\n\tdata := <-resultCh\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\thttp.Error(w, \"invalid option\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tw.Header().Set(\"Content-Type\", processed)\n\tw.Write([]byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1de10e8dc101f0415613527fdd150f233af7395131e4aa6f698b92237e0b8f0e", "structural_hash": "9603a9546a40819e892cef855bf8ae15afb88350495f56217cd2457f869cce24", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_41926.js", "upstream_id": "BenchmarkTest41926", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = `${userInput}`;\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e07c3779bdbba17dcee1952c1ac3b1d642cd375ee24b2415cba90a2d36804f6", "structural_hash": "da64d2386f70130877593537ad4b24fe7ab681d26cef8158ea8795e87a665397", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00208.cpp", "upstream_id": "BenchmarkTest00208", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39195c185120f93e88d11fdca98af245a59efe6148b149e08372a94922fcb142", "structural_hash": "5321263ca03fd6b6dbc18da7677d65fbe33cc990d1196960cda691862cf71ac9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01128.php", "upstream_id": "BenchmarkTest01128", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $data = sprintf('%s', $userInput);\n return new Response('
    ' . $data . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d30ca37804a4b730a19566daf8c5d1c9c8dbd3a3bf165546205798a21f134ca", "structural_hash": "c42aa9ef8ac0042b27159b05a8ad8ae2a4c588567e3990f2cd4957909bb8f815", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05144.ts", "upstream_id": "BenchmarkTest05144", "language": "typescript", "code": "import { Controller, Headers, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string, @Req() req: Request): Promise {\n const userInput = origin || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b036d903c9109a321f89d658401e428491a874e30d2187385fa892d72c3f47d6", "structural_hash": "86fb06957bea3046c2c439e52ae534dc057c09ad75949962f04bdf92645d5ecc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07306.c", "upstream_id": "BenchmarkTest07306", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char _bn_copy[512];\n snprintf(_bn_copy, sizeof(_bn_copy), \"%s\", data);\n const char *safe = basename(_bn_copy);\n FILE *_f = fopen(safe, \"w\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ca147156aaba4dcdf06a9c19c333f699c353c875eb43b1342fe50f03aea017f", "structural_hash": "c4fad2621e1abf3c2ac2227614e40700ae950067e99e842ad3b547f6db399ca0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03800.cpp", "upstream_id": "BenchmarkTest03800", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n std::string _cmd = std::string(\"grep \") + data + \" /var/log/app.log\";\n FILE *_p = popen(_cmd.c_str(), \"r\");\n if (_p) pclose(_p);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e93ff642b0a9c8723ad55a51e48b01553e9a3aa69c1ab258201c19d6c489d8c", "structural_hash": "160483c156b76a5a84621f264eaf36694e72fbddc346bf241f65a75fa9c3bf31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02904.rb", "upstream_id": "BenchmarkTest02904", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f607f30c63c50529ebf0e9a1b3f6f583289fb275305592f167ffb5445aa1f984", "structural_hash": "ee5b9369ae8f45307707780bcd3270911f9c9eb57c3586098b2cd4fb5650ca0a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01922.cpp", "upstream_id": "BenchmarkTest01922", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2131b1faa84bc3331e139c440acf53473f74e69141507b5566282281751f51a", "structural_hash": "1cbd7d5e753e24997dde29c5767381c4b8de4aa4d8687e942a587927ffbb356e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03027.rs", "upstream_id": "BenchmarkTest03027", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse rand::Rng;\nuse rand::rngs::OsRng;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = forwarded_ip.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => forwarded_ip.to_lowercase(),\n \"f\" => forwarded_ip.to_uppercase(),\n _ => forwarded_ip.trim().to_string(),\n };\n let _token: u64 = OsRng.gen();\n crate::shared::store_session(&format!(\"csrf_token:{}\", data), &_token.to_string());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8ec41d6f5f4374415ca00322e65b1e80a6099d283dc6f6f536670b6c199aee8", "structural_hash": "5a7a81ea74ad119eb652eb9b73e740a5daaf20f5ca889cfe1e9df2f7233b67e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00240.rb", "upstream_id": "BenchmarkTest00240", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a7146deea1b243d2a03ad218c8ba8ab6bb0a3a79b020da4afc911ec3f2caea8", "structural_hash": "5bf5999ebce180b498eb8710ee21d3b531f424a082b9d5497b7dd0dfaa2181d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04875.js", "upstream_id": "BenchmarkTest04875", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const _dot = String(data).lastIndexOf(\".\");\n if (_dot < 0) { res.status(403).json({error:\"message signature invalid\"}); return; }\n const _body = String(data).slice(0, _dot);\n const _sig = String(data).slice(_dot + 1);\n const _expected = crypto.createHmac(\"sha256\", process.env.MSG_HMAC_KEY || \"\").update(_body).digest(\"hex\");\n if (_sig.length !== _expected.length || !crypto.timingSafeEqual(Buffer.from(_sig), Buffer.from(_expected))) { res.status(403).json({error:\"message signature invalid\"}); return; }\n const verifiedMsg = _body;\n require(\"./shared\").sqs.sendMessage(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\", String(verifiedMsg));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "328394c20bc069b22a5d55cd52e26cdea3a811079e784a9530bd53c935e146e3", "structural_hash": "15819e65f3cfd7c3fa0e5e882c2ee591d3da56306189c9b8ff6185f220cd1142", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03403.go", "upstream_id": "BenchmarkTest03403", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/text/unicode/norm\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tsegments := strings.Split(refererValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tnormalized := norm.NFKC.String(processed)\n\thtmlBody := \"

    \" + normalized + \"

    \"\n\tc.Header(\"Content-Type\", \"text/html\")\n\tc.Data(200, \"text/html\", []byte(htmlBody))\n}", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85e298bc34f156a1ddc09046b702cc442562c903f14409b65de9661d4e0c6cd4", "structural_hash": "25b56464f7f991837c00e287fac0864342b5279a8d2f92d905234200b21f3f08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03828.rb", "upstream_id": "BenchmarkTest03828", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n DB.execute(\"SELECT * FROM users WHERE id = ?\", [data])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa4557a19cb9cc79ea6dec5b9cad1ce955f77cd2f8de71847663a0c40a2bf6a4", "structural_hash": "c2baa344bfa3a603b18df9f70e041d5b390176a67301a4a6c60411dc02580bca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05567.php", "upstream_id": "BenchmarkTest05567", "language": "php", "code": "json('variables.input', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return response(\\Illuminate\\Support\\Facades\\Blade::render($data))->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06665297465f39e1f72244b42e6baa946d2a2b077705f2c2c5add1276cd77f04", "structural_hash": "16f6c77b9bf6438c41b7b893ee69fa5e2b2472eed6f739c2ca13e4eecd29f85c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00725.rs", "upstream_id": "BenchmarkTest00725", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = forwarded_ip.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f07b01238a0896d47c5549d3bb59dd5a50f4c73d50fca03d0e25a24dad18097f", "structural_hash": "c56dd6f283d3f1f3a4fe2b3e0d3a554317fed94c1823895e387a71da533e7d89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10944.sh", "upstream_id": "BenchmarkTest10944", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n rm -f \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb0cf728ebb12c48cd975d1518e98f11939e47de43b04ca07e68037919129684", "structural_hash": "887fb1d0d57c1701e6875c40aebf23e7d4fa3cce5cd3b8a38878b0b6e3e5bd05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03994.java", "upstream_id": "BenchmarkTest03994", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String prefix = xmlValue.length() > 0 ? xmlValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = xmlValue.toLowerCase(); break;\n case \"f\": data = xmlValue.toUpperCase(); break;\n default: data = xmlValue.strip(); break;\n }\n response.setHeader(\"X-Frame-Options\", \"DENY\");\n response.setHeader(\"Content-Security-Policy\", \"frame-ancestors 'none'\");\n return Response.ok(String.valueOf(data), MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "010dbbdd3472681f9ba8b5db5c541e4158361c7366046376a2cca03aa45d8e1a", "structural_hash": "71d8d71d7b371e132c7b9306995318c74e24105ba810445c76405ef0a74c0ea8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00169.rs", "upstream_id": "BenchmarkTest00169", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = auth_header.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n static _RE_SCHEMA_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[a-zA-Z0-9_.-]{1,256}\").unwrap());\n if !_RE_SCHEMA_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::set_cookie(&format!(\"session={}\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3650fa6048af6f65c2c89aeb2afb39a23fce9781c0ddc06f6edc4a6c8b61666e", "structural_hash": "5e76a5b287d1f7c9937ee43e484668d3b971cce564702fed99468fccf393240d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16719.js", "upstream_id": "BenchmarkTest16719", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const data = userInput != null ? userInput : '';\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.send(\"
    \" + processed + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47fce90ef65df9f05b697a5b90cfc352ad7d5cdda64f8f192a615f588c63895d", "structural_hash": "35c0ef86eb512cdf7f46db136642d0e8c9204d226d76f0be0db43e611290f282", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04946.ts", "upstream_id": "BenchmarkTest04946", "language": "typescript", "code": "import { Body, Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n db.collection(\"users\").findOne({ name: String(processed) });\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b9cf915aa4628c05b38e398915e14402776efdd07a66574063c3a5725e2291c", "structural_hash": "8e3712291a253046381d6297e8d8b3f5e2d644d7428c83de0ce8834c0b79c158", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01542.js", "upstream_id": "BenchmarkTest01542", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (!authCheck(data, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-308"], "category": "single_factor_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5437c29cac80f07555905f49673149fc2cf662daa0d8d3713c0ff26c5f0925bb", "structural_hash": "b5a16d5954fdf6cb1a568278afa8162347d73159d6d6d04d52a6eb40b90950ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05502.rs", "upstream_id": "BenchmarkTest05502", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = serde_json::from_str::(&graphql_var)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67d3b538e15d5e9c8e4c3fe8472ea309015719d3c57755d5236d547db84da256", "structural_hash": "99390b4ac9374fe8668a63e5b5b07e7fdaf9813089f6e42512eac8958c9722db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13677.sh", "upstream_id": "BenchmarkTest13677", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n ls -la -- \"$data\" 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb9d3d8647104af09baeac59439f1f0e42e7fb3cd2bc766be9047074d4855ffe", "structural_hash": "f5f6ceb5ffd4b3121161b744c9f15f858c780dceb9a47bcaba7088610c74ff65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02279.rb", "upstream_id": "BenchmarkTest02279", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n DB.execute(\"UPDATE users SET name = ?\", [data])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed7d9b7e2895eb39fd417917c4344c3b30b923e5d74fb3fdb8d5fcec4b5b8ec3", "structural_hash": "0ff8b2c16935cde8a21c1e0f78045b14cae378797bbef67c9a9a88ff3a577b20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03577.php", "upstream_id": "BenchmarkTest03577", "language": "php", "code": "header('Referer', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f90bbd08762c05bb696948004efb2322e7cd1646ab32c2619f2079f0c03d54a", "structural_hash": "d9d78bc0c8490f82efefd2a1b7b0d9370f02d28e983caff5d4da8a8b65d55d97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01808.cpp", "upstream_id": "BenchmarkTest01808", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n std::string _truncated = data.substr(0, 64);\n std::string _role = _truncated;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c7805005e822001c00eab32b664f104ff4d667482f5f5ab46f7a7d13136a7d6", "structural_hash": "97b77d27f378453ab580e186f485536a49b81045cd6b6f3c31afa337eaf4ffbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05213.go", "upstream_id": "BenchmarkTest05213", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(jsonValue) {\n\t\tdata = normalizer(jsonValue)\n\t}\n\tallowedBins := map[string]bool{\"ls\": true, \"cat\": true, \"date\": true, \"whoami\": true}\n\tif !allowedBins[data] {\n\t\tc.String(http.StatusForbidden, \"forbidden\")\n\t\treturn\n\t}\n\tallowedBin := data\n\tcmd := exec.Command(\"/usr/bin/systemctl\", \"status\", allowedBin)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef32baf1f220c3c2124d5d66176666271bda02b9bd9dc90d488d43d25754d29b", "structural_hash": "62a05244dfbf8f4217e083483b53d44142204cef371cc2a17d93d792872bd2ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03611.php", "upstream_id": "BenchmarkTest03611", "language": "php", "code": "query('id', '');\n $data = vsprintf('%1$s', [$userInput]);\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $data . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb596785d19d6f61f16312613876de537a00a55d8ba42df9719e56b6c782abbf", "structural_hash": "77fb49b05823db4455b78fd37e1dac72be48487b7710b7ae3975df6960f34d4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03956.sh", "upstream_id": "BenchmarkTest03956", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eceb6a35f6db58f6eedecf614c7429bff7191ef0c2d9fc72c782a29028d680af", "structural_hash": "2c4dee2cc8e3e9cbdacf50f2e8b8e2307b105b225e70e205c9d500053788b678", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00971.php", "upstream_id": "BenchmarkTest00971", "language": "php", "code": " 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8e537ba428d34fc327e904673d46a06210fcee4c81b80cf2013a61593b7361d", "structural_hash": "b12fe95408b47638a535049d9866237963b3e5100bfca320be899cea61ddec2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00096.php", "upstream_id": "BenchmarkTest00096", "language": "php", "code": "json('payload', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $cred = getenv('APP_CREDENTIAL');\n $_match = hash_equals((string)($cred), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ff7c1a2e98226c67e5e583386eba5418bd45eb0f13034aa8e9b3de50e2dd0ce", "structural_hash": "abca80f5252fd26f17ebaea7b58e465e25f3627eeaf4abeb8974e1308fa60c9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_11925.go", "upstream_id": "BenchmarkTest11925", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(authHeader)\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44a8ecd8e902979e1b332513e3de29871ac51bf6c53b7765f79a0bf444b21396", "structural_hash": "f4b50d6ab1e21d1bebb2a70f48ac30f64eca5d0f2e072efdb1b2d32b528745b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02451.php", "upstream_id": "BenchmarkTest02451", "language": "php", "code": "getContent();\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n return new Response('
    ' . $data . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f2cfc3132a069c8d3a4feee1013ec122769fbc3b3c5569cea14539fed480d9e", "structural_hash": "50d10b1548ba14b23581a89c670aa1638ba444ffe34b0a9f4859741592092d4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16000.c", "upstream_id": "BenchmarkTest16000", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", safe);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf89813265948ebff3ba1667d7ebaac0ac48e8fa57398ab51a8b48e6dc5e4ac4", "structural_hash": "97dd99631a987313b62ab8f3550bb97b8ebeed0f7b3db054189abe2f47639fd4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32552.go", "upstream_id": "BenchmarkTest32552", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tholder := InputCarrier{UserInput: pathValue}\n\tdata := holder.UserInput\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\tc.String(500, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc6feac33727ca2925ed311fbc732caf73590e7045229704cf2f86e1b6a1d0b5", "structural_hash": "2653bbfe5983b39f9da201b23e25ccfbd44c8d9eb8698e5b7324004084a0fb46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03768.cpp", "upstream_id": "BenchmarkTest03768", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d4cfc352cbd108848a202eeb85bd9adae5d9154766fe97aae8db0db07a6e97a", "structural_hash": "1227c135ad637af69d87f947d2a2eea8af3b6d559c953c810b33632befd5b428", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05621.rb", "upstream_id": "BenchmarkTest05621", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n DB.execute(\"SELECT * FROM users WHERE id = ?\", [data])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8d05879b11bd8d2280333c7041a7f0aba072f56076548802928145f991a06ee", "structural_hash": "51b4a3afd58f23f3ee45d04e968ff82f7b7f5d6fba1bf6734abb4e832ee1f48e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_22000.go", "upstream_id": "BenchmarkTest22000", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(originValue)\n\t}()\n\tdata := <-resultCh\n\tif !aclCheck(ctxString(r, ctxKeyUser), data) {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f99963a024a3ff2ee5fa86001adb8dcc0fa6095cd210eb3380ba742ddc8fa5e8", "structural_hash": "e1b858424d837149637cdf0e3edf8e5ad65c24e9cf740af1cd398204f229aa58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02172.ts", "upstream_id": "BenchmarkTest02172", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (!shared.authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed3da93d8f2d51e28360d5edf380e7ac36fab69efd7d1f068f96f7066ca2a7b6", "structural_hash": "72c854bcefffb39722480fe45e801651a7af9f5696890d73f785e7d4fdef70ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_23223.js", "upstream_id": "BenchmarkTest23223", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n fs.chmodSync(\"/var/app/data/resource.txt\", 0o600);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c51af194bb7581b6270ae91a1d00209bd7370f56358e6b56ddaebec316b03e1", "structural_hash": "a1967748a2eeb815ee779e66dfb78b08ea1f80849d2d4ab7704901508ced2044", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00366.rb", "upstream_id": "BenchmarkTest00366", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56608b143e544f91bed6160871ba6dfb747353bf7e7542cc102e445a04d38cb6", "structural_hash": "453842f844ac6474c9a969132bc91ed9559f400048bf5f68707685bd1b2a558e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02893.php", "upstream_id": "BenchmarkTest02893", "language": "php", "code": "json('variables.input', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3edc72158be3638b34b1e9549cce23e040d4e2d3bca097cc7871e497363cbc38", "structural_hash": "22ab38a0a7dc0c2947461be62279c2c8c2d0b802ebeb4b02b421d42616ac154b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04589.java", "upstream_id": "BenchmarkTest04589", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.List tokens = java.util.Arrays.asList(authHeader.split(\",\"));\n String data = String.join(\",\", tokens);\n Object evalResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f0ae9fed30625d8c6a1f2d232eca317cd1c8932ceb1b7e6c81e68095abba82d", "structural_hash": "3f87e7d60ce1833f0b0c83e91f6bb5cacacbd27dcc8fc6235086fd71299b0efc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19208.sh", "upstream_id": "BenchmarkTest19208", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/app.properties)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3310c90c1754795bd4e53255d1bc446347ca3cc28803f3b538ac793d8a2d6ea7", "structural_hash": "fc87f6d68c162fc208cd5151da46b788a9e6c381855d00479b6565f663164973", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05443.py", "upstream_id": "BenchmarkTest05443", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = '%s' % (raw_body,)\n subprocess.run(['echo', data], shell=False)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb970aff0fdcd63031dcc7cbfea28fd171f89856ce19eba897f17d7818f87575", "structural_hash": "e0e71b9605376cb7a6f4a2d385403c153e07211ec38e39a22fb0d72ad1690cf0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01583.ts", "upstream_id": "BenchmarkTest01583", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b4da83f8472cd8e844ff73cc2b4bfcb215bc32c8a693effca6de0fa8ed6bcd5", "structural_hash": "56541b36dd9f99547dcd45af52a41048e60ae363595e2983fbe7435e497b2e74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03911.rs", "upstream_id": "BenchmarkTest03911", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse hex;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = String::from_utf8_lossy(&hex::decode(&db_value).unwrap_or_default()).to_string();\n crate::shared::ldap_search(&format!(\"uid={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f15e3ad518fd40dc2caf81bb0329e744a00459df27b223debdc8df51fa55da92", "structural_hash": "e1d5e0f1c672cbb1621ab75bac90b659db683179cdd515dcc2d32c8e81dd2e68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01918.rs", "upstream_id": "BenchmarkTest01918", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = graphql_var.replace(\"\\t\", \" \");\n crate::shared::ldap_search(&format!(\"uid={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2740b0b1fa2e4b868f4242597e78f2ffa283c0783e5aa5baf448acda2870bfdf", "structural_hash": "1cb24b05a51263c4e31638563cef8eaaba3d5867645bd247fc4f96940fa0cd9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12587.js", "upstream_id": "BenchmarkTest12587", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = await Promise.resolve(userInput);\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(data, 10);\n if (!Number.isInteger(idx) || idx < 0 || idx >= buf.length) { res.status(400).json({ error: \"index out of range\" }); return; }\n const value = buf.readUInt8(idx);\n res.json({ lookup: value }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64e0cc2cc54bc0559c1f7626c23bead4f6914f1713b0a57e2fb0a4f0edb39996", "structural_hash": "4f2a6f1d83965f4bf68930b0ad8565d4729ccc427decc9126436e57ef0921e6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23338.js", "upstream_id": "BenchmarkTest23338", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e13227c58edc683daa4fe3182d26833d92356fadf192f5417006b496d9044adc", "structural_hash": "7d5c41cbe71fa79bffbdacd5d083b5c4da42120a3d514c19b392a2117fbedbbb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07073.js", "upstream_id": "BenchmarkTest07073", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const cell = /^[=+\\-@]/.test(String(data)) ? \"'\" + data : data;\n fs.appendFileSync(\"report.csv\", cell + \",ok\\n\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29b3ce5fe15a165d92a698725a231c9b990e59a0cf192cfa8fe8b8974e0c6110", "structural_hash": "eca5570628e66ae19af048ff4544e5109f6fc30a6e2719bb641acd3b3dacc7b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07766.js", "upstream_id": "BenchmarkTest07766", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a451f69e00e32ab6437f3fb252f01c3e3d9ed87d9f4ee682cbb0eb541d5390c", "structural_hash": "79045b54e588f2b135815ffa7204d92547169f06c5b22a44014a76b7777599f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09176.js", "upstream_id": "BenchmarkTest09176", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.redirect(\"/dashboard?hidden_field=\" + encodeURIComponent(processed)); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d363d5ea3a12c43d302568153573f52189f637e0081d31a69668749cf176c05b", "structural_hash": "d103b9c9654fe6a64c628122b9097d7081b217b2d1efc9a3df1fce095f1cabd6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05537.php", "upstream_id": "BenchmarkTest05537", "language": "php", "code": "header('Authorization', '');\n $data = str_replace(\"\\0\", '', $userInput);\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17629f8fabd4474259160f082d38a1ed9fa390d18f99e68ddaaff8260cc6fa6a", "structural_hash": "6ea7165636a3e60c1df8f681eae0fe063d9b143f380ad5087e97516537753931", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14488.js", "upstream_id": "BenchmarkTest14488", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d31eddc76cd4c7a2d89ef59e61bb7850136d3d6dffcf136bc468b7a1825e9dee", "structural_hash": "191a834fd7e70d3271b3d78fde7ff77eaee01284f68dceda0eb4954ae50771f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02753.cpp", "upstream_id": "BenchmarkTest02753", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9993867c8e26282c384359cb12e606ded736a37337c2196658ee6b30605eb23", "structural_hash": "0a2f48bdd5cf38c729ff4fd7e4f579f08d073d00b05467ea3caf62309d365c82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19306.sh", "upstream_id": "BenchmarkTest19306", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _bypass_re='^[a-zA-Z0-9 _.;|&$`'\\''\\\"/-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n tar -czf /tmp/archive.tgz $processed\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b27cdfc5fd33d6513ff10b0cc481fbe6c6f8b996f5840967b85cb454090d044f", "structural_hash": "542f7c1b799b323bc8ff3f477fbe72873bd8bd06dac0e0cb87c8b731baa704a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04637.py", "upstream_id": "BenchmarkTest04637", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n xml_value = (await request.body()).decode('utf-8')\n data = ' '.join(str(xml_value).split(' '))\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf55294fcee6d605fbf912683b55bc829e02a33f3cff2fc82367f59efb1cfa11", "structural_hash": "1b3ab7bec67ab5fc2ecd856b0dbb681714116084f4f627b198f69d48db4476a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04807.java", "upstream_id": "BenchmarkTest04807", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = normalize(authHeader);\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n return Response.ok(\"{\\\"auth\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53d483cee1d98f57bede6957bdc9188084b24ff15dfcf5bacd25ddc8bba84ec1", "structural_hash": "b2563f9585054bef4104258aaf13c8cb3c02760a09a18e1daf7f3af979543d1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03258.py", "upstream_id": "BenchmarkTest03258", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n data = str(path_value).replace('\\x00', '')\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2211bec485316cac5c068586b4155c9c55ed6d81583b0d5561e8ddf22793486", "structural_hash": "4a94894a6262bf93d6b1ab2fa538261f32a2818c5b326298b4f07689a6caf79f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00512.rb", "upstream_id": "BenchmarkTest00512", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n content_type :html\n \"\" + data.to_s + \"\"\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a6ed89a3fd1c0e5025ba502f7953009b0fa9115c8bfdcfa61445f069ae8e443", "structural_hash": "c466cc10b438a3e915a8bbdca4c4ab8b16470a77f87a0712cf8347f705ec61ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03503.cpp", "upstream_id": "BenchmarkTest03503", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n res.set_header(\"X-Trace-Id\", data);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d301a730ef083372ea3d0c7e3722acf7814bb00bfbae755cc0e95e706341e08", "structural_hash": "9cfd856f7c948ba24d6fedff6de502222364a2c207e47be1c2d4e12ab716cb3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01633.java", "upstream_id": "BenchmarkTest01633", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data = cookieValue.isEmpty() ? \"default\" : cookieValue;\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52d43e0c4d919295ca692e1c966914352f898f8f0944c801599afe0ee96d7093", "structural_hash": "7f63cc82db8ede0a1a0a2bc1e346892ff2981aeba4057dcf5ac07499f842e406", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00643.rb", "upstream_id": "BenchmarkTest00643", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n trusted_claim = parsed_bool.to_s\n render json: { trusted: trusted_claim }\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb68a2d8a25375bc3eb83952407be74cfde73de054f35197842127244dafb41d", "structural_hash": "59ca2f087bb9918c74952159d7452909dc117ab093dea04f0a31f20884d5d213", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05242.rs", "upstream_id": "BenchmarkTest05242", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse rand::Rng;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", cookie_value).ok();\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f134a48d65a571e6f2fb862269c408fe1fabfd9fb0331a53d6cd99211e2cc624", "structural_hash": "244be62bbc156a90d6e5beac3f52dfa636615e22f4ce4a52d959fa53aed687f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05789.go", "upstream_id": "BenchmarkTest05789", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(authHeader)\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tc.JSON(http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed00a8123408cee824af1ac4bf61e6a01cd1d7a70ac7c88bfc08023d538ff8bf", "structural_hash": "eb89189c01d3939e30b7a395903433700d11922c9d52fb63b890d6d6d63350bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02492.ts", "upstream_id": "BenchmarkTest02492", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as ldapjs from \"ldapjs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = Buffer.from(userInput, \"utf-8\").toString();\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + data + \")\", scope: \"sub\" }, () => {});\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c0700704b423504f6b2dfaae4e245adfd2fce587c16136ed021da3a47b72ae0", "structural_hash": "bb0f0d93c51560ddfabdbab25ce4e7479ca37f5d6e56c2af251b1d30282d1253", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04465.rb", "upstream_id": "BenchmarkTest04465", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = String(user_input).strip\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n DB.execute(\"SELECT * FROM users WHERE id = '\" + processed + \"'\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "366a1475348ad74c71418acf458e4e1b9622edf8219d91b4c7e8cbcfa29d10bc", "structural_hash": "da5bad9e74f4a5009d6208670e7be7d5583b156ffcd530300a4c7e844509d827", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03301.py", "upstream_id": "BenchmarkTest03301", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n data = str(forwarded_ip).replace('\\x00', '')\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d9cab1d1d300f8892302b5edacd4f4e30e60b4439a568570d413a93d55db759", "structural_hash": "80287e81d82dfec2d9aa80521caeac0cfc6ed420d9f8f35d11a7ac4f8fea2c5c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_34588.js", "upstream_id": "BenchmarkTest34588", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (!authzCheck(ctx.session.user, data)) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89160346a4005ab345307c26db4a73f10022ee3e597930c94290965eeb007de6", "structural_hash": "a7a12e747c8fb8ce01e01b65e3910138e858175e3d586bca7d7905095ed057c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01232.ts", "upstream_id": "BenchmarkTest01232", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2540b6c9021421d615576f99dc35c7f488a6b84b589c2c05f6464f7440b70172", "structural_hash": "12688f5cd24878c09c4bb9a91d3c9c602d3a6d85a04e86fe315a788b536e71fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02449.ts", "upstream_id": "BenchmarkTest02449", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const fields = [userInput, 'http'];\n const [data] = fields;\n db.collection(\"users\").findOne({ name: { $regex: data } });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfadfb83f054faa9f2cde60dd3612a592cd81116f632e68ac4a82fc33e80dede", "structural_hash": "89a3157054ad1d53bf2f0e42ca4df90bb44c37d6bda46641cc82174bd2db08ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00103.rs", "upstream_id": "BenchmarkTest00103", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: auth_header.clone() }.payload;\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7af9a8eee144630c13b0ce3a3ba83733da0aac249b2ebe1ec6f511ab67befc9a", "structural_hash": "6a522810ff21207a1bd9fea312682ca441a9e898eba346c428bea1d7deb49525", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04865.rs", "upstream_id": "BenchmarkTest04865", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(raw_body.clone());\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea488bd11afe4ba54ea53508b72047b3e27e27741f0c808ad976ec6f8436d04e", "structural_hash": "8b189d0a986d024b65efbafae98213371f685ce5942247d2a4b8b2b5866150bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04181.c", "upstream_id": "BenchmarkTest04181", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8a7399fff692cf112576a7ff85c49ccadd30dce0ad85fe60e979724f4feb090", "structural_hash": "cc65264b955ae8c88f00a42c981be31f1636416b862de1a1e8c66e64deae9dff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04492.sh", "upstream_id": "BenchmarkTest04492", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa628f4c7d6872ef9b65a7083fd321ff90b3e79132b8dbc86523aeef457919ca", "structural_hash": "eb098faefc22c2a5aac3124245cc14e68a72304e0ac013942d213e0f523fbe4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04908.java", "upstream_id": "BenchmarkTest04908", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.parsers.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(xmlValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "131c0e2bca6b3d23f973ade75e739c1c8abf97813d06db887d440a4b4b974bfd", "structural_hash": "35df0c3c7d1c72933b1e3d2f44becf93e36a84bf5969aa04b72e11695c23b7c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03086.rs", "upstream_id": "BenchmarkTest03086", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&host_value) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = host_value.clone();\n log::info!(\"User action: {}\", processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "624ec357536bcfee076daf4f5c2d088a47138905034f9d8303feecaff374158c", "structural_hash": "9025af064928bc210abba0122eb9733b423b59df030b58b138cb00fdce7aba5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30647.sh", "upstream_id": "BenchmarkTest30647", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n IFS=\",\" read -r -a values <<< \"$data\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79986650618fa2378aada50ce2a147c1936ff9d52dd523597a6ca7dd9b27debb", "structural_hash": "2a353d1001e0a1611b25ab50519a39b7f3d38ee2e28f147c1687e76760a65d76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05954.java", "upstream_id": "BenchmarkTest05954", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + commentValue;\n String data = valueSupplier.get();\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.KeyGenerator kg = javax.crypto.KeyGenerator.getInstance(\"AES\");\n kg.init(256);\n javax.crypto.SecretKey key = kg.generateKey();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25700002116127a33aebacc37da313053003f0408d81652387615b541a10240a", "structural_hash": "1478d1f058292002f22ed97bc17e921196492ed43910b5d07a9f074788c31cdb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12886.go", "upstream_id": "BenchmarkTest12886", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tcmd := exec.Command(xmlBody, \"--status\")\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0437adac40a14648a07a834d213e635d4a3780ecff7dd94f917675f2f07b19c", "structural_hash": "be1e2de3ba9b4712a2e681f5c052c1f7fc19901455608630b2f8486b3a091dee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03759.cpp", "upstream_id": "BenchmarkTest03759", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9c1ef247387197ac1758710f4a9ec5d1f3666496eb7ee5450b4344169d151a5", "structural_hash": "08825a062a071065590194ead47735320da1d6396d22e6fc3cf9e132e5873808", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25521.sh", "upstream_id": "BenchmarkTest25521", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c68ce5f9d63f698878fb741f5ffa07eec6a3db85221ffe7dfcf4d80da3a60d87", "structural_hash": "f885baeb9517d73c2f8e4724d95d671fa03b521baf2343b574aebe818c7cbc20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04788.c", "upstream_id": "BenchmarkTest04788", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0792e49956f1c99e1123acb7b1fd9f36e642deffdf84dc7b07ce8fdf1819c58", "structural_hash": "4f179a1de6e4ae695d803a5c9f5613f369f1c75d0da19f251edb28955ca0b90e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03225.php", "upstream_id": "BenchmarkTest03225", "language": "php", "code": " $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ffcfbc292b6bee72fc9590806327427a823abac8666e31faaf6253a8545feb36", "structural_hash": "b9d1a50e9fbf9895dfce8ca4776f0e98876334f6097472fb37543af3224a4a81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32685.go", "upstream_id": "BenchmarkTest32685", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(xmlBody)\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bf42cbbd40c96999634cc80dff310860514b392a88ea26cf324463d2a47f950", "structural_hash": "263e38298044fbffad066c568df690fa9586179abcf6d3a0da5ecf725451edc0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04337.py", "upstream_id": "BenchmarkTest04337", "language": "python", "code": "from lxml import etree\nfrom flask import Flask, request, jsonify\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n reader = make_reader(xml_value)\n data = reader()\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(data) + '\"]')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "188919dbdfab9efccc5642c1c7511d610b277f580b19ddf7496f12bcbe2d6ca8", "structural_hash": "62ae84859143672ccbd18e92a19396bb9aafbfb2a8b6cf17a48e1eb2421e0757", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04941.php", "upstream_id": "BenchmarkTest04941", "language": "php", "code": "json('payload', '');\n $data = ($userInput !== null) ? $userInput : '';\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3faf7af4805ed2e4c22462563a9e239eae32bf6e5eb5165be85cf10849a616b", "structural_hash": "d3b7317acc95ebdbec7937095ed9cdf454b1ba05be94b77032b1a609d3c624d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11743.sh", "upstream_id": "BenchmarkTest11743", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n data=$(printf \"%s\" \"$user_input\")\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d04a9266b4d2265fdb8ae1262cc52bbcc407a986d94a64bac4127462ce043f9f", "structural_hash": "ceca1fb61d4b243ab832496b2be61eeb50a1d9c8e8e7585766ad65e6ba1e9291", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01862.cpp", "upstream_id": "BenchmarkTest01862", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fd64eb115c51dae0c8bbe7011590fa6d7ef40274f4a83d1f70df2f1a70ff27a", "structural_hash": "9324c9d6a43266829e70918645ec6ad7dc10da02b870e24b94d42de167a09619", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12188.c", "upstream_id": "BenchmarkTest12188", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", safe); fclose(_cf); }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6396983d32b1cbc993ca5d725bf624c6ef6a6544268e924d24325188e71a33ea", "structural_hash": "bcc36bf06947892a836fe2445f6cfcc9e89280e5692db1e980697d67c130e1aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00504.java", "upstream_id": "BenchmarkTest00504", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data;\n if (headerValue.length() > 256) { data = headerValue.substring(0, 256); }\n else { data = headerValue; }\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5a90eb4fcb22e0a4157458278919ea3e85ca8e50e024092bd2045f76eba389d", "structural_hash": "150ef55d6e2a79b181bc1ef723fbb716989a2c4ca40dc36c1fd0412b56a1dd53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00405.rb", "upstream_id": "BenchmarkTest00405", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n DB.execute(\"SELECT * FROM users WHERE id = '\" + data + \"'\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57dfc2e6f45bcc65bcd93c9d17c3d6fa195f11333a8611704b36844e694a25e4", "structural_hash": "cdb7e3f375939974f38d395aa96e7fd0110444a34391a24c691990ab133fd48f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_29296.js", "upstream_id": "BenchmarkTest29296", "language": "javascript", "code": "const path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const safeKey = \"uploads/\" + path.basename(String(data)).replace(/\\.\\./g, \"\");\n require(\"./shared\").s3.putObject(\"app-user-uploads\", safeKey, Buffer.from(\"data\"));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93edfca512519e3855bb12046c19f099b31a55d0347ce6afb91c416e213ad614", "structural_hash": "6f1834ce38cbbc148f8658a6eebfb468b0e981e684fc5998b08c30d7dbf5c1af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01915.go", "upstream_id": "BenchmarkTest01915", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tlastRequestValue.Store(refererValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tos.Chmod(\"/var/app/data/\"+data, 0600)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03c6fe5ab9dda087b68e7e11b75569f4779e9823db614b22fde97938440b80b5", "structural_hash": "5994bf16e53315b9b950ae48a82ab35f4679ffff3e63b1aa8791f5daa3236ca5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03139.py", "upstream_id": "BenchmarkTest03139", "language": "python", "code": "import html\nimport json\nfrom flask import Flask, request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n data = json.loads(graphql_var).get('value', '')\n processed = html.escape(data)\n return '
    ' + str(processed) + '
    '", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acbbe74bf192e1db5a47d987b77a2c6fa168dc8f9ae035398248991dcde8feb6", "structural_hash": "e477b7ab8ea4ec5b610992ed41fc0141332be82f3f84f9d5e5c2eab338538ec1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04099.go", "upstream_id": "BenchmarkTest04099", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tvar data string\n\tif len(refererValue) > 0 {\n\t\tdata = refererValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tw.Header().Set(\"X-Frame-Options\", \"DENY\")\n\tw.Header().Set(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\", \"view\": data})\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "110a661ed94202da53e5a077c8dd9b9bf9fb3d0257bfa3cd6a1727948eac54f0", "structural_hash": "acd218605f45859f9575940a99a9d54ddd4db98a155a75be900e975617d3889d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00979.py", "upstream_id": "BenchmarkTest00979", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = str(json_value).replace('\\x00', '')\n return jsonify({'status': 'ok'}), 200, {'Content-Language': str(data)}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6780f3ae04e8efb88d03562fbdb8a4217614126b5090140e30cf039d78c9e148", "structural_hash": "8499c95116a0769d7410ed371cfbdab24a9240fcdba6c556b1c16346f7779cd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01604.cpp", "upstream_id": "BenchmarkTest01604", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f4e4d9181c98938867fc27bc45662355c22684148cde81613a31c3c29a7ff4e", "structural_hash": "4a7ef83ac5db96d94baea5509c65b5cc47623ae8fde6b0f6b6d9be4581e6a680", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04803.c", "upstream_id": "BenchmarkTest04803", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"w\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e8e7dbe001308f7119cd0cb1b2d1d273142657a16b6eb8e7b3c4f5d1445ced0", "structural_hash": "f1e6edd4f037f0035ce986f6d88f1e86c4bdf3cc99c4489e368a47f420ae0875", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27562.js", "upstream_id": "BenchmarkTest27562", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb6b6259874edc2577e286d82a9fc3089a5c2d7efcd56e395df63178867f6891", "structural_hash": "f9b2e8e7dd60a9641779ba2999d3ef2f6b1b56f8a2492a9556cc5ac671a243c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03545.cpp", "upstream_id": "BenchmarkTest03545", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n char _dst[16];\n std::strcpy(_dst, data.c_str());\n std::cout << _dst << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8ca490d94ab633ef73146368786aa903c9de38a84e44fd5d6ddc942497ec202", "structural_hash": "e908fe7488e849158228082466d27e76c5878c028566d5508f2c561d28b1696f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02803.js", "upstream_id": "BenchmarkTest02803", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n res.send(nunjucks.renderString(\"

    {{ userContent }}

    \", { userContent: userInput }));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74d2037bec11c110a61213091faeb50e8306b7ac3f030954e1fc21f2be579e94", "structural_hash": "e1987f10a8ce941c091df8fb124c364e9e00ef66b796e0eb8f45599b95d9b0ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10618.js", "upstream_id": "BenchmarkTest10618", "language": "javascript", "code": "const ldapjs = require(\"ldapjs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0d435137708a69200a74da255ce18602ac587fe48f258383e53e0b3c42f5860", "structural_hash": "3909a5aa9faad6d055e4d6e0d41c9e325958b6aad1343df7f660c5245bb504b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09017.c", "upstream_id": "BenchmarkTest09017", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n const char *safe = data;\n if (strcmp(data, \"asc\") != 0 && strcmp(data, \"desc\") != 0) safe = \"asc\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "986a0656db83d427884545ba8c83dfc9b5a0f64ae91b8b92b04121b7537b1c57", "structural_hash": "93489ac64f6d732a5c96fae1d159dee0cf385a2b2ea6807bbc2f5444e4067ddd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15702.c", "upstream_id": "BenchmarkTest15702", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n long _n = strtol(data, NULL, 10);\n char *_p = malloc((size_t)_n);\n if (_p) free(_p);\n}", "label": 1, "cwe": ["CWE-789"], "category": "uncontrolled_alloc_size", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c530a1f20224995d8880b08c65c0fa776a629a1a1d80717d18fa6254685ebc8e", "structural_hash": "c2753e5e2f0fa841286aa3ba6913a9f66f9fa55c9590d28d4b5f7e4d8e25bde4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00990.rs", "upstream_id": "BenchmarkTest00990", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = cookie_value.split_whitespace().collect::>().join(\" \");\n let store_cred = std::env::var(\"APP_SECRET\").unwrap_or_default();\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dd1a540d7c344cd54ceca1a1c2a2660a224384b0e162ede3b68011792e2b9f0", "structural_hash": "ae1a0344f7cad750101be00b99fa73cfe3b82edcf703434bef50ddfcfdc65bee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02127.rs", "upstream_id": "BenchmarkTest02127", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let data = path_value.to_string();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "011cfea9b0f89d5642ba594399d3fa3c53b9f3042efad6dba47fd9c416c6d581", "structural_hash": "07a4c54086cc1b0615b8550ec87e09bc203c102d4a834507a27fdb2acfcd7394", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00513.py", "upstream_id": "BenchmarkTest00513", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n reader = make_reader(auth_header)\n data = reader()\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if _login_attempts['user'] > 5:\n return jsonify({'error': 'account locked: too many attempts'}), 429\n if not auth_check('user', password):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15fbd465edadfabe30b57b68c170c99a4fd6dd594d66192eac1eb29f08d6685a", "structural_hash": "f6c2e0139903d5c484f59ab91333d4493d6a5028cd660df9004cb0337d408ca1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02160.py", "upstream_id": "BenchmarkTest02160", "language": "python", "code": "from django.http import JsonResponse\nimport defusedxml.ElementTree\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n defusedxml.ElementTree.fromstring(str(db_value))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd38a57d30b9709d402ee04591ccad3ba0de27dcbca027b835e92665b64bdf06", "structural_hash": "da2b8789cdb8c5b2d9bab1fb0bf5fea565f38fd6d1e1add86bdc59718b61f3a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02238.rb", "upstream_id": "BenchmarkTest02238", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = \"#{user_input}\"\n cred = data.to_s\n authenticated = !cred.empty?\n unless authenticated\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfe9f39472cfab67f3acedb952d149f95721ced2284f8e17dab1dcd64f9d58cd", "structural_hash": "de9d6e3ce9b063cca63f7bd11ce814ff617824b3418e8a63f8fcaf7aefc27698", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03817.php", "upstream_id": "BenchmarkTest03817", "language": "php", "code": "cookie('session_token', '');\n $data = \"{$userInput}\";\n $token = bin2hex(random_bytes(32));\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd79ad7979f344d71dc8f1b95b9e345ce4ec5096dca9eb20e24b1098c6fd308f", "structural_hash": "7dfcc8f14ccc0b9fce85a5b2d23c6ed6dba562002eb90bc6c09d974cb403c726", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01101.py", "upstream_id": "BenchmarkTest01101", "language": "python", "code": "from flask import Flask, request, jsonify\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n pending = list(str(ua_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return jsonify({'length': len(ciphertext)}), 200", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f74cdd7a1ad3aa092b48b4ac05ed2633d434760ff62d153d98f1c807fcd41cab", "structural_hash": "a18a8e9b16c28bdb2b724e7b76162b9614e267251a97ce3eef80f1e98066f31b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00523.py", "upstream_id": "BenchmarkTest00523", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import PlainTextResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n def normalize(value):\n return value.strip()\n data = normalize(referer_value)\n with open('/var/app/data/' + str(data), 'r') as fh:\n content = fh.read()\n return PlainTextResponse(content)", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e0f373632b4d9639a4a658a2441746d353d6f7b303496c2d9cce168d0dbee12", "structural_hash": "0e01ce63d206a3a267b95f4bae96dbb1d1ba5e1478924fde0d4268ad541c325d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22491.sh", "upstream_id": "BenchmarkTest22491", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n printf -v data \"%s\" \"${user_input}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7ce9600cefb2adbc7f8000030ec0a5ec8c3238ab133734e34708f8490f2c9e1", "structural_hash": "197e8f6dfb96ca0623789e4084af2f692fa67931e989c9efb4805864a3c32e24", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04771.sh", "upstream_id": "BenchmarkTest04771", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1047464ec7283550f68f8cb0d39af0bfad0d4ddec4fa44d829714df073be33f6", "structural_hash": "2a5f28d95d82fe29794f7a146de81557edd30cb521dd20d364f8b9ed51c22e04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26804.js", "upstream_id": "BenchmarkTest26804", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nconst zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.send(nunjucks.renderString(processed, {}));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da049bdf0e0bf09a56b752ea03f00d79c3859e504b78873b7aa7839da9fd07f5", "structural_hash": "828ada1eccfacd3ab4fd72146e2af5d8a1b53ea15c1170c818e22e90908230de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08843.sh", "upstream_id": "BenchmarkTest08843", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be4a80d5f9d504e0a3fa4448ed99fb09766391b7689c4aa771d074268bc9f540", "structural_hash": "bdca9715fca4ac341a0502851aa5559b355ec57551a2ad266e26a16f080601cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05921.rb", "upstream_id": "BenchmarkTest05921", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n Net::HTTP.get(URI(data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8840d24a08272b57a1cd24f430c8459c808f13da5fdb36d1b5402637a5cada6b", "structural_hash": "2856604aaec0ffc52b3812675b59fc50a462cc429409baa30cabdc47f904fa27", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10670.sh", "upstream_id": "BenchmarkTest10670", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo $((RANDOM % 16))\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-332"], "category": "insufficient_prng_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "673f38172fd05e1d1900eba84b4c949609534d8025fe5cca5f03aac5bb5be81b", "structural_hash": "33161b5f49289df3bcfc3f09f2cbbb6973708980b2c7068c24a51425afea79c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14938.c", "upstream_id": "BenchmarkTest14938", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n const char *safe = data;\n if (strcmp(data, \"status\") != 0 && strcmp(data, \"health\") != 0) safe = \"status\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", safe);\n system(_cmd);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39a995a0bccaf935b207c424d52fcb68ff6f5ca9e074ac2eaf655cb6c2d5a542", "structural_hash": "27e52d14cf0c58a2e1ed25ecc03d803439a0fcc20c2567259700050514331939", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10753.go", "upstream_id": "BenchmarkTest10753", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/base64\"\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdecodedBytes, _ := base64.StdEncoding.DecodeString(rawBody)\n\tdata := string(decodedBytes)\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "111296a2fa7a512135cea19820d8798fdedcbc9c3d3c848b16b4abf92877fffb", "structural_hash": "d94d1479227292630137bd8a35ab17687924bcda56b7a3f7dd2eb01ce45fc677", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13396.go", "upstream_id": "BenchmarkTest13396", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tdata := fmt.Sprintf(\"%s\", multipartValue)\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12dec0e85456bad4953299bab5e4acc2cdeebca40ad260b89deea83dbc230932", "structural_hash": "55695a0286daa3d08dcef7f96356371277d6c590bbf7d2194b922eb8845a966a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01927.rs", "upstream_id": "BenchmarkTest01927", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: header_value.clone() }.payload;\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61f0a9d902c9318c485a186e338998f2fcc61c03cc5844753cdc37e5de67b356", "structural_hash": "b2be1086c1921382957d214cc2cc98c3bba870277ad9ef408782f222800387a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01433.cpp", "upstream_id": "BenchmarkTest01433", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Referer\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n res.set_header(\"X-Trace-Id\", data);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "138fcf35862444f18247214b40ce368fe522aab6c3490bd7b3053b2c0e878872", "structural_hash": "81b3c2ea47b955a6fa693ea90ad8c009ec512380be8344427b1880540cbb22e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03307.java", "upstream_id": "BenchmarkTest03307", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n byte[] raw = rawData.getBytes(java.nio.charset.StandardCharsets.ISO_8859_1);\n String data = new String(raw, java.nio.charset.StandardCharsets.UTF_8);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edb4fa56f518d6777863dcd590a683ea67d6fb0adeb205bc21c3da4be5bc0a5b", "structural_hash": "34b60c5c126cea7dc47da354254eff385e2fbd427a90b0fca8ec700def6932b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16639.c", "upstream_id": "BenchmarkTest16639", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char *const _argv[] = { \"/bin/echo\", (char *)data, NULL };\n execv(\"/bin/echo\", _argv);\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dee2c6c7ea88bf0c52ba4982f0e36b7242b1ab3b0c49f0319f35f500b1fb73e1", "structural_hash": "16739bb7977c5924c5332c109d5108215d3582c98adb1457064135b998f4004c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26426.sh", "upstream_id": "BenchmarkTest26426", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a1b6458770415d7442dd733e06d0af5c5c02449b69462fd426bdb220729efe7", "structural_hash": "430e8279266b9294abb9d270f9bdbb2ea1bad169aa81a4aadcc59b8881402735", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00942.rs", "upstream_id": "BenchmarkTest00942", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = auth_header.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n let processed = if data.chars().count() > 64 { data.chars().take(64).collect::() } else { data.clone() };\n if processed == \"admin\" || processed == \"write\" {\n crate::shared::store_session(\"granted_role\", &processed);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc6e0da1fc3f114d5be45338b634ddfb6737143c9d4b07d9d484c194f89d45c3", "structural_hash": "0fcdb8cfd928e21d3eedbc4edbd87a4a3655a44a04f7ed5c3123d8645ca2eb3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02659.py", "upstream_id": "BenchmarkTest02659", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nimport os\nfrom types import SimpleNamespace\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n ns = SimpleNamespace(payload=referer_value)\n data = getattr(ns, 'payload')\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return JsonResponse({'digest': str(digest)}, status=200)", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b45365416172b76cd82dcef6a75cfe52eaecd4021498b25b30eb2a74c45c82ed", "structural_hash": "af09cdcdeba471a440cdd2b2b5cef7a70dc62357576c9c28edbfef03e730c74a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12649.js", "upstream_id": "BenchmarkTest12649", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(processed))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-285"], "category": "improper_authorization", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "403da50a9af5f783d978a5fcca427351b3357b39c82c485da12b4855da09296a", "structural_hash": "bb24ea13d64cf63c9e6985b9220bafca2781c0e64a4012365ca905421e55959e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02148.sh", "upstream_id": "BenchmarkTest02148", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n if [ -z \"$data\" ]; then echo \"specific: empty input\" >&2; exit 2; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7729f83045834abd89d0edcad554b16ca8de10a43bd1aff375583bc4fa342dee", "structural_hash": "e90b6a0181b87457931f0770774323543995c8c8a6abebe6768160ac4c209bc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01601.cpp", "upstream_id": "BenchmarkTest01601", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fde24440ca69d0f52bdede2233f928fceed023fc9e22e9d35e9fac376505ef0e", "structural_hash": "a48b4334e97e7db5b609eb6b00c907596a4de083f434aa609f66e56d8fc9a08f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_29689.go", "upstream_id": "BenchmarkTest29689", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tdata := strings.ReplaceAll(uploadName, \"\\x00\", \"\")\n\tallowedFields := map[string]bool{\"name\": true, \"email\": true, \"bio\": true}\n\tif !allowedFields[strings.SplitN(data, \"=\", 2)[0]] {\n\t\tc.String(http.StatusBadRequest, \"field not allowed\")\n\t\treturn\n\t}\n\tprocessed := data\n\tparts := strings.SplitN(processed, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54f4bad002fcd4a02929be341d7f2d2a74018d60d68f022715b0f25f28c39762", "structural_hash": "77badc275dded5f8880af9c04ee7aea7eae33da714d952ba556f5fce99fd1898", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13846.go", "upstream_id": "BenchmarkTest13846", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tcapture := func() string { return refererValue }\n\tdata := capture()\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+data), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a0e981e4d581adb46d7781755626f0c8876f04df6d9a535db1e032affebf57e", "structural_hash": "d81c3c1e2fd1a95b6f37decca2a6575c3adae280c8a31947a8ce30caa7549088", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03243.cpp", "upstream_id": "BenchmarkTest03243", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data = cpp_module_transform(user_input);\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) { res.set_content(\"bad request\", \"text/plain\"); return; }\n res.set_redirect(data, 302);\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b592298af72af6f5204e84984804f0c89b52ca88edb514e76abb649bdb759ee", "structural_hash": "1a2503edd69c6da9842a8549956710e04d414a197fa1df762ed0fe20ae236ac7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05519.java", "upstream_id": "BenchmarkTest05519", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(refererValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5ae1dc23fd1e287d8694dc7c8b80ef573e68d3bcf76b0865b7ca1e71fc6af9e", "structural_hash": "7f21cf1c3dae636337592a4700072a701377a45e7c122a49b6f0ed6eafd47624", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00218.cpp", "upstream_id": "BenchmarkTest00218", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fef1f2337e5c9f8699dbe78e7aef6494f2a19b45ae8202768a7aadc1d5d75542", "structural_hash": "6ef1d4078e5b163b98418b5d60f7beb0367dad492b8e0fb49006671d4e533501", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05633.rs", "upstream_id": "BenchmarkTest05633", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (payload, _origin) = (header_value.clone(), \"http\");\n let data = payload;\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85fdac424ae1f744518a25483e916edb93501a4a2c8dba87ea00e3ed3b8d85e5", "structural_hash": "03a050db1a8b08c8ba6e1e07e4103cda7208503f255c71e2bf9933791d82294a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03320.cpp", "upstream_id": "BenchmarkTest03320", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n if (_i >= 0 && _i < (int)sizeof(_buf)) std::cout << _buf[_i] << std::endl;\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2610159bce3ad291cd1244a1084c2a82443a2f867c24784fcc9e600eeac8f7b3", "structural_hash": "781b3070e2808b03071c28c1e4e597cad2f359a2e80bdf1af0f5e4662f44e13c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03978.c", "upstream_id": "BenchmarkTest03978", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n if (getenv(\"APP_ENV\") == NULL || strcmp(getenv(\"APP_ENV\"), \"test\") != 0) {\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"r\");\n if (_f) fclose(_f);\n }\n}", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3402e41c03a1b50cef407be93609a97926235aecf8de196e3e27d5f89994912a", "structural_hash": "3cfc24a1def45a889dfcddce732fbaf139ab7b26067d0f54052e9f53bea3bdf0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00972.rs", "upstream_id": "BenchmarkTest00972", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n HttpResponse::Ok().insert_header((\"X-Custom\", referer_value.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0fb5b295d77ab77ceced4d3b43d5c866b51d58de39aedd165a5b8ea52de0689", "structural_hash": "a5201fd08b62cbed2c7380b3df1610f8f5e3bb51fe2f0e36945a242924712b5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00819.ts", "upstream_id": "BenchmarkTest00819", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as libxmljs from \"libxmljs\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n libxmljs.parseXml(data, { noent: false, nonet: true });\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3770a34c07b189d3127fa0885e94a64e7d3c64bdd42e5e2f68611678e85ed78", "structural_hash": "b517afabc15eee14d61e98748e2a6483964eddf9aa3f93bc276b9ef972450b18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00280.ts", "upstream_id": "BenchmarkTest00280", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "213583112eacdf1d6d29937830bedadbb96e04a97ecea1fcca8228d3700d8a5f", "structural_hash": "1ad3e4ad0e593034948af9dae4aea2eacf75d254cde7e0c0a864cf42e82d2eec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03753.java", "upstream_id": "BenchmarkTest03753", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n request.setAttribute(\"envelope\", refererValue);\n String data = String.valueOf(request.getAttribute(\"envelope\"));\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object evalResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7caa5483ae894fed9d1f354f490ab60a5fa3eb2cdedbc44dee987d54002b9a70", "structural_hash": "7fa1ee466e345cf09605500067cbe8af806b52288e87f8cf6e12dabae6f72459", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_34595.go", "upstream_id": "BenchmarkTest34595", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvar data string\n\tfor _, token := range strings.Split(commentText, \",\") {\n\t\tdata = token\n\t}\n\trequested, _ := strconv.Atoi(data)\n\twrapped := int32(requested + 1)\n\tw.Header().Set(\"X-Wrapped\", strconv.Itoa(int(wrapped)))\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "faf054e76b5b3043dbf16749d9c9e409c647caee2289dd02ec46cf5ee471dd76", "structural_hash": "c0cf2bb5404bfb35d1c2941f1cfc14d866932fef7fae21bcfb0daa974a87d2be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01084.py", "upstream_id": "BenchmarkTest01084", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = '%s' % (cookie_value,)\n key = os.environ['DATA_ENC_KEY'].encode()\n encrypted = Fernet(key).encrypt(str(data).encode())\n with open('/var/data/secrets.enc', 'wb') as fh:\n fh.write(encrypted)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53b535eaff9ff0dbdf35c4e6697e2228c2469701fc12f7583583f134c4015fde", "structural_hash": "bd19432ee6ee20b063681e7204cad02036c6d8d2101e44243f9bd6ee2d514537", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01992.go", "upstream_id": "BenchmarkTest01992", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tlastRequestValue.Store(pathValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\t_handlers := map[string]func(){\"primary\": func() {\n\t\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\tw.Write(content)\n\t}}\n\t_handlers[\"primary\"]()\n}", "label": 1, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d42eaef7a74a1ae74a7fe6aa2bd8d8cd2cf86bb92ef38c325604a85a5ca758a", "structural_hash": "5bc2339143fa9b2947066d064b7648c5797871e073c1a5acb5fe7eb6d3130316", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00177.go", "upstream_id": "BenchmarkTest00177", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/antchfx/xmlquery\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(authHeader)\n\t}()\n\tdata := <-resultCh\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\tc.String(http.StatusBadRequest, \"invalid option\")\n\t\treturn\n\t}\n\tprocessed := data\n\txmlDoc, xmlErr := xmlquery.Parse(strings.NewReader(\"\"))\n\tif xmlErr != nil {\n\t\tc.String(http.StatusInternalServerError, xmlErr.Error())\n\t\treturn\n\t}\n\txmlquery.FindOne(xmlDoc, \"//user[@name='\"+processed+\"']\")\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7431cfb5697bcec8378d60b244d2a181f470cb92929515908dccf2693dd05e53", "structural_hash": "3b5f5f9bcab71ae4687459ec3909ca2162cee29476da61cca2ebe9d4386eafa2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04433.rs", "upstream_id": "BenchmarkTest04433", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = upload_name.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let _ = data.parse::();\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0904790f316d64ef1f202d6e1f977ed3fa9b60fc3820898d8923d19b77de6f02", "structural_hash": "34f5c8c616b035d1ffd735c6d7bdb1078736a48271b76834334637963debaf89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02144.rs", "upstream_id": "BenchmarkTest02144", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(raw_body.clone(), |s| s.trim().to_string());\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n use sha2::Digest;\n let _digest = format!(\"{:x}\", sha2::Sha256::digest(_body.as_bytes()));\n let _expected = std::env::var(\"FEED_SHA256\").unwrap_or_default();\n if _digest != _expected { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "131a26e951cdb49f20324c039f71fac0ef71762772d49e72382b4fd801cb7b76", "structural_hash": "2bd27387e4e9086acbb5ccb4c971ccfce9de9c035365edd842bee9ad43ae2b89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00443.java", "upstream_id": "BenchmarkTest00443", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @POST\n @Path(\"/benchmark_case/graphql\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(GraphQLRequest req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n com.fasterxml.jackson.databind.JsonNode root = new com.fasterxml.jackson.databind.ObjectMapper().readTree(graphqlVar);\n String data = root.path(\"value\").asText();\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c39f4e263a00bbb85bb9fc58a24dc8149b4a96b09d53bdc5e149323c0e24717d", "structural_hash": "722840ae956b097919f85569ef7d43f223789ac28e055eb3b8a27b14085cc508", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01721.ts", "upstream_id": "BenchmarkTest01721", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n req.session.id = String(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13e471f99be76f5de0fbfc09cd3026aeb4ba34d97a3c9c739e83b158fff3b481", "structural_hash": "62132f08449c24cf1fc4a4350987e1e419e27a3ceeb1e1b842a9e2cf92035be6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02989.rs", "upstream_id": "BenchmarkTest02989", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let mut pending: std::collections::VecDeque = raw_body.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let result: Option = std::env::var(data.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb18ae7e08012965fd2b6ec2206f1e42ff2e5f9d64831a29376e98765324b00d", "structural_hash": "b150c3f497584597c5be97f60d7fa0a090b7f6a7814c8ad149abeaf74542e108", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00855.go", "upstream_id": "BenchmarkTest00855", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tform := FormData{Payload: fieldValue}\n\tdata := form.Payload\n\tDB.Exec(\"UPDATE users SET name = ?\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4599ae73bf5c31d7f3601843cff223e6e68bfd0881b4fd428e64ca5c60b807a6", "structural_hash": "a2993a4b700424401282fda669b6d3d72e7d29aae8f128df5b8e1d5cd2bb3dd7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03990.rs", "upstream_id": "BenchmarkTest03990", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(env_value.clone(), |s| s.trim().to_string());\n let processed = data.parse::().unwrap_or(0).to_string();\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = {}\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c16191417b3abcbe98da8c94cce2769d76dced3c9f8ee76d4142193aad1b1f12", "structural_hash": "6663cd24be5d062f7940fa44e861feff58afd67833133c42c89be625c556412b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01181.ts", "upstream_id": "BenchmarkTest01181", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const processed = parseInt(data, 10) || data;\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(processed));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1df7d3dcd306bc74959671701e2571a88ed7ce6528f92e9d85a8a5f85edcc41a", "structural_hash": "87fc24ca54c7664749351260f19d12e7d327fe3896bea9fc92bb5b06db1d7b74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04694.java", "upstream_id": "BenchmarkTest04694", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.util.Map.Entry edge = java.util.Map.entry(forwardedIp, \"body\");\n response.setHeader(\"X-Tuple-Context\", edge.getValue());\n String data = edge.getKey();\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n Files.delete(Paths.get(\"/var/app/data/\" + data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83d67fd62bccb4d95ea59a8a938930725875d2301cb136d87119793ae0c4b3b1", "structural_hash": "c7cf7aef1cc88029a9a1db08660df22799968d50af4d518361bab3d4926c961b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00811.sh", "upstream_id": "BenchmarkTest00811", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e844a0ff793e4a6c142307d816b863341a4f8273c3db5e47763e872ffbe6ef12", "structural_hash": "957edf9ece088d94d225a0bbbd8e6cb7485e1cc02f0de3599d5dd31af982f77a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02982.rs", "upstream_id": "BenchmarkTest02982", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = cookie_value.to_string();\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fbb0672061ec7a26b5da7eccdbf07d477b8b025cdde4c4bff85e043c04f0e3b", "structural_hash": "bdc23c369ff09b14ed341abb2d65dc6527653e6600b3db6514364db179de02cf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01448.py", "upstream_id": "BenchmarkTest01448", "language": "python", "code": "from django.http import JsonResponse\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n reader = make_reader(origin_value)\n data = reader()\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "628c39b9c849260c5752212e50c8fecb59d124b10dbd9656834bec7bae3e0651", "structural_hash": "fb24a86092b71120546478dedc08310c7bb48e68bed1ab473bba548920f417dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02024.rs", "upstream_id": "BenchmarkTest02024", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let _prefix: String = raw_body.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => raw_body.to_lowercase(),\n \"f\" => raw_body.to_uppercase(),\n _ => raw_body.trim().to_string(),\n };\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ba562329f35ccc04422d7b08718c75d080025b377bf971f028a15e1eb200557", "structural_hash": "5639d1f2552ac8ecc22eacb9356b761b15ead1edd43519e45c24cfb7459edf89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05596.rb", "upstream_id": "BenchmarkTest05596", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"redcarpet\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n processed = Redcarpet::Markdown.new(Redcarpet::Render::SafeHTML).render(data)\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4866176889d95d34f893ab94d7de4cc98898bf0286c6c150fbe32c5284be203", "structural_hash": "2b45351982c91cd35d086a8cf3bb8e4404b0706c8d89fed8a8b3d92f23a8675a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00877.py", "upstream_id": "BenchmarkTest00877", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n if field_value:\n data = field_value\n else:\n data = ''\n if not auth_check(str(data), request.session.get('token')):\n return JsonResponse({'error': 'unauthorized'}, status=401)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b27d411f8a3c97b30011b4ee7652a4f76bf68bb3e8f5de778766f545709a8945", "structural_hash": "705e9e61c59691237cf5493804a7aa26de5cf56b5036b4f1cd878f7e36bf5c9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05516.js", "upstream_id": "BenchmarkTest05516", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n if (!authCheck(data, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-305"], "category": "auth_primary_weakness", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3c1601e2414a3088a89ef87cb50724591ddd5ab010f4a58ee4dfed008aaaa56", "structural_hash": "a0577d3315c542b9dfd127ef3245677c67a7342b6790fa571f6009e4cee84555", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09948.js", "upstream_id": "BenchmarkTest09948", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n ctx.body = '';\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11448f4d5956e51dbe6513b6b71da70e4194d00ee7396b07a130299ba8f7cbc2", "structural_hash": "019476d93a8a247b1b3b46636a680e0e76bf3c902360e135b0828489adb76c56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05861.ts", "upstream_id": "BenchmarkTest05861", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n res.cookie(\"session\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4546aa61518721d06c1bf6fda4834a6cefd9be1ede82fcaad4685526eff0ac4d", "structural_hash": "779eda6e06dc9e4745cdcf5fedf9a9bd8ebcc2d9bdeea246fa7437d268e5f965", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00956.rs", "upstream_id": "BenchmarkTest00956", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = field_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bdcd212f58b6b4524ea5fc9cec4ed13b58cf2da6e79662a11e3ab42476fec64", "structural_hash": "bc2ce14d7dcae395350abde7cd7445e00a1ebff77f16a38cb04b93977a3fb823", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03803.go", "upstream_id": "BenchmarkTest03803", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\thexBytes, _ := hex.DecodeString(authHeader)\n\tdata := string(hexBytes)\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\thttp.Error(w, ldapErr.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+data+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tw.Header().Set(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "360da57a7816efc0d97e0f0cbf613af39a4c31a75adb6e0f16c91de3525e2cba", "structural_hash": "87da5a3a4ca2b8517a2e7c3d713fe9e415e602c757aa056a69b0fe605fe8b0bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23368.sh", "upstream_id": "BenchmarkTest23368", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n ls -la -- \"$data\" 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9bf306f3ac7124039614a72bbf49f02bf18f4b7c0fec2917567a72af7f9e5d1", "structural_hash": "7b7a05897a03bc7fc27f42421a78aa1678e212c440051fe8482f146cef4f4572", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02751.ts", "upstream_id": "BenchmarkTest02751", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = \"default_config_label\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee2634398d0591a5243de42ffb0658ca72090e805226872e79b3beff48399f8f", "structural_hash": "f5978aeb485e55610bce9bb7766f97b506032f59169945d0da154f66b614130d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03860.php", "upstream_id": "BenchmarkTest03860", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $data = '' . $userInput;\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($processed)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77e1830f74aaa4cbc5652cc353fa9712b40427b30732eccc3c559699b67fc621", "structural_hash": "4dc71e85c2506f17d8aa2a843663b9a3f2fb134cc4c18211a22913c384a25895", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06065.sh", "upstream_id": "BenchmarkTest06065", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n case $data in\n a) echo alpha;;\n b) echo beta;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "851e86890328b17d72fe7ff49e0def5dc93d65d0496181dd4a14dc25826705b4", "structural_hash": "b9a0e25ec77dc2df744d3d521acee931a74169b20ad4a0e24d2abf8d3ef0fbbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00656.py", "upstream_id": "BenchmarkTest00656", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport ctypes\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n if cookie_value:\n data = cookie_value\n else:\n data = ''\n requested = int(str(data))\n wrapped = ctypes.c_int32(requested + 1).value\n return JSONResponse({'wrapped': wrapped}, status_code=200)", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "813385035e0d9fbd0ce98d4e5c0963896dc463c4e4f8743799bba25f248efd02", "structural_hash": "71c323e3ebe736d59711042e45db7ca1b6747858e43f2b5908f57890016dcfaa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03924.cpp", "upstream_id": "BenchmarkTest03924", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Cookie\");\n std::string data = cpp_module_transform(user_input);\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n if (_i >= 0 && _i < (int)sizeof(_buf)) std::cout << _buf[_i] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be69a3f8619ea95c1aaef28e313f65abf383ff2108585041a91054cca208694f", "structural_hash": "116b277e5d16573175d0b7bd1405e9df3fa19b9fed347b231e5d650552482202", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01655.php", "upstream_id": "BenchmarkTest01655", "language": "php", "code": "input('field', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n return response(\\Illuminate\\Support\\Facades\\Blade::render($processed))->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a098aae840cfd789dfa5ba6be76b8c8a0032ea89d08d8ea84ae62f01796376a", "structural_hash": "a5e1a7d76dbfa53daab6f92b680c54da64b8d1693360c645665adae18d1228b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04081.php", "upstream_id": "BenchmarkTest04081", "language": "php", "code": " $v;\n $data = $transform($userInput);\n $digest = md5((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37b7767778b5e58a34919b803997313ac9e91ef04452b344183e1d0730c1243a", "structural_hash": "5d33703bd0c7f3c80717ac15da5ee59cb6f59fd213746ffd98e2b0ffd4679e7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02541.rs", "upstream_id": "BenchmarkTest02541", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = \"default_config_label\".to_string();\n let mut data = String::new();\n for token in secret_value.split(',') { data = token.to_string(); }\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ct = crate::shared::encrypt_with_key(&store_cred, &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77d297eb909fe6b79b781201b136a1dd96a764433a2352cf53d202af9d11aa65", "structural_hash": "c398f2019424a46c50015006dd58306cca010c3e7ca51b75e07b90d77cf43c13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00409.php", "upstream_id": "BenchmarkTest00409", "language": "php", "code": "input('multipart_field', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (empty(session('user', ''))) { abort(401, 'unauthorized'); }\n error_log((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "761024a7696bb0769f24baa04a6ad0fdafb6c54a7e087b66b5971839cc6794b4", "structural_hash": "127bbfa122ed915869b5a22e8a77207666afa2ce3a95b86a1715fdb4494d1538", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00260.rb", "upstream_id": "BenchmarkTest00260", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = user_input.split.join(\" \")\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "263a139f54421e810f6db484184989544c83dfa19bb33603b106327a37016a43", "structural_hash": "216c4041b3c64c75f436c14b038f162418e35aadccf5eeeb5c4dd80e15abe74c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02400.cpp", "upstream_id": "BenchmarkTest02400", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n unsigned char _digest[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51fc2e7693f7876f9b864d1284d8db38ed3892860172c79de72844c681badb97", "structural_hash": "8a1cfd93b675e2893883dce91592780b2e9f4f074ed66a64ae2e52c3ed50607a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05584.php", "upstream_id": "BenchmarkTest05584", "language": "php", "code": "cookie('session_token', '');\n $data = hex2bin($userInput);\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ca4c280546cb417fe77ba45c0849cf39d74d48dcb92da3b23dc31f162c89000", "structural_hash": "c8294a05b983e442735becc0f3f8dec3e073ed35c97505cac8706712d14df967", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05944.rb", "upstream_id": "BenchmarkTest05944", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n entries = Dir.entries(data.to_s) rescue []\n content_type :json\n JSON.generate({ listing: entries })\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bf4abbe77699f8bfd6f0499d98f358f72fb81376e6c8024b699f059cb7da79e", "structural_hash": "dc972a1b8f53f3d0cc4f318ae04c11d0819fa638d41af587cc9c329665981a4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01794.rs", "upstream_id": "BenchmarkTest01794", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = upload_name.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n #[cfg(unix)] { unsafe { libc::setuid(65534); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8414d8236346c3e49e83478e989811ceef9ec77436dbdafb727592d6b7411980", "structural_hash": "64ec6838c3f9503fc309e8174d99eaac9c8c2d191e0f90bbf01658ad459b2e97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01731.rs", "upstream_id": "BenchmarkTest01731", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let mut data = String::new();\n data.push_str(&db_value);\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "040094f2a0527c9eeb7711656962e39c3ef33523ae532295948511ac73f5b0f7", "structural_hash": "c67b223f343435aa2046de385f694515388d2e219cd11a81d4936eb77a8143a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04601.py", "upstream_id": "BenchmarkTest04601", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nfrom urllib.parse import unquote\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n data = unquote(referer_value)\n logging.info('User action: ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd60a492437001459727b48ec5351dea69e7671e314bd2ae97c7f5eee3c48104", "structural_hash": "e9f67a626dabfb530bc6fcc729e3b71397156c1b73c826960d49eb170081d1fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10967.js", "upstream_id": "BenchmarkTest10967", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const data = String(userInput).slice(0, 200);\n process.env.APP_USER_PREFERENCE = String(data);\n ctx.body = { configSet: 'APP_USER_PREFERENCE' }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c509a0f8859f0fead6259be15cb95828fce7fe54b85c62f2f92d408533c753b1", "structural_hash": "b999fec8b0ba9987dafe4dadb43caf0442dbbb20e1e48a5aab91a1076c0759af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05718.rb", "upstream_id": "BenchmarkTest05718", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"ghp_EXAMPLEonly0123456789abcdefABCDEF0\"\n data = Thread.new { user_input.to_s.strip }.value\n processed = data.length > 64 ? data[0, 64] : data\n _req = Net::HTTP::Get.new(URI(\"https://api.railscdn.org/v1/data\"))\n _req[\"Authorization\"] = \"Bearer \" + processed.to_s\n _ = _req\n render json: { data: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b534610d81d4d04617eba36f3e49721d1f7f227a5eca5c55cc99fc950ab36ae", "structural_hash": "4f5bf6bdcc523dfad1f0e9982478c9517357dc2a549c9025314e4bee85f4bd1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_22624.js", "upstream_id": "BenchmarkTest22624", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const data = await Promise.resolve(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { ctx.status = 400; ctx.body = {error: 'forbidden'}; return; }\n const processed = data;\n crypto.createHash(\"md5\").update(processed).digest(\"hex\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71b6fc4472740d021faf7f9225606dd131c477358ba71f064e36a49a3baaf33a", "structural_hash": "a1bb436bd14315a1e207de23ec1d455bf684788114f9cfcc83f881a8e8431244", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04547.sh", "upstream_id": "BenchmarkTest04547", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae328a6526f358a2c320d32e4b78e98b2826e2dae02dda6bc0d5cbea1e72d647", "structural_hash": "148d809812fc9ec87cd9bbf0aced7ad4e2b423cbea3e881024d43973a72f918d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03864.php", "upstream_id": "BenchmarkTest03864", "language": "php", "code": "header('Referer', '');\n $data = str_replace(\"\\0\", '', $userInput);\n DB::select('SELECT * FROM users WHERE id = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5970db9fb105f73f989b7ba225508ebff41efe57d1857266d6c2b6938630319e", "structural_hash": "14d0948b97968d2b53a92aee8c906f488aca0b45a1901659d35a53a9d2d0fc98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04699.php", "upstream_id": "BenchmarkTest04699", "language": "php", "code": "headers->get('Referer', '');\n $data = call_user_func('strval', $userInput);\n if (in_array($data, ['https://app.shopcdn.io'], true)) {\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->set('Access-Control-Allow-Origin', (string)$data);\n return $resp;\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cd500d015430d6eb35ecaf4768a8b05b9a6d68d9547a597f99e77e3599d077e", "structural_hash": "49fee018c09b5a71792bffc17aa56021f0eb123261d834ee301bf7febc4c5d8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21819.c", "upstream_id": "BenchmarkTest21819", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"cfg/%s\", user_input);\n FILE *_f = fopen(data, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9741577f7cb2e3d7f40f166edc3cf962864c8564fa2e2d4843bfcad973dfc626", "structural_hash": "fd374ba80492e556562a1fb91740581a617d35351310ba6f340a04a7c6ed42ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02020.c", "upstream_id": "BenchmarkTest02020", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0600);\n}", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "716703db7c0ea2f8a1d0b55437c9586dc01d42068dc4d2bbac73474d13a67d2a", "structural_hash": "e36854c1ebe66bb3436fbec6b055aefe0ffecd09836ada10e42b80755026a111", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12468.go", "upstream_id": "BenchmarkTest12468", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tvar _b strings.Builder\n\t_b.WriteString(authHeader)\n\tdata := _b.String()\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data, Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b848ca9f17db4b48a3270bf1db6857dabdae77461c32fae7a9192e1f1ae35f5c", "structural_hash": "ec300c17dce877d3bc2eb12278848aaa3f8ff9f42ca05a4dda7417471f1c687b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03925.php", "upstream_id": "BenchmarkTest03925", "language": "php", "code": " 'p4ssw0rd_test_xyz']['secret'];\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt('data', 'aes-256-gcm', (string)$data, 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38eef6fb977bb45978aa4a619dbecdcf54550c950145fa62b07f0b5d6e5ffa34", "structural_hash": "c3fc5c7a0b54662bd328bb4da0399b288e6efe1f2db48b632559d7a2a6ada536", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01618.rs", "upstream_id": "BenchmarkTest01618", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(json_value.clone(), |s| s.trim().to_string());\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0045d0bb835145e5336336fab6587388fb44927fd041bbaaed3b58af226c20ff", "structural_hash": "f68ba1441209d525ec51b2c45f7dbe63eee4329245116c90551c353ff6b0130e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05430.rb", "upstream_id": "BenchmarkTest05430", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n host = URI.parse(data).host rescue \"\"\n unless [\"api.intra.net\", \"cdn.railscdn.org\"].include?(host)\n halt 403, JSON.generate({ error: \"forbidden host\" })\n return\n end\n target_url = data\n redirect target_url\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99d883aaf587d5118369381df27c09cc7c5949b8f8a1f5269d071e335b42818b", "structural_hash": "296996d1ae511a98577a365e98c65a44e22893cc8a17d9b8b9316af6388cd2a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02220.rb", "upstream_id": "BenchmarkTest02220", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n trusted_claim = parsed_bool.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b5ca5f747b454034a736a72c53aa62c493a89fe5a97fcd68a5ce8fb3d226503", "structural_hash": "d47890db898e8dfdd1591cde393304505b71c85f950219d616387bac010c1d23", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36604.js", "upstream_id": "BenchmarkTest36604", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const data = passthrough(userInput);\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5f95ff70d2c491904cb80e06b91fecdc44b00c121f5b8dd64ec63cac7c59c97", "structural_hash": "66732d86382bbd9f2763cbc86375531d07d7077a3a8bf21f924cb6506ee93f63", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05230.rb", "upstream_id": "BenchmarkTest05230", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n @user_input = user_input\n data = @user_input\n headers[\"X-Frame-Options\"] = \"DENY\"\n headers[\"Content-Security-Policy\"] = \"frame-ancestors 'none'\"\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43172a88ae1573e2edaea00d8c88f69bc2c29c749acc9883eb5f588438c00640", "structural_hash": "3879e80aa4e1c2974eee2811a37cc00ff84f767de77aebaf18ca54d04d6fe7eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04537.php", "upstream_id": "BenchmarkTest04537", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $data = str_replace(\"\\0\", '', $userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49c69effa2725cceb9b4169052c871de74a538b92bc1a97e9ad9ce4bbab2e3e9", "structural_hash": "b6bb3931e3f55f24e859567926ce7eca94b6ed6241a0b33b9abaf66b70e74e16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03994.py", "upstream_id": "BenchmarkTest03994", "language": "python", "code": "import os\nimport base64\nfrom flask import Flask, request, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n data = base64.b64decode(auth_header).decode('utf-8', 'ignore')\n store_cred = os.environ.get('APP_SECRET', '')\n auth_check(str(data), store_cred)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be54601fa48f9f5eb9d8402710b14ac5088c85426aa6428cc28ec870e4eb011a", "structural_hash": "d75e3af1d25b389ac513680e7906434977119f98c05c004a422d939cc48d5e78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00763.php", "upstream_id": "BenchmarkTest00763", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n if (!hash_equals((string) $request->getSession()->get('csrf_token', ''), (string)($request->headers->get('X-CSRF-Token', '')))) { throw new HttpException(403, 'csrf mismatch'); }\n $conn->executeStatement('UPDATE users SET name = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b912d08d1d832c579d38f457b390c10c5de8b9d66212f422c0c21f05cc332de", "structural_hash": "a0dc69f95576643780d2d3ca0da89975b267c03ae87b6541aecf4eef9bdcfe42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14940.c", "upstream_id": "BenchmarkTest14940", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a2e0e7fdc3bde4e05e592f93e5001d4ee64aeda583ca066bc49628fa8907e25", "structural_hash": "c476eb879f1c90acffe29e6790c474540dc5f032a4c92c7c4cdf6b4ae5909f91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01921.c", "upstream_id": "BenchmarkTest01921", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n long _n = strtol(data, NULL, 10);\n char *_p = malloc((size_t)_n);\n if (_p) free(_p);\n}", "label": 1, "cwe": ["CWE-789"], "category": "uncontrolled_alloc_size", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ec1ae343b7f217684983c39d7666d3db5855760a9efdb7c0ba2e445e5583b69", "structural_hash": "3b6c9ae02eeb1c4fc540ed325975c2cf51f310d9499369a3e7b52383f2eb9886", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03913.go", "upstream_id": "BenchmarkTest03913", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tvar data string\n\tif headerValue != \"\" {\n\t\tdata = headerValue\n\t}\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efb6dace95e9ee58854e773f8635e4a3a42f5cc82e8773c252cb395a6eb32737", "structural_hash": "99c084d1075add1e6b6f3088e46dedabe4e93fbbd882ba1d22f1428938137b14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02685.rs", "upstream_id": "BenchmarkTest02685", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = referer_value.split_whitespace().collect::>().join(\" \");\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6df6d665aaf6abb059f4ca520b98cdb68d6c46047095d6b58abab00d2f7f361d", "structural_hash": "567ccdfc748932c44f39521c495c35bd09fbf9fc5b1a8e94e47f29e41f9b4b6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38319.js", "upstream_id": "BenchmarkTest38319", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n Buffer.alloc(parseInt(data, 10) || 0);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05a0354e5e36cf7dd9ce5d1f2606bb1531fa80b373a7cc8df47cd806d3b4865a", "structural_hash": "89fa910375c41f14b573592ee2a3919e40cf653bc80bcc98262897f230a9b83c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02098.rs", "upstream_id": "BenchmarkTest02098", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n struct FormData { payload: String }\n let data = FormData { payload: db_value.clone() }.payload;\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f92075e42b320377840c5dc8845078738cf985958fd77c0b623193e1ca1e7d1", "structural_hash": "1129b76a7fab5363c9caad92251ba3f660ed43e40c28735499f936be7654e9a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02395.java", "upstream_id": "BenchmarkTest02395", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String stripWhitespace(String v) { return v.strip(); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data = stripWhitespace(originValue);\n jakarta.servlet.http.HttpSession fixedSession = request.getSession();\n fixedSession.setAttribute(\"authenticatedUser\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "baab6311b0e949c87ab67825d0bb5aff8585d3c1f10328ba7945904a5bf0c5ef", "structural_hash": "aeb8d8afc0dc6323faf3d36f7188ca0ba01cfa77560644aa690ee61988023a97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02486.go", "upstream_id": "BenchmarkTest02486", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tvar _b strings.Builder\n\t_b.WriteString(headerValue)\n\tdata := _b.String()\n\tc.Header(\"Access-Control-Allow-Origin\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7eaa36b7d5bdece0b492993a2590122192e9b5f34cdd73f47ff4fdfb2524042", "structural_hash": "6122aa5dc00d7a5c6da10e4d1555f292688194098070a73754dcb5219b69953b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02193.rs", "upstream_id": "BenchmarkTest02193", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = field_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c71668493f5d0b924866d27f48b05cfaab9021210f0c8ed20267e9907ae70c4", "structural_hash": "d85dcb8e3947eebd19680522d2c0865a8745010b5f7aab4cdab7ce7564b9b23f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05693.rb", "upstream_id": "BenchmarkTest05693", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Origin\"].to_s\n data = \"#{user_input}\"\n trusted_claim = data.to_s\n render json: { trusted: trusted_claim }\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ebbcbc51d8f562107ac240712202cae15929e7d188059455c09e906008b25c7", "structural_hash": "2d9b2ecd1d0420a79f10a58c0741e3999d75436f3552cc56084ce7d784d2b76d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00215.py", "upstream_id": "BenchmarkTest00215", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import PlainTextResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n auth_header = request.headers.get('authorization', '')\n data = auth_header if auth_header else 'default'\n with open('/var/app/data/' + str(data), 'r') as fh:\n content = fh.read()\n return PlainTextResponse(content)", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73b2e27daa62c26027ea37aa1eb22dc29ffc16503abd216fb4da46bc633643c6", "structural_hash": "8cff21cf2bb57c5bec7f922d82b9a5058a998b26082ec9eafbd4136dcfe63553", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00564.rb", "upstream_id": "BenchmarkTest00564", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0e58752e23280870bf38fef827fb05b498a00a4941c17890b549dc127b5c81b", "structural_hash": "3cf841845022737b4359a6a2bf14ef6d3b957722df63c89c161d79bf331156d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01412.rs", "upstream_id": "BenchmarkTest01412", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = \"config_secret_test_abc123\".to_string();\n crate::shared::db_connect(&format!(\"postgres://app:{}@localhost/prod\", secret_value));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc2f6d3336d28d419faeca7ffc3ea488d36cbabbdd8eded99edf12f4b6c1bec6", "structural_hash": "1417ac6994616c3cac150c0b66d9b5fe5573239af7b438a4131516cccc6087b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03980.ts", "upstream_id": "BenchmarkTest03980", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(data)));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ee27435c4750e045ebd650056963d84be960e269cf2ab069910668b99958056", "structural_hash": "16dd71d9f2a9e379adfd2386f452e7ddc81d1406f965d86cc07c46b881c9b62b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02621.php", "upstream_id": "BenchmarkTest02621", "language": "php", "code": "header('X-Custom-Header', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12fb71de4a2f75a4d3f51581c11cd85bc320ebfa9b8b2de5601808eefb95cc2c", "structural_hash": "67a004453019fb5dee996b14502b77a14d85bf8bda8d0201e88d9bf6ebc8300b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24264.js", "upstream_id": "BenchmarkTest24264", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n eval('eval(data);');\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f269b0f7ebcdd0f9df7656717d9ce454fa44b1bc5e3ad5148bf8278167a7ad9", "structural_hash": "92d73638f75cba6da2d7904b306edea7b68763dd860aa028f9252b28e39fd771", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00815.c", "upstream_id": "BenchmarkTest00815", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, 0);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47c14b1d469ed1dc560a02bae9b88314b2b7fb4743ebe682714fb603b6605ddf", "structural_hash": "9f27a77f726c8b2e649e13242f01de235c3a0d0ae37a128d4dc47fcc1b3cd9af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01250.sh", "upstream_id": "BenchmarkTest01250", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n _rest=\"${target_url#*://}\"\n exec 3<>\"/dev/tcp/${_rest%%[/:]*}/80\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef9c18d8e58c68e8a2ad9b37e6d2d579acbfa007b6a2678a9b2dff8e0311793f", "structural_hash": "544c9df17c0ee37fe347ee39712f42a31662780770a28a3cdfbac19ba22abd99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07935.c", "upstream_id": "BenchmarkTest07935", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20fe676a1994998a860e23afb590b2bb1b29c2b0d8d4aef5633a78e2ff5948fa", "structural_hash": "5c8ef4a8bc4cf4feeeed1ef69f629bf49dac3261a266e44538f320f2bb5d5e3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05162.rs", "upstream_id": "BenchmarkTest05162", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = auth_header.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2253e34861b44719314434b4908205151044c903c422d17eb9507ece04c4de65", "structural_hash": "911887ed2d50933af254abc39cdceb61e1feae7d88cf21801844dae92bee70f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14323.sh", "upstream_id": "BenchmarkTest14323", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n mongosh --eval \"db.users.find({name: '$processed'})\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db870f95ccefa0c703f90e2ea40296f9fd57e8eaeff47e482ec5a8c41222b941", "structural_hash": "b72a56e020b8116ce8bc01849a651e05e3f87098cf7121e0a0bed650a548257f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02152.py", "upstream_id": "BenchmarkTest02152", "language": "python", "code": "from flask import Flask, request, jsonify\nimport requests\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(origin_value)\n data = collected\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64625acdfb23f672a3dd05a31922bb5682887f94b74c057028900dfcccba46b7", "structural_hash": "e9fbf5008d00b1a8a85f109932a0c1fee9ed868e2175ebacc55997c68d99f126", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04326.rs", "upstream_id": "BenchmarkTest04326", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = path_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let processed = html_escape::encode_text(&data).to_string();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa30db68535e4e2fc2259e775cd9b21fdb47d1dba8460cc92e270fe5eb2ba285", "structural_hash": "23e889b65c4ea546f9f04a70c48e6a9bccf1b5435e3738a553613ae4930f3bd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26794.sh", "upstream_id": "BenchmarkTest26794", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n ls -la -- \"$data\" 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6133ba917038ee300025a9a3bc0ca5fd15b3c33baeac510122a572c89c50852", "structural_hash": "549b3b8dc6ddc5d7813d24fc1d4ed4932dd1bba2d20dde2bc1efe0243640e715", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00916.php", "upstream_id": "BenchmarkTest00916", "language": "php", "code": "header('User-Agent', '');\n $data = \"{$userInput}\";\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4dd7be3c72bfc6343a15f8cf43a5ab8ae3ede87999d13ffc9a1136e79c4d6be", "structural_hash": "e99c80b6ab23a1087f731e30cc8021cc0ead0bb5ff60f4846be3741e38eb3c47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22145.sh", "upstream_id": "BenchmarkTest22145", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n (\n echo \"$data\" | xmllint --noent --nonet - > /dev/null 2>&1\n ) &\n wait $!\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99744694a2dfe0960c69cc810a2a86f1e7a3c22c281e9e0a1f4ec39b95dee03d", "structural_hash": "d2058e5706c7fbaa7962f140f026b5e71e58843728060b4e247c248c27e5301e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05823.rb", "upstream_id": "BenchmarkTest05823", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n processed = data.length > 64 ? data[0, 64] : data\n requested = processed.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n render json: { wrapped: wrapped }\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88e298b08e6263d85f777bdeea0abc98b2dc33104b985d20164387e1770ae0c4", "structural_hash": "3ee4922381842381999459c74ed5fa539d71eb295bdaa859a1a934419140bd6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16318.sh", "upstream_id": "BenchmarkTest16318", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb4ee2630e19a1270d935cbe5ae02519926f0b27c2a8a1dd526adc70521a0368", "structural_hash": "34c2e741aa2b80aa6faa88d3cde4a78728fe2b40ac4c301bddfc5e25449d584e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00376.rs", "upstream_id": "BenchmarkTest00376", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = graphql_var.split_whitespace().collect::>().join(\" \");\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfa9895ba214ca64e9d5b0b1a37c824fc5fcb10f664ebd742a5e3b0d7f58a6a2", "structural_hash": "1dccfd7b0700397bd7d962b60f6756bbf608ceef66cf9235e5f99801536623f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13996.go", "upstream_id": "BenchmarkTest13996", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tpending := strings.Split(rawBody, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7650a8eeb101958739ff7c8819bbc92e055c370023ecfd80491d2779f358c4ee", "structural_hash": "fefa71a12f8cd527e0d5b45f0ed97d15fdde7595cda0d5a545075aeb8da09f1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05117.ts", "upstream_id": "BenchmarkTest05117", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const entries = fs.readdirSync(\"/var/app/data/\" + String(userInput));\n res.json({ listing: entries }); return;\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61159df6624d1c265b5973f3245e9594758848e9482a5787b269cec61815616b", "structural_hash": "9fe1bbeca2a6e4316fb5a0baa6d06b1e2553307135d4f3f4967d0641a08da627", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22914.sh", "upstream_id": "BenchmarkTest22914", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12a933533c143bc7d95ffdb74de781b53fb327932532750f77ee7429f2375f51", "structural_hash": "35a93533e8c69026a10d8d53190cc864ee09af92a17b4d1abd3a9008a18afa6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01291.rb", "upstream_id": "BenchmarkTest01291", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n trusted_claim = data.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b2a4860b3a0e8731783f6be7d802ac39cced0bd5da4783ff802fcecb89863c2", "structural_hash": "9238fe229da7b70c67bec06bdca89f8173312a73635e63e4570d15af9671f755", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24751.sh", "upstream_id": "BenchmarkTest24751", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "795c455199231228495e8be160b290baf9d106121bf3de63e0bcca0ef54197a3", "structural_hash": "1dfdbc9473800e8e056ee9306bdf4126677fd9d8ff842e5c972aec9d611543c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01314.rs", "upstream_id": "BenchmarkTest01314", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let data = comment_value.replace(\"\\t\", \" \");\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")).finish()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fda0fce4615e4199db346171e11ff20de59905812cb709e3888489c21f9e0b93", "structural_hash": "caf384a8272dbcc2ec51bbd22ab2384600c16042d9b3f00236a690e30e86f2a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27750.js", "upstream_id": "BenchmarkTest27750", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = String(userInput).slice(0, 200);\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a46fb378c268f40fdbd49f347a76c2202af972af05709b8e3ab59b2a8032ef7", "structural_hash": "13e2fcb2fa1d264ab24f590575388f5d09af81467287b072f33a9067b4ee0670", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01001.rb", "upstream_id": "BenchmarkTest01001", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = format('%s', user_input)\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + parsed_bool + \"']\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97f461e1227af1c206e7e84bff0618a7cfc72bb06dd33256a972e9dd9daaa359", "structural_hash": "7913b546014fe117ce16f53e3ee11f7d20fc0bb7f542d21bdb068ec7e5b1bc83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_33583.go", "upstream_id": "BenchmarkTest33583", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tsegments := strings.Split(cookieValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\trows, err := DB.Query(\"SELECT * FROM users WHERE id = ?\", data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-566"], "category": "auth_bypass_sql_pk", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6144c81d7f3d9d588b6cf2d277bc64804f9724a2766e9e0fe5bf7b56aaf930ef", "structural_hash": "81812cce7688d09ac243dd836f598fa4a486f1ebf0bf86a16d8be2e338c365ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35389.go", "upstream_id": "BenchmarkTest35389", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata := strings.ReplaceAll(refererValue, \"\\x00\", \"\")\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70e5260a614973454b77a28ea85625c79ef1f9cee423d7a283051098b98b982b", "structural_hash": "982d84a99c362a1310899b694f76069db8bec738f745d9584fcc37fe1189760d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02948.ts", "upstream_id": "BenchmarkTest02948", "language": "typescript", "code": "import { Controller, Headers, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = xff || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { throw new BadRequestException({error: \"field not allowed\"}); }\n }\n const processed = JSON.stringify(_incoming);\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n }\n}", "label": 0, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cd515213d1023fed64b1e84f746a472c4aac68fb8192c2c3717f9ca569cc68a", "structural_hash": "e5c85bf92fcfcaffb3bb78b796c1417c2b2e8a54d46fb34665c7fedc1e19843b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03235.rs", "upstream_id": "BenchmarkTest03235", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if origin_value.len() <= 4096 { origin_value.clone() } else { origin_value.chars().take(4096).collect() };\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51994e52cd56df69e5a73b487e4d5178d25e38e30ae2153ec68355a5f717d2d5", "structural_hash": "29ea208218466ca9028094e297229dc22b8191ee985ff406931c7105d31ee47a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19967.js", "upstream_id": "BenchmarkTest19967", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = passthrough(userInput);\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send(\"
    \" + processed + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7df8e43fea0d382d678d737b704ccb169e0f40b21a30c941e03f504020952bf5", "structural_hash": "c407f270e6b5a14df77e87d46bbdf7eaa88c6240cba2d533f0ea620177994178", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02931.cpp", "upstream_id": "BenchmarkTest02931", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "913f4961e1d51377e3a78ef76ddc3a9babeab5d125a8ab2ae414ccdbe319505f", "structural_hash": "46b88c2e7001293f3f069dd1215cf2e80728dfcd8e883cde24351f74d3e653df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01696.rb", "upstream_id": "BenchmarkTest01696", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"ghp_EXAMPLEonly0123456789abcdefABCDEF0\"\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87983de41598753c1edeadde23a31655b423441de7fc37f77e45715bc45f8271", "structural_hash": "8664a69fcaceb2e8683254c204b5db9267155edf7370ffd09dff7f6dbcc45a96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00306.py", "upstream_id": "BenchmarkTest00306", "language": "python", "code": "from flask import Flask, session\nfrom flask import request, jsonify\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n if cookie_value:\n data = cookie_value\n else:\n data = ''\n session['user'] = str(data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e23c7d76e2e6248014c0cd5db1e811ad96cfd471b980653b054a41504b32841", "structural_hash": "9c8b700f0210da1808d94bba896949f5aa77a20a97ecff3d0e4261556b4f22fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04631.php", "upstream_id": "BenchmarkTest04631", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $processed, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e667ad227c2c8135e54813f9f4f73e935a88fc7ab223865ede3b06ef1c9b4f9", "structural_hash": "50c208b11cc07f84055934dd50418404f57d08f2f60b48e588b346fc6ebd682b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19578.js", "upstream_id": "BenchmarkTest19578", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n authCheck(\"admin\", String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1929a85a8187218afacbae04338b158c6d3974e0534ff820587b2b5ea1c706e5", "structural_hash": "55d79336ed351c90bf702dd5403db1001093a92243f6b2b81910c43774c31aa6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00950.rs", "upstream_id": "BenchmarkTest00950", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: env_value.clone() };\n let data = payload.value().to_string();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0590a750736773124e767312f5a17c0b42c00b09a1f344e130483627c1b9d602", "structural_hash": "4fcb20bec4aa161ef1e45cbb5768a0cb48461747a4a344bd44e82606b09d3034", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16200.sh", "upstream_id": "BenchmarkTest16200", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n printf \"%s\" \"$data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de6748f0290b4e553ff3132a625b46cb041c7da6c740390b38589c4fac691fe9", "structural_hash": "a89a49b7d928c68c873f039dcfe0ad83c9f9a6192994243806f92de0c35d5ba2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02589.py", "upstream_id": "BenchmarkTest02589", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport ctypes\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n kind = 'json' if str(upload_name).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(upload_name).strip()\n case _:\n data = str(upload_name)\n requested = int(str(data))\n wrapped = ctypes.c_int32(requested + 1).value\n return JSONResponse({'wrapped': wrapped}, status_code=200)", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "092f1700529a664a07ce1061109ece748311d09981b2729d23d2f8fa490f3d75", "structural_hash": "03b75001501839cdd735417a14255d62f6f468664aa52aa5385f92f0d8701bd2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03006.ts", "upstream_id": "BenchmarkTest03006", "language": "typescript", "code": "import { Controller, Post, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File): Promise {\n const userInput = file?.originalname || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e086e3bc7b4c55af37091a07d512ad71ae2db76fb8ef546c8cbb7025ba5acf99", "structural_hash": "cd662cb9716436b5005235dc3d7d3d6d15286c97515e27da1ecbe3c1bc740e31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02798.py", "upstream_id": "BenchmarkTest02798", "language": "python", "code": "import csv\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n if comment_value:\n data = comment_value\n else:\n data = ''\n cell = str(data)\n if cell[:1] in ('=', '+', '-', '@', '\\t', '\\r'):\n cell = \"'\" + cell\n with open('output.csv', 'a', newline='') as fh:\n writer = csv.writer(fh, quoting=csv.QUOTE_ALL)\n writer.writerow([cell])\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32f7cba845f6935f16b683957942dc824412fe2c91fa3a1969e305cbcc1d0d80", "structural_hash": "fb62652ef3ba1e73db185b6e5abbbb6e54c8df6a14a4e1e49aaab757881dc900", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01461.rs", "upstream_id": "BenchmarkTest01461", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let tokens: Vec<&str> = raw_body.split(\",\").collect();\n let data = tokens.join(\",\");\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af57d8baa6a6acfdb76cf6441403050646b4761119765c68a10972057096ebcc", "structural_hash": "768c272f5328cb99ea0d87af41869d3a783363a0e68a7807011d872d64de1072", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04252.rb", "upstream_id": "BenchmarkTest04252", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de5531fd3eaee5f9ebd98fb76fb190d3caa7b395a6e42e819c39eb70683c72be", "structural_hash": "f00474670521a019c69a52ae88ffd3ae244e27ebee056c780e288f5ecda69bc3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04670.rs", "upstream_id": "BenchmarkTest04670", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data: String = raw_body.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| raw_body.clone());\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b82002c0869e7451d1f563d9deb64e93cdf36d8e3be364d0663c4b61208aaf07", "structural_hash": "e6110d7313259bbb67a7636f7cc7cc349f520c9c588b8e55a6252b5bd3f9df6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00999.ts", "upstream_id": "BenchmarkTest00999", "language": "typescript", "code": "import { Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec0b2030701e226e7798be7760e86fc7e7a38f5064ee21886b65b567098f3e7e", "structural_hash": "b1aaa2b63a0559b5e44a746830a218f04ece43a1bfca361034b8f5147cab95ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00453.py", "upstream_id": "BenchmarkTest00453", "language": "python", "code": "from django.http import JsonResponse\nfrom dataclasses import dataclass\nfrom app_runtime import auth_check\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n form = FormData(payload=field_value)\n data = form.payload\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55808a9f87ad0f06b5e237a77662100b78660112d2d5085fe64f6df752067916", "structural_hash": "77696be8939ccc6870db598ca60f025831b711eb752796fbd4574535c623198a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04651.c", "upstream_id": "BenchmarkTest04651", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n long _n = strtol(data, NULL, 10);\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adfbf3b4ab27e89b2f00a483462c2289f96bb6586fb4ad4bec80f733f39bf6d7", "structural_hash": "42b8e67dcd36e5a215963b93b416415fc4c295a812cd33d133b06e1e32990daf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_27310.go", "upstream_id": "BenchmarkTest27310", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tsegments := strings.Split(cookieValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tcrlfStripped := crlfPat.ReplaceAllString(data, \"\")\n\tprocessed := redactPat.ReplaceAllString(crlfStripped, \"****\")\n\tlog.Printf(\"User action: %s\", processed)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c61a01dff347a50d2e68be224e2a63b505895ed05cbec51770ce8145976e631", "structural_hash": "2c15262581d032b30693513bbaf635eec768b1668deb26cca2445d63f75a7a06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04073.py", "upstream_id": "BenchmarkTest04073", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n data = ' '.join(str(referer_value).split(' '))\n if data not in ('asc', 'desc', 'name', 'created'):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n eval(str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a26ccd6298a02ba8e1e9d1c5617679c43aa34993be78798acac89046bd66400", "structural_hash": "30f892508c166a7ecaed0b54f3024b2e2379f788baaa1d54ffa49829a0c0b684", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33458.js", "upstream_id": "BenchmarkTest33458", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d9ca3511418125b6192c58f7c8ccff74a909a3fb1f515b82d3d4bc19f51adfb", "structural_hash": "c073f29b57581775f64c5b1d0875a9a3ea4162f0405a925a3dfa7a46b8edb694", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_21520.js", "upstream_id": "BenchmarkTest21520", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = userInput != null ? userInput : '';\n globalThis._stateLock = (globalThis._stateLock || Promise.resolve())\n .then(() => { globalThis.sharedState = data; });\n await globalThis._stateLock;\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bf647da9f7c704184adadace7164333b129f02b11cab561c8130d8d66a8fcd4", "structural_hash": "9e62fb0d60c28c481192dfef6ff204496802088454f384355ec8b4a4ec460194", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01543.cpp", "upstream_id": "BenchmarkTest01543", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c41ee3f63a0159571fd815bbc482b44cc1cc2f116d8ed84459d14bd80569d453", "structural_hash": "98978caeb60695ca1a0254abf7e07d8a4394ab87545cd693582fadb8e2a26bdd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_31988.js", "upstream_id": "BenchmarkTest31988", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n if (!row) { res.status(404).json({error: \"not found\"}); return; }\n const value = row.name;\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c904f327646a428a729456ca51ea909d511d6e4a3214307d76a153c574d5006", "structural_hash": "0512478ed9c2e65707391cb7ba9d9b57ad83a9b155d5b31ff539b0a1c9f9e685", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27464.js", "upstream_id": "BenchmarkTest27464", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n try { JSON.parse(data); } catch(e) { }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "177887d4d47530d5028fb67c4bc4fb12e0c401e3ca170d6dede5b4049abe8155", "structural_hash": "33e0f49a1fc8a05846cc7d91178f3cbe81f6959e4fe88ea044ecf4214534f07d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00060.rb", "upstream_id": "BenchmarkTest00060", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n Rails.logger.info(\"Action: \" + processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc79d148bb6ffb34839c89b2d1dfa2306988f1e434944401aa73d83b9836203e", "structural_hash": "37f266b0f1f0e384984b8794ae40c4d993878b15cb40800267d6334b02cb32c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03867.cpp", "upstream_id": "BenchmarkTest03867", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n long _req = std::strtol(data.c_str(), nullptr, 10);\n if (_req < 0 || _req > 65535) return;\n long _alloc = _req + 1;\n char *_buf = new (std::nothrow) char[(size_t)_alloc];\n if (_buf) { _buf[0] = 0; std::cout << \"alloc:\" << _alloc << std::endl; delete[] _buf; }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4cd9058f384b56c903ae47dea11553ae7b83f9b70e446407338f6e6a890ce7d0", "structural_hash": "2dd7b1263717759819a1b2b7f4544f4c3daf176c6768732a828f3059e1ff1c60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00346.php", "upstream_id": "BenchmarkTest00346", "language": "php", "code": "query('id', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dc676b1107377753b170ed1a2449398cc95a4801ed9891ecd3ca0f443b89199", "structural_hash": "dcc01e41559c49cf7e24d87c9df4154d3e5738039d1bed7b914878407cb17bed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05501.rs", "upstream_id": "BenchmarkTest05501", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = crate::shared::passthrough(forwarded_ip.clone());\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n ([(\"content-type\", \"text/html\")], format!(\"{}\", processed)).into_response()\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca6c1907dfceec7691f70674800046494cf49dae81472ccf408a559c46bcb2fb", "structural_hash": "5714ae532e812c822ae4577f527405db64d08d54005936364309e0d60dcb523b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04555.js", "upstream_id": "BenchmarkTest04555", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n fs.chmodSync(\"/var/app/data/resource.txt\", 0o600);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1cee533d8db88800f24f75a4a39691578588aab6d580c4d6fe2c0a40e0459e33", "structural_hash": "cab54577ffde7331353cf0b3adf7a1700b293ab04d6bde22d7c41c4be7f170eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30744.sh", "upstream_id": "BenchmarkTest30744", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(printf \"%s\" \"$user_input\")\n case $data in config.json|index.html|readme.md) checked_path=\"/var/app/data/$data\";; *) echo \"forbidden\"; exit 1;; esac\n echo \"uploaded\" > \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee28d2ac3cd883cc61e015a3027693683e10a6e8b4744f6259fcccc7aa28df47", "structural_hash": "d4c5c7470527e8777bcc62ec0b75868efc3e17f7aadbb84cf4c0fa434feeb54b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03912.rs", "upstream_id": "BenchmarkTest03912", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = cookie_value.replace(\"\\t\", \" \");\n let processed = [\"true\", \"false\", \"1\", \"0\"].contains(&data.to_lowercase().as_str()).to_string();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&processed) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c270d3e64d2a06886972252713d3c72174db2444aa5ca64548b62805ea7b870e", "structural_hash": "54247b54c486e17743d32e42a0a66b89cc9a7a0f579cb203c702deb6a6c099b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02089.rs", "upstream_id": "BenchmarkTest02089", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = origin_value.to_string();\n crate::shared::ldap_search(&format!(\"uid={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36d1725595e0455738655aa8e7c27600eb6c55f4a8677f9d14fe792561b4ccf9", "structural_hash": "d78dd6717edf8e18bd7c8f916868405f8d1b5aee948af36d2808a4c766e16c1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05456.rs", "upstream_id": "BenchmarkTest05456", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", multipart_value).ok();\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f49e91e1f775b0742f3204fb90c01038c9c1185341c250ca70287ef66025d20", "structural_hash": "b301ccb712660d6352b349dd50fe1cf682e60f08ab0ee26a0e8ad082a63db885", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02724.ts", "upstream_id": "BenchmarkTest02724", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const data = String(userInput).slice(0, 200);\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "682832b13cdff063681320e0bc7adc26d998df137893a6b9917cb241a26bdbd4", "structural_hash": "1474798453cb598b23959f6460379af26e0ee4471bbbfc39cb0a6993f162aceb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04167.php", "upstream_id": "BenchmarkTest04167", "language": "php", "code": "name;\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n yaml_parse($data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35bd87d62ca8e6a08218179c47297054deeffb3c534a91e3cd9f96e8b34019a8", "structural_hash": "eb350d598d8f073264696969cd00bc4e8bdcda7bef92f62782f266a3187cdef5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05570.php", "upstream_id": "BenchmarkTest05570", "language": "php", "code": "input('field', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5accbeea0b1333319412b6a385b0246649d44229643535895a535bceafe6bae2", "structural_hash": "d308d13582bf84d1abc36cd9f04c2d5bd7c700fd22524d707aa203830c2fd39f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00810.rs", "upstream_id": "BenchmarkTest00810", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(json_value.clone());\n let requested: u32 = data.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "711e080da4477727a8372ecda2acccb56f92d5502bb9dda55ce4352b39365ba5", "structural_hash": "e3d78cd292675fcf025b5c8c98f0876aeb9001e374cf4fa151634176b6555ca1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33755.js", "upstream_id": "BenchmarkTest33755", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = \"\" + userInput;\n fs.writeFileSync(\"/tmp/\" + data, \"content\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d62163d1b3d555703d500bfaae764b48bbabf3fa442a3e52d1ec5749232238c", "structural_hash": "33460d842f660b2fab4b0ec33a8d55ca9d322dd4483f9808668e22ff13dc621c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_00451.go", "upstream_id": "BenchmarkTest00451", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/microcosm-cc/bluemonday\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(pathValue)\n\tprocessed := bluemonday.UGCPolicy().Sanitize(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "793eefe3663dd93834fdafec49da94b99603a19c0652f4c996a6a30548af9fd0", "structural_hash": "5fc7cbf61f7bb4f7b5978ab64f99361966f70ec901983974b3e35b24781552af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02735.php", "upstream_id": "BenchmarkTest02735", "language": "php", "code": " true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb41d40415821e7bafe6f106942fdac9ece41188e1f1436ff95893f2d86b2938", "structural_hash": "07fe7b3c9dfb6b0608ab3fa54f5781123c2e77852bf4ec42db9cc9fc4ad2baff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01802.rs", "upstream_id": "BenchmarkTest01802", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", cookie_value).ok();\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae0e8d000ae1235036d46d627554d01bb0004e7741bb7d510114c77429fbdab1", "structural_hash": "4bfcc0fbb417efac281e4d8ab84610e285da0d862b66c5f52993179c98707da0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00631.php", "upstream_id": "BenchmarkTest00631", "language": "php", "code": "cookie('session_token', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('output.csv', (string)$processed . ',data' . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96f66b9cda1ef3ef379fca44e346ad7e47bd65118bd3fe26632121b34e2e6dcd", "structural_hash": "1c074af78d7c5c4c94736d64c222ff56ae9a79cb6a5d147f99559bc1e7e577f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09235.c", "upstream_id": "BenchmarkTest09235", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char *const _argv[] = { \"/usr/bin/tar\", \"-cf\", \"/tmp/backup.tar\", (char *)safe, NULL };\n execv(\"/usr/bin/tar\", _argv);\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47406140ee423f081d0c1b3e3fd3a44044044298781ac7a29668780652c731c4", "structural_hash": "11176c1323f6cb39f8b1f9849cb9829e2c36e0cc67ccec699d00a4cc4aec5fca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01097.go", "upstream_id": "BenchmarkTest01097", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/tls\"\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tcapture := func() string { return hostValue }\n\tdata := capture()\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\tresp, err := client.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tw.Write(body)\n}", "label": 1, "cwe": ["CWE-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58b3f92cd0cb51828239daaa8c45b90a48fbc80e6ae3d1c0741a0f7b500bc3ad", "structural_hash": "f0e9b4995557bd533b4508bb321d99d028900f7b96941a0a58205817e80d3b8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03085.cpp", "upstream_id": "BenchmarkTest03085", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef8ec0a883b48f45fcb4acb4178c84a4ac0dc4a259e850fa79d5e50a9b1e542a", "structural_hash": "8dbb5ee012a05f194de847b1fe59966c3510bf27fb0edd4f2594d0476308fe2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01260.go", "upstream_id": "BenchmarkTest01260", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tcapture := func() string { return rawBody }\n\tdata := capture()\n\tw.Header().Set(\"X-Frame-Options\", \"DENY\")\n\tw.Header().Set(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\", \"view\": data})\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b25c13ab9e9c75100525c165818d1269e9cd530089ecd828430f1bb30d53c21", "structural_hash": "fb57ca5635e976e99e5e161273e5eb7a7848fe811a030613c65f00da1feaef59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05213.rs", "upstream_id": "BenchmarkTest05213", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: field_value.clone() }.payload;\n reqwest::Client::new().post(\"http://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8c92b2ab46d7da4e64c68f04ecbb9c19e12e3888acd19d27dbb437389027072", "structural_hash": "b506825ebb92ac1f1339936e64c123e7aa42fe737926254bff5c575fd65075fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04534.java", "upstream_id": "BenchmarkTest04534", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference atomicValue = new java.util.concurrent.atomic.AtomicReference<>();\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n atomicValue.set(xmlValue);\n String data = atomicValue.get();\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n return Response.ok().build();\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56715f7caf4e5ccab5c93f1947e4904ff6633be68e4ea7f4c987271f86665fa0", "structural_hash": "ede9dac2a2706c18d548099535139bf60b14aed7871789fd6584a23a3b1667de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12649.c", "upstream_id": "BenchmarkTest12649", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f40336c3b1a543e113b552aa2faae3fe4be34dcdccca233d25afca94ce12afa0", "structural_hash": "d562d95012be57b38eaab2b7300c19372befe16ca271110d0b44b3f71e443462", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00383.ts", "upstream_id": "BenchmarkTest00383", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52a2a971ff572adb46209d340c5eb75e33134d614e2d9c68340b2417b7e84d74", "structural_hash": "330ea1d3d8a8cdd12673aa41f1100551e48af0f0a6db84b6325e8f6db0c1426a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00856.rb", "upstream_id": "BenchmarkTest00856", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n cell = data.to_s\n cell = \"'\" + cell if cell.start_with?(\"=\", \"+\", \"-\", \"@\")\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [cell, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbc5004f24856547e77c736d79b5dca875ca9b707fa19d2304341a0b3fbcbe3e", "structural_hash": "7eef64647f0a1e27c2871a26995e0d6574b206ccefc254ee6ab9cdeb68a9c19c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest06083.java", "upstream_id": "BenchmarkTest06083", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/json\")\n public void benchmark_case(@RequestBody GraphQLRequest req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(graphqlVar);\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { response.sendError(403); return; }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n response.sendRedirect(targetUrl);\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a69451fc7c043dbed51dcd10025d3b0a59bc6a66a60483c75640c3f2e8978c5", "structural_hash": "8cbc7da68eb0fd022cb818fdf0af7d06665f5a879715be1024f1487d40addb6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24130.js", "upstream_id": "BenchmarkTest24130", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n function normalize(value) { return value; }\n const data = normalize(userInput);\n ctx.set(\"Content-Security-Policy\", \"script-src \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9313ecb55876cca3e11036b2dfb227e154116ba2b25773dc1e1d29abc5774817", "structural_hash": "6983b314939f444b49d5e884826052585de449276315ce8697861e7b870264ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01811.java", "upstream_id": "BenchmarkTest01811", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{jsonValue});\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0207495ff1ecf5b0d7d6c4d34d3e8bc60a8b28254b31ec6f8a56291b36aaded2", "structural_hash": "3db2a2bde60ae3a8c634c0e766238b5b0ffdb1e52a331c67c440d27c75032b6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01971.php", "upstream_id": "BenchmarkTest01971", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff44f7e8b54c1b94734db449c0306c6881da8e1a69a7b4914d6af1f44e110b1d", "structural_hash": "096608e8360171a8b0326f63d9327200ca43f909981b6211be8d0086b657cd5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11430.sh", "upstream_id": "BenchmarkTest11430", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d11f16dd7ece022672d865b6d24fe3e5615784dc4d25aaae859af822cabb6b39", "structural_hash": "6ecf545d9c66fe79e47a5554cb9be10a7d4c2b4d1fb682cb94aed3fe59d1b77f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04722.go", "upstream_id": "BenchmarkTest04722", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"time\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tholder := InputCarrier{UserInput: uploadName}\n\tdata := holder.UserInput\n\tif time.Now().Year() >= 2020 {\n\t\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\tw.Write(content)\n\t}\n}", "label": 1, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a25c1985d3a117ba6f72e6229632918640a3b302fd26ddbca85344c6b6d1b967", "structural_hash": "ebb4622ee08746fe66d7583dc6388fb552937c206728e9d2864069778e1c0464", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00162.ts", "upstream_id": "BenchmarkTest00162", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (typeof process.setuid === \"function\") process.setuid(parseInt(data, 10) || 0);\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc12dd180222ed80fd8a5bcb7036b6ed4ddc275dd5e3a6e207da7f2909fbbc7f", "structural_hash": "42fc012364d0a39652cd665012191e35762655a6e0873e63656366cc79ee18c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02960.ts", "upstream_id": "BenchmarkTest02960", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as net from \"net\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.origin as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const targetUrl = data;\n net.connect(80, targetUrl);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "870ee68182a1f50bc44e473ed5a5cfbae57146817e02b228dd85b8d043728fc7", "structural_hash": "ebdd51c58736da8c05db646fb13e20d908e4ae9ca4830c6618fe8bc3cda6e7ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02036.php", "upstream_id": "BenchmarkTest02036", "language": "php", "code": "json('payload', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n if (empty(session('user', ''))) { abort(401, 'unauthorized'); }\n error_log((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fc940608d774b88c3c2524ffe03e5a0f57c55effa7aaa4feffc19f2a1fa7adf", "structural_hash": "bd4318d41c9015cbeb3cc1f9bad74e5c0ab250f272312473e19fbb5b8dab410b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01167.js", "upstream_id": "BenchmarkTest01167", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n eval(processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "403889ece129fd7c7a0e85678ce3d7be4b0e63cbc006e5afa577fd2162bd2709", "structural_hash": "282b4a31041e760f5e9c22243ccc88a3d919c85108fd55bde91c1d42dbc11d53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16260.sh", "upstream_id": "BenchmarkTest16260", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=\"${user_input:-default}\"\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n printf \"X-Custom: %s\\r\\n\" \"$parsed_bool\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df517e7e1d49d805fbd1b508fe30bcfd883d25ef3c864477d62c9333f5e51076", "structural_hash": "e8cb4ed36dc2e884e66d94d14ae4c20ad229b929336d1be2ae831347ee0a0731", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28224.go", "upstream_id": "BenchmarkTest28224", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(multipartValue)\n\tdefer func() {\n\t\trecover()\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 1, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f01b91b33e0e3b40351417822479e1ec8da262315888635d195fd1e72813573", "structural_hash": "e1604084f23dbfd403746c802b93c47d69fa36327ae2699102a6e8a5fef65408", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11840.c", "upstream_id": "BenchmarkTest11840", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n char _dst[16];\n if (strlen(data) < sizeof(_dst)) strcpy(_dst, data);\n else _dst[0] = '\\0';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52f15853479bad78995126df6bb0f0e3d1b0ee70ba1b5e19826aa6a7c34ee052", "structural_hash": "8734b52868d9c6367c1ba792f2b9f39dd537ade0df8e76c1571ecabf84edcc5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00806.cpp", "upstream_id": "BenchmarkTest00806", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Cookie\");\n std::string data = cpp_module_transform(user_input);\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d77c4725b011cc29e0c75c26701b344233e1e89ca6860a0f35e45e3ac4e9627c", "structural_hash": "7bd580447360852148a60b82ce1fdeec2fe48fdafb7d4a5d80480428f1e42efb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01905.rb", "upstream_id": "BenchmarkTest01905", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = format('%s', user_input)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68fc371b5a79421d12f18ea3175fe1890c3c057609fce04eba290aa1132b8828", "structural_hash": "e45a21eb40c67391f0edea3818a64d0daca54c5f816aa5e56bef3487346de6a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32066.go", "upstream_id": "BenchmarkTest32066", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tvar data string\n\tfor _, token := range strings.Split(multipartValue, \",\") {\n\t\tdata = token\n\t}\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27dcfc3f094e6a3b82fa8c1d3f890f90bc1469983fbc058dcb039748ade8f64a", "structural_hash": "53b9c94b112734c978afd34a9e38c735b08098dab888dbb6220e20e7b18cd879", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02212.rb", "upstream_id": "BenchmarkTest02212", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n requested = user_input.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n render json: { wrapped: wrapped }\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3e6de720a8009f1662b99efe8ec49d376e9aeea376659cc352021819c0c724b", "structural_hash": "7564bfacedd069c05faf0c1ef1c3db78fec179a539df08171e15524ff13778e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15105.sh", "upstream_id": "BenchmarkTest15105", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"{\\\"echo\\\":\\\"%s\\\"}\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "465d8743e997d1263ff474068006a36758391fa5a96bbaebedc7a310b8cc3a14", "structural_hash": "d6c98f9357de55d260b1c9ad075fe99ca3b52c5abf1382dab788715bed2dff52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00962.cpp", "upstream_id": "BenchmarkTest00962", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data;\n if (!user_input.empty()) data = user_input;\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e32abed7bdb62b70f46b92878124439fa64bab0e811bce2dcbcacc06c074e14a", "structural_hash": "bee1c419f3a5a2cc68a195217e940ca680b2c5d313678a621da18a95cbcdd104", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01664.sh", "upstream_id": "BenchmarkTest01664", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ee52bc21dca0c6d69c3af2accd93b3483001b69fdc602d684f4dff5a5173b52", "structural_hash": "1e710f2d8e7d00894312e01e84ae028c22de9791525baf11a3aad6aa2484c791", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_14301.go", "upstream_id": "BenchmarkTest14301", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tif !validInputPat.MatchString(uaValue) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := uaValue\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a145f6a5b5c0509371be310db1ed6ace780446a5c37910f76a3002731309170", "structural_hash": "b782044c7632b346c29797d62cbf94103eb7a2dbfda79a9728c4db77e5cb84c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02917.rb", "upstream_id": "BenchmarkTest02917", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n tokens = user_input.split(',')\n data = tokens.join(',')\n headers[\"X-Custom\"] = data\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5454ed3060abd9ba1063bc3d0a39d11de5b392abe0444f3e89cd4ea17e134741", "structural_hash": "21e4732c31a625def4c3520f00ac2a6c1dd586e87952946f1a45baac5fe89968", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01930.py", "upstream_id": "BenchmarkTest01930", "language": "python", "code": "from django.http import JsonResponse\nimport re\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n data, _sep, _rest = str(xml_value).partition('\\x00')\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n with open('output.csv', 'a') as fh:\n fh.write(str(processed) + ',data\\n')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4469fa30dcd32e0f1ac3792b006f56d5606fe6ce596dc1c960e47a3e72ea92c7", "structural_hash": "306becbc99ab8fbb32a690426e9e5b0731d0e2184785136342d1fbcc5d41d329", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10888.js", "upstream_id": "BenchmarkTest10888", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const _merge = (dst, src) => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n ctx.body = { status: 'ok' }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e920999f7fb305e8ffa4dc5c115985fe0c805984338d63761791b1e931b3293", "structural_hash": "107406478a9c4a6fb99808453afaa95f0fe836f194c5d7c3671546f360062b85", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06723.c", "upstream_id": "BenchmarkTest06723", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n printf(\"%s\\n\", _p);\n}", "label": 0, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a4a2bd064c52963d70c33131fe3ce9272e37c20973d4005723d7a4801a03318", "structural_hash": "bfa25e76222200af046511956e5a0d76a78d18d11367165d80b9fb0a7a727eac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00255.java", "upstream_id": "BenchmarkTest00255", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n private static String dbReadColumn(String sql) {\n try (var stmt = connection.createStatement();\n var rs = stmt.executeQuery(sql)) {\n return rs.next() ? rs.getString(1) : \"\";\n } catch (java.sql.SQLException e) {\n return \"\";\n }\n }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userName = java.util.Optional.ofNullable(dbReadColumn(\"SELECT name FROM users LIMIT 1\")).orElse(\"\");\n new ProcessBuilder(\"echo\", userName).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c07e5c17c06f831b4cea74cfb2d97c6617b64b905264b734db74fef053e2ce2", "structural_hash": "b38c26239744fa1da48333c44e02c767737b8e122e63614d7013a6a66b10efe2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02166.php", "upstream_id": "BenchmarkTest02166", "language": "php", "code": "headers->get('Authorization', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5c84c25da80543dd9deec681912c984fa7bc59dd19f48d6c0f14cd355c8643f", "structural_hash": "98f155e4ecd97bbcaaa752cc94a9961990b931b6b927f033fd094b1944290581", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24269.go", "upstream_id": "BenchmarkTest24269", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tholder := InputCarrier{UserInput: cookieValue}\n\tdata := holder.UserInput\n\tvalidPattern := regexp.MustCompile(`^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$`)\n\tif !validPattern.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"forbidden\")\n\t\treturn\n\t}\n\tprocessed := data\n\tallocSize, _ := strconv.Atoi(processed)\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(processed))\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67285afa8c688f026a8c9f6b9d8ee8848cac6a225405dbec8ecf6beb0f656b41", "structural_hash": "c81d98d248d7a6fc49c710553f5f96f2c29aad50c0bef07d95146811a2e51514", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09241.go", "upstream_id": "BenchmarkTest09241", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\thexBytes, _ := hex.DecodeString(cookieValue)\n\tdata := string(hexBytes)\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data, Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4f039dfca2ddd25dc09b0bd79f4839c036c9f4e936487181aee9702bdbec7e4", "structural_hash": "a1521d28a6172ce635ef3224e85ef0e211606b02831a80b1cb7a744d5c83edac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02473.php", "upstream_id": "BenchmarkTest02473", "language": "php", "code": "header('Origin', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $expectedSig = hash_hmac('sha256', (string) $processed, getenv('DATA_SIGNING_SECRET'));\n if (!hash_equals($expectedSig, (string) ($request->header('X-Signature', '')))) { return response()->json(['error' => 'integrity check failed'], 403); }\n $trusted = (string) $processed;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81ca5307fb42650569999f988dbaab25a7178047fc4d2fd1a117ba90eb4eebe2", "structural_hash": "ee2ea907d80ebd5de9ff93f9599859cb42b29f14cf0783a46e3dd17b0f83f490", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04274.java", "upstream_id": "BenchmarkTest04274", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final class ValidatedDto {\n @jakarta.validation.constraints.NotNull\n @jakarta.validation.constraints.Pattern(regexp = \"^[A-Za-z0-9_.-]+$\")\n @jakarta.validation.constraints.Size(max = 256)\n public String value;\n ValidatedDto(String v) { this.value = v; }\n }\n private static final jakarta.validation.Validator VALIDATOR =\n jakarta.validation.Validation.buildDefaultValidatorFactory().getValidator();\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + pathValue;\n String data = valueSupplier.get();\n java.util.Set> violations = VALIDATOR.validate(new ValidatedDto(data));\n if (!violations.isEmpty()) { response.sendError(400, \"schema invalid\"); return; }\n response.setHeader(\"X-Forwarded-For\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6dd18b456e9d844f1369e79259263c52d7b73cfd0e484eba54dfe9bad6b58b9", "structural_hash": "5606fd7469a6d9eee7b923985e5e50fa6535a1d6f9bb06d81cc7e073837bfedd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04723.rs", "upstream_id": "BenchmarkTest04723", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(field_value.clone());\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d64c8d2f2f4b652ec17a75197258da489960cd8edab52b55a3ab12720a286a3", "structural_hash": "a8fde31968faac12a1a0984c196bfac233c70b707898759cdc76dd0f01b19ac0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_35755.go", "upstream_id": "BenchmarkTest35755", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- jsonValue\n\tclose(_jobs)\n\tdata := <-_out\n\tprocessed := data\n\tif len(processed) > 64 {\n\t\tprocessed = processed[:64]\n\t}\n\tconn, err := net.Dial(\"tcp\", processed)\n\tif err == nil {\n\t\tdefer conn.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "508abed81ec1363cf5c297fd7199965c1c4afdd2e18b7a40bb6ce22907bc5c61", "structural_hash": "a9e5d2daa8c340cfd226c86afb630157f83312eba689eca920bdd5fe8504f737", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04445.java", "upstream_id": "BenchmarkTest04445", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(rawData.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c18bcb1a352f5d0e56ccbc96f6ea6fecec0c4110fc8a5e86a7a68bfc1f52a15", "structural_hash": "44152f516e6b697deb61bdd91e8efb49180005a8e11667bfd8d873e7e855a445", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01146.php", "upstream_id": "BenchmarkTest01146", "language": "php", "code": "query('id', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$processed]]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "debb25656c7d592195314e44b331ad7ad5f63f964054cfdd10238bb88d4f1dbe", "structural_hash": "acb5766c41b33aac2be14808912b187cd0fe897e565a811f8ed1c4dacd8aa0e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01839.java", "upstream_id": "BenchmarkTest01839", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = fieldValue.isEmpty() ? \"default\" : fieldValue;\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eab00e032da4cbb722aa1fa1d1d828593e5f5456b0bc547876a1c19cc75e3612", "structural_hash": "ba4439381b6507718d61e496bff82bd0da2352399d93596190c146d4ffa340ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01266.ts", "upstream_id": "BenchmarkTest01266", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (!shared.authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8aa7ed35d8d584eb3ff83dd164c7fdaa4ddbcda7e494ba0a6077af21ee0cedeb", "structural_hash": "8f97b19c7e510f5a8a41ca817e111021ea8d5c25c89d83f6cf8edccb9bd51ada", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05021.php", "upstream_id": "BenchmarkTest05021", "language": "php", "code": "header('Host', '');\n $data = sprintf('%s', $userInput);\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { abort(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58e7c616211af1eb362a6d08532123811ba228ec773d4072bde5e6bbe40555a1", "structural_hash": "ca651c6839a838061b4f95db68922fc0e084e630ebe17e574662e390e1ffc54b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04397.ts", "upstream_id": "BenchmarkTest04397", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = `${userInput}`;\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7e3b61ef88e85d223d9dfafbc62d08b75b5a6fdd6838aad0818c527c506ff41", "structural_hash": "b247a17ded2cd457e94cc4dd6496f5d03af2ec7387ac1a12bb595c549f7b97fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21562.c", "upstream_id": "BenchmarkTest21562", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02bff2e869432a704a6613c3eb2737705a2265155be3a481e879ddedcded1362", "structural_hash": "9aad3c6a35589b9094cede327212e751b46dfea450914c713262b447834e5f65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07660.c", "upstream_id": "BenchmarkTest07660", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"w\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10572ee721bcc406c556b8d2af8f474fb5c55e58f923284cd4eb6e08e2cdfa50", "structural_hash": "d622424058d1ec1057128c995a0504683c5e811549caec1b540715b7ef582a0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05218.java", "upstream_id": "BenchmarkTest05218", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(multipartValue)); }\n catch (NumberFormatException e) { data = multipartValue; }\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4efa34cda1d8415862aa40ea0678b05fbf3a7e9961a981fe57239b08e56866b5", "structural_hash": "739775065fbb511c7c0dc3c825b102a1f37978b6926e6ff5782f1f325d894bb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02208.py", "upstream_id": "BenchmarkTest02208", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = '%s' % (cookie_value,)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96149924228de4d8e361ba974276d677068b56fcf30c4f20403081d8780a7947", "structural_hash": "b5c4666099b7caa0be6903f77879be645a06cb78893059027d52e7131cf515d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02074.java", "upstream_id": "BenchmarkTest02074", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/json\")\n public void benchmark_case(@RequestBody GraphQLRequest req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n String data = graphqlVar.isEmpty() ? \"default\" : graphqlVar;\n response.getWriter().print(data + \",data\\n\");\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee06f61d7fc11d360344525a90d830c8bf4231e0199643f20ea5d24230ce293c", "structural_hash": "78f7b41b7efe1502fcbfaae72c26693efbac514421580a3be96bc69f95fe39fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01216.rb", "upstream_id": "BenchmarkTest01216", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e70f03d7ecbe21c3ace7174f86f11eeebd7eb62022b21c176fc4a1ddfdfc2883", "structural_hash": "5a49398da91b9d9fd6f3366892277f7ede9a34623dffac1f61ea9502dd04d33c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01766.c", "upstream_id": "BenchmarkTest01766", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0fbaedfcf3a8ae69ced074fd0b1d0c81591e0f8542352cd542ec59e38cafffc9", "structural_hash": "d8c293f775afe34f9ab3af271c870107fee87e2632761dbdd2fe30af69e08853", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00456.php", "upstream_id": "BenchmarkTest00456", "language": "php", "code": "header('Referer', '');\n $data = trim((string)$userInput);\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n return response()->json(['ok' => 1])->header('Access-Control-Allow-Origin', (string)$processed);\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28a309059d9e18f1277d93ed07c7e59170316999f215dbe06668b578001efe46", "structural_hash": "06a0e665abd2ca7fc55624664306c90eb421377e41e01a63e2ffa48071be4306", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00844.cpp", "upstream_id": "BenchmarkTest00844", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3374bf9ebfb6eac9deb82735337afa019567d614afa0821be8d3101936bf4768", "structural_hash": "6af8dd9535264973c88cf649502de7c96a184cd9bd4c8b42c7de0b689b598b58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16134.sh", "upstream_id": "BenchmarkTest16134", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config.yaml)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f08586d01e967045d314d59c158e54667ab810a403d767d928891f689f80e81", "structural_hash": "6124e6d174c9d13a7a430137ceb05caeb496d3761959cc824680f9e7b8dd6910", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02934.py", "upstream_id": "BenchmarkTest02934", "language": "python", "code": "from django.http import JsonResponse\nimport os\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n ctx = RequestContext(referer_value, source='form')\n data = ctx.payload\n def _primary():\n os.system('echo ' + str(data))\n _handlers = {\"primary\": _primary}\n _handlers[\"primary\"]()\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01a1c9faf35c34f33dcea61ced3afcfcc2980a2e8eaec99cb0a123f7f662447f", "structural_hash": "a22088fc0fdf3f9ef189ff5a836cfee35ca8b81269ce7024a84e3768e708f4ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03526.php", "upstream_id": "BenchmarkTest03526", "language": "php", "code": "header('X-Forwarded-For', '');\n [$data] = [$userInput, 'http'];\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bc048fa5e86166a25a502f0b83e18d3accbd45546cc36504cf01f90308eda3a", "structural_hash": "2ed5dd67715d7233758d000cd78dc720dca5b5c8b9ea5892bd2119af383076bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00877.rs", "upstream_id": "BenchmarkTest00877", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = header_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let processed = html_escape::encode_text(&data).to_string();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6616e9181a67b387b2d8744b45919d341bafa558cef5d1d8a3de5eba67702b2", "structural_hash": "0af8021f5775a4adea2a236f73f20534fc8f3742a9962bf2b3eeee7e83d8a8af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05052.rs", "upstream_id": "BenchmarkTest05052", "language": "rust", "code": "use ammonia;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n let transform = |v: String| v.trim().to_string();\n let data = transform(multipart_value.clone());\n let processed = ammonia::clean(&data);\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc6125b9a16c413dbc4e3c9308f75437e8dd111e893b17e6ca2c9e9e682e8195", "structural_hash": "fef9754adfd33b9e279232cf4305b046bd51d308a7aa75e911128597596763c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00187.php", "upstream_id": "BenchmarkTest00187", "language": "php", "code": "payload;\n $encKey = getenv('DATA_ENC_KEY');\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', $encKey, 0, $iv, $tag);\n $encrypted = base64_encode($iv . $tag . $_ct);\n file_put_contents('/var/data/secrets.enc', $encrypted);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ec14fdf57c07a046718192eadfd0d9b9837a5d5fca576370d4df2ef99b90086", "structural_hash": "8dd96739d76071f2084b6648dcb16717331cabb0c30a79abdbf9419661144390", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02341.cpp", "upstream_id": "BenchmarkTest02341", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "327fd71967a5574bb0b02c3a4412f6aa4192d6b77e905342199f62f2cf302de9", "structural_hash": "cfa50d3ca164af6308ee4b5de8ffb197ba814afb9662da5e12034cbacf6dfe37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25282.sh", "upstream_id": "BenchmarkTest25282", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70ca837e4bb29c3f332b1083e890643746d97200b79fa9b969a3d9a802cfa474", "structural_hash": "e190798ade1ee2057d85abed78943ed72448b2af9eff11248549747279d1f3bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19515.go", "upstream_id": "BenchmarkTest19515", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata := strings.Join(strings.Fields(refererValue), \" \")\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 1, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07c7a2b6968e1b91c02fc2e33c67570dad114006747f8a23f413b659730022de", "structural_hash": "03a5e5fe2d9c8b04dd1053dbb0fbefea1f890dfb8c82b1970b68f66c6baa01aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00405.php", "upstream_id": "BenchmarkTest00405", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n if (in_array($data, ['https://app.shopcdn.io'], true)) {\n return response()->json(['ok' => 1])->header('Access-Control-Allow-Origin', (string)$data);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f339d163ff3a3b2bff9368cdc0c42513324936de249ea910ab8a79cb4af8ed5c", "structural_hash": "4ed8cc42bf5a161f92b294da2657aa306dfb9b6975e45e1447fff6fbc237260b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00271.rb", "upstream_id": "BenchmarkTest00271", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = format('%s', user_input)\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6668a61ac33cfdb5bad831bc8354bfe358d314fc389f6cdf9ad8f75bf6656e3", "structural_hash": "fbff8ed2970a4738b73f053857cbed69d26197bdad90dbe3146a8bc1d8cc4e4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04375.ts", "upstream_id": "BenchmarkTest04375", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n fs.writeFileSync(\"/var/app/active/pkg.bin\", _content);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8bf14a2040d90ea238fbcd07743f331f69687c1cb9fcbc6bbec6d8f9b38d4c43", "structural_hash": "0b81ecfe5c3965f4a7efadcd8c0ec0012b898722cb94d5f06f8935d2d439f5af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04071.java", "upstream_id": "BenchmarkTest04071", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @POST\n @Path(\"/benchmark_case/graphql\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(GraphQLRequest req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> graphqlVar)\n .thenApply(v -> v.replace(\"\\t\", \" \").strip())\n .join();\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n return Response.status(400).entity(\"forbidden\").build();\n }\n return Response.ok(data + \",data\\n\", \"text/csv\").build();\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "639bfefc5d6c0cf16b280f37ab84ce86c95115ee9de86ce527d75b7fb5ec0b9b", "structural_hash": "5e8fb826298180a549b50153409fcbab486b35767a7fd11c531a53ffe10f07a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20943.js", "upstream_id": "BenchmarkTest20943", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const data = userInput != null ? userInput : '';\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e4266eeb5e0a1b37b7972315a36637b4e18d0bdce6656446bb2168e92072db4", "structural_hash": "f3d9fc6cdb43bb75e9162b6526bbdc000d4d233583ffba2511b6534f4ad0a458", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02036.ts", "upstream_id": "BenchmarkTest02036", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n console.log(\"Action: \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "306d96798f62076e8cd053e6e53a418372e5b1d4b90d26e17da818ee3f210b65", "structural_hash": "d21000d790106671a68f318d1014450a73aed2f2997a513008285203c52344fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00084.cpp", "upstream_id": "BenchmarkTest00084", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"https://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b521386c7f40016c5b9e78c848a5e45a41a58a669388fcd11587ea9b440dc04d", "structural_hash": "4a765bd8f86b620198d7d4b51cf0b7e3ee5420bdb5c55d56872ecadf6044b723", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07506.go", "upstream_id": "BenchmarkTest07506", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata := BenchSvcPassthrough(fieldValue)\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\thttp.Error(w, \"invalid\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c240b5112d024a4b909fd5aa3dfbffb316e694d364ade088d06a4aabedf212fc", "structural_hash": "05e5f49a14a2148db1f1bb5d9e32061ce92b2b5221bf6cddbc716c6c0e0f3ea7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03628.rb", "upstream_id": "BenchmarkTest03628", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7d751a356c0b4befd5959407e0a9a1929210bf3177525b8029ec70c461c5835", "structural_hash": "95a8c758136e5cec9e0288f0b369770a4ef319698cc12cb695df29ebb896742a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01884.py", "upstream_id": "BenchmarkTest01884", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n data = str(auth_header).replace('\\x00', '')\n requests.get(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c0e2f81ba1d530b633ffff3fb22c56add09ad313e3329cff8db5602f80471a5", "structural_hash": "9bda55f1c1c9585c21b745dc9565b9d20022dd416246f243c804114d76fc8611", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15396.go", "upstream_id": "BenchmarkTest15396", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tvar data string\n\tfor _, token := range strings.Split(multipartValue, \",\") {\n\t\tdata = token\n\t}\n\tallowed := map[string]bool{\"https://app.gocdn.net\": true}\n\tif allowed[data] {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", data)\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-346"], "category": "originvalidation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20fe48b73b5fee14ab9a0fd5702efdb0a27e78d26fc9b29e33e7af4a37aa81a0", "structural_hash": "93e48d350b4646770d963de004a70364b2d8370333a21325594e23e172a32184", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01095.rb", "upstream_id": "BenchmarkTest01095", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"yaml\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = \"\" + user_input\n YAML.unsafe_load(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4448ba67c8063ac939d84da5f3cdb6b5b7704465b76f2a5922478b5120ae67e6", "structural_hash": "5c8eeb558a15623c6254839a439b7596ad66b8141d22ea36d95a067b024d8ff5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04175.rb", "upstream_id": "BenchmarkTest04175", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n processed = data.length > 64 ? data[0, 64] : data\n response.set_header(\"Access-Control-Allow-Origin\", processed)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd4646b2a274d1545611909904038ed29f563bd7ebff7a59b2fe8af665ab30d9", "structural_hash": "6b797a0974698ac38767f9d0016a5dfeedd212f9a687831b073e177e9c3db591", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00795.ts", "upstream_id": "BenchmarkTest00795", "language": "typescript", "code": "import { Controller, Header, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = String(userInput).slice(0, 200);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92116a4176e00140dbf5fe555a53b96864514690bb1f12e2d1341b28e4e55e7b", "structural_hash": "11ee2f12cc4128b39e47be54021032af851686daa25ce8a17091c4c5dedd8e1a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02686.php", "upstream_id": "BenchmarkTest02686", "language": "php", "code": "cookie('session_token', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return response()->json(['validated' => (string) $data], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2e70d2fa5e1c87b13946f43c761de45ce10dc4a777e91044517554c405b85fd", "structural_hash": "9f18e9cd5b4df9f74c7140ead28264a320ceeae09d659d12f5032c3680e8c9db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04465.php", "upstream_id": "BenchmarkTest04465", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7eb8140b0eea68211522436d39ec139d8a092911e8cd80d73e941a653af2818c", "structural_hash": "d84357464d442616146a416d5310aab2ef2aed5d13e6a0cb18b463579b00561a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03483.cpp", "upstream_id": "BenchmarkTest03483", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(user_input.c_str());\n std::cout << _buf[_i] << std::endl;\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "040978de61bf1f41307924bb5ddf1decaf3c93bbc90e5a311aeff28055eeff3c", "structural_hash": "76c2ce90ea9cfb195a4f5cb4f21b42163f4387b55accd0f647de637e1d66a029", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00820.rb", "upstream_id": "BenchmarkTest00820", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n data = !user_input.empty? ? user_input : ''\n Digest::MD5.hexdigest(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c15076fffc6d017bfac15df1ae4e7791d2d26aba99aa635689d61f8540179181", "structural_hash": "7fef283bc599065c4ba00f10283a25e70e709e0631e8d9878db72d6b4863d400", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02641.java", "upstream_id": "BenchmarkTest02641", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.function.Function preprocessor = s -> s.replaceAll(\"[ ]+\", \" \");\n java.util.function.Function fullPipeline = preprocessor.andThen(String::trim);\n String data = fullPipeline.apply(rawData);\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n javax.crypto.KeyGenerator keyGen = javax.crypto.KeyGenerator.getInstance(\"AES\");\n keyGen.init(256);\n javax.crypto.SecretKey key = keyGen.generateKey();\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "158036f8400b020da2bd3d3a3fc7fba0e95235eeb682f4557795aafc49b9700b", "structural_hash": "871fad695f8a5f48a6f2854e884cf9c32b40adc0f66eab28523c4325e631469b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13947.c", "upstream_id": "BenchmarkTest13947", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n long _n = strtol(data, NULL, 10);\n char *_p = malloc((size_t)_n);\n if (_p) free(_p);\n}", "label": 1, "cwe": ["CWE-789"], "category": "uncontrolled_alloc_size", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "deabb8c848c0b807396c6668c565b2ca1f6fb694a2651df1854da6466854060c", "structural_hash": "3690b2e5def2f46083858d50f11522f9052567bc54643b6068d1a302ede539b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05966.rb", "upstream_id": "BenchmarkTest05966", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = \"#{user_input}\"\n cred = data.to_s\n authenticated = !cred.empty?\n unless authenticated\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4006afa59b4ec77cb8f6672e0e91a7d354e6a99ae95f7a9f3ddeb0f70e28b3e8", "structural_hash": "fa6a9d84fca0de6454fbd46abd21a8686b6f6b1cfe83922679e8b879db4910d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32440.go", "upstream_id": "BenchmarkTest32440", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/s3\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata := fmt.Sprintf(\"%s\", fieldValue)\n\ts3Client.PutObject(context.Background(), &s3.PutObjectInput{\n\t\tBucket: aws.String(\"app-user-uploads\"),\n\t\tKey: aws.String(data),\n\t\tBody: strings.NewReader(\"data\"),\n\t})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b71c8ab583ea828ad027a6c4ce85413927de4f0dd2606fa28021478d87cbd63", "structural_hash": "914f0e120d79b0e8884abc55b9c9a7d56e09b6b89a28388cca1b09ba1e2820dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02112.cpp", "upstream_id": "BenchmarkTest02112", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"http://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16d4f384c2200f2580a5225e26e2bca64a93a6650f32b3d592abc1cc1ee10e89", "structural_hash": "05a0b0790b58b0db93ef72883b85296bde8a07cbe2986dd1c154962688a3ea37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01610.ts", "upstream_id": "BenchmarkTest01610", "language": "typescript", "code": "import { Controller, Post, Query } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9167e2a473b239ec6e21488cd31f30c1e7bf5b14213100aeb7182510228ecf9", "structural_hash": "fc40ff161cbc2a0b5f85a4b51d6b3dc728ed6a9d74f3ddbe600bbb82683cf86c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03530.rs", "upstream_id": "BenchmarkTest03530", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let queued = upload_name.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39139a73de55cff728403052b9364593e912b27405f439e92092f108cf9db75c", "structural_hash": "d2add68e0ad176be9df6a7b0728a8de536accb21082eb12257c8c0e8f2d0976a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00718.rb", "upstream_id": "BenchmarkTest00718", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n data = !user_input.empty? ? user_input : ''\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9276f3eec4552e53c61fc882a9c40d7dfdbaa704357b5c35eb93a1123385c52f", "structural_hash": "0713b0ab631ba137818285cfafa73688db1baf9edcc11450b2c8a66d78df7e21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04748.ts", "upstream_id": "BenchmarkTest04748", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57446d48237282f615b1174ee0062508cebe60d675598b1d1215e505fe60d4e2", "structural_hash": "02a8f52a5b30f6417ee6c85ba6f0d27c3db5e405b4cbd6771d19742707001ac4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05317.java", "upstream_id": "BenchmarkTest05317", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = normalize(multipartValue);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8632dbe359a65ae203981d7e0a5a591b4690d6ee327ee729b3a62050b7d6f76e", "structural_hash": "b6603c2c2ca2dd8cd05d603009a6960d7852b11befa7715e35b3f6e73e18244a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04421.rb", "upstream_id": "BenchmarkTest04421", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n requested = data.to_i\n allocated = requested + 1\n content_type :json\n JSON.generate({ allocated: allocated })\n end\nend", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79187596caaa2d778ff96461f0d5566310ba8586d669628b2f009644b4fa06c2", "structural_hash": "60a637014a9a7415f3db8e3eb8fbba206c2b627fd624d7df477c6649f8965953", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00407.cpp", "upstream_id": "BenchmarkTest00407", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string _fname = data;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b40eab60b1a40cee0516df9ff7811dbe93d18732d038fc5b90494733b3c10d3c", "structural_hash": "53996c34fcc1ddd2d851b8186f987f5b149f4c3c89d4cdf0aeeb24cac270d46d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03633.rs", "upstream_id": "BenchmarkTest03633", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let data = path_value.to_string();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")).finish()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b36c69a0b1bd4ac6eff4e7e894e39598ecda76c5711b9fb71e645af22f51d910", "structural_hash": "af55daf7b7c812be64dad8da5c2a8b8bd0516f14691f60c3aba2a06b7eb1a7ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15798.go", "upstream_id": "BenchmarkTest15798", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := fmt.Sprintf(\"%s\", graphqlVar)\n\tDB.Exec(\"UPDATE users SET role = ? WHERE name = ?\", \"admin\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-286"], "category": "incorrect_user_mgmt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e3391ffc994ea145d1e86f7ac990512454720a404cba8150e6425f59dbdd288", "structural_hash": "6c4553d40f5e1452f4faf014ad7068dbcc06674f6baeacf06cd6b4f7a7e8026b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03308.rs", "upstream_id": "BenchmarkTest03308", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let (payload, _origin) = (field_value.clone(), \"http\");\n let data = payload;\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e7518f6eed83e21f57723d1f09eeb2bb0adde47c2797ed909b5039072aaee41", "structural_hash": "bb8949382e29292b77da5507d92420b9167f34ff42756392db7f9ea191f950df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00574.rs", "upstream_id": "BenchmarkTest00574", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match auth_header.chars().next() { Some(_) => auth_header.clone(), None => \"default\".to_string() };\n axum::response::Redirect::to(data.as_str()).into_response()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a14a12863f8c9d83efe4f75a35f1e1408ff06e61b62b268a8e2c3c73cbc41b25", "structural_hash": "ba82df00add36dea05e9b8f0e4d0971a533bf1410a0a785d38cdbe50d253c179", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27211.go", "upstream_id": "BenchmarkTest27211", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := func(v string) string { return strings.TrimSpace(v) }(jsonValue)\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tvalues := strings.Split(processed, \",\")\n\tif len(values) > 0 {\n\t\tw.Header().Set(\"X-Param-First\", values[0])\n\t\tw.Header().Set(\"X-Param-Dropped\", strconv.Itoa(len(values)-1))\n\t}\n}", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22984e811871ddbc100fb0900b1512a9f851f7c8d809c98bc4c16144953616bd", "structural_hash": "8620aca8cd03760d152a8fb3c888b0a8d8acde3507ad5d0bcc5e884e22e7387c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01413.ts", "upstream_id": "BenchmarkTest01413", "language": "typescript", "code": "import { Controller, Param, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = pathId;\n const fields = [userInput, 'http'];\n const [data] = fields;\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e3d01e3fd10bcbb7c7f9dd5547e047a84c531b403ec0823225f1701a1f85883", "structural_hash": "c408c77062953a9ddff8ca53a7aa04c04c4645fbd345f22808998f05ec1bfa29", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30585.js", "upstream_id": "BenchmarkTest30585", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n fs.writeFileSync(\"/tmp/\" + data, \"content\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6296f8dee0073da88f9df476cb44c34c51b3e4d28fc2e3631b0b06a6bde66349", "structural_hash": "6632a50ffe457bf7a5387ee3e5945add3b8f30c3ee37bc380b20186fc2592d3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05457.py", "upstream_id": "BenchmarkTest05457", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nimport hashlib\nfrom app_runtime import db\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n data = str(multipart_value).replace('\\x00', '')\n _resp = requests.get(str(data))\n if hashlib.sha256(_resp.content).hexdigest() != _resp.headers.get('X-Content-SHA256'):\n return JsonResponse({'error': 'integrity check failed'}, status=502)\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "249f9768d48c4e6d7e99847b3b900765015693d818fcb61eece3bc7e7249183c", "structural_hash": "fe750853c2ed66062476b1179949027d41ed06d4a5a03415d56a5ea75dac036e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24457.sh", "upstream_id": "BenchmarkTest24457", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=$(printf \"%s\" \"$user_input\")\n echo \"uploaded\" > \"/var/uploads/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce3bde32a86bd45ca17aaf76708ec3a0dd6b9dd4c514743a4d7e03834364712e", "structural_hash": "31e8086db99c009b26b72b05e0832bf4a8cc9c3d9eaf4ad469fbbc34da843479", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_30576.js", "upstream_id": "BenchmarkTest30576", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const allowedFiles = new Set([\"config.json\", \"index.html\", \"readme.md\"]);\n if (!allowedFiles.has(data)) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = \"/var/app/data/\" + data;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab34e08186a8443eda18858b1f1375dbfdc1361bed82bfa0c7c770f43ab05294", "structural_hash": "29d40ec33b7babfd6ed1e991eb5e89312634461febc37077aa6e25f6b094638d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04215.ts", "upstream_id": "BenchmarkTest04215", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { res.status(400).json({ error: \"out of range\" }); return; }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9981c3ee07e4e40efc9eb3e77b05216fbf272c17a515305e03ec18140e438863", "structural_hash": "146fbe25b565b86c39596a59aa6aaf29548957dfd716abd210d909c39df129ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04462.go", "upstream_id": "BenchmarkTest04462", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tlastRequestValue.Store(userID)\n\tdata, _ := lastRequestValue.Load().(string)\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\tc.String(http.StatusBadRequest, \"invalid option\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Set(\"data\", processed)\n}", "label": 0, "cwe": ["CWE-501"], "category": "trustbound", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "146f04f638552d1bce0b2de02a15bc219b9ba4f010004c80c9f10cfa7681d94c", "structural_hash": "9e8b2975772c23861a90c6a53f90c72db79c5c5edcc10635b8cada5cefa33e9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04169.ts", "upstream_id": "BenchmarkTest04169", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const processed = Boolean(data) ? data : \"\";\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(processed));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9dadd099f57d68cac73715ff07c8692ac6c6898248d06ee0ecda6f7453d8225", "structural_hash": "aa933dfc6955632a557a1708898a780434a3788b0d1bc6729ab9b38636c3b97b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27005.sh", "upstream_id": "BenchmarkTest27005", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n mysql -e \"SELECT * FROM users ORDER BY $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60377aeb0c9ba8bba66d10e5ad4f10ee7edbcf07f540dc8f55723637947bec34", "structural_hash": "b2969dbb3636bf005bc20abe3c28f6bb8f821fa4957a337ed56ec313dbfc234a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18801.go", "upstream_id": "BenchmarkTest18801", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tvar data string\n\tfor _, token := range strings.Split(forwardedIP, \",\") {\n\t\tdata = token\n\t}\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"sh\", \"-c\", processed)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 0, "cwe": ["CWE-506"], "category": "embedded_malicious_code", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:embedded_malicious_code", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7de87ac06b1fb11a7fd74e37fc63b0a683df995b3f24d5e72fac1a2741ec6d2", "structural_hash": "5d557a433dc7d85b3b10ebff8ff42538e432323c998d9eeaf1b4732ed1122e16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08368.c", "upstream_id": "BenchmarkTest08368", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b8bfdd6e777817f37ed5e0e51805276733e74cd8d3dc9aa463ebb078526fd90", "structural_hash": "acde84e352ad3627cf5498624fe236d1169ab1327fd3b1bcb138ce336bba9bf2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03648.cpp", "upstream_id": "BenchmarkTest03648", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2a72366983eb6c071fc0bffa4cd1662fa645bbf88b36afe39356fca0d1a43cd", "structural_hash": "0139849f0ce37a6e9790eea5e5df3ca49c315c28534ab799102f2f7e2e71fab1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02739.rs", "upstream_id": "BenchmarkTest02739", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(json_value.clone());\n let processed = [\"true\", \"false\", \"1\", \"0\"].contains(&data.to_lowercase().as_str()).to_string();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&processed) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1169f2a32f26cdc6ca7bb1d9c87b2754bd0da734871613a7bd3e82e28acd76f2", "structural_hash": "88e1569478029045176c11f83a3ff0a379a3b7457e82f9634f06508e1abe1a00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03490.cpp", "upstream_id": "BenchmarkTest03490", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n for (std::string::size_type _i = 0; _i < user_input.size(); ++_i) {\n if (user_input[_i] == '%' && _i + 2 < user_input.size()) {\n data.push_back((char)std::strtol(user_input.substr(_i + 1, 2).c_str(), nullptr, 16));\n _i += 2;\n } else { data.push_back(user_input[_i]); }\n }\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f93077331fe046d916efbac9ab372fa7f36278b3042c83ebbf751357f3fd2f5", "structural_hash": "a981d352a57feb9dda958f3801059449e7bfad45b5eb1c4c79087b3c57cb170f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03459.cpp", "upstream_id": "BenchmarkTest03459", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n res.set_header(\"X-Trace-Id\", safe);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c132d13e698fda3370adfa8786d453027a27cb3804e343996115ba069b45e04f", "structural_hash": "d32be40708c018247930e67e6f5406782f8450617a7df946a88dfe10f638b0b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13937.c", "upstream_id": "BenchmarkTest13937", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n if (_off >= 0 && _off < (int)sizeof(_dst)) _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e887236543353da93de98ac79db59d636256b39cae3e83f1c3dd55590525b51d", "structural_hash": "ea1a6ab8fffa51f7ae7cd25539fa556359de61871788afb70148c8a8b61224b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03186.rb", "upstream_id": "BenchmarkTest03186", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = !user_input.empty? ? user_input : ''\n content_type :html\n \"
    \" + data + \"
    \"\n end\nend", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7410c2c4ac9072377c86320078afe0b43edeb31ff661359ec3bb11769a7d5b01", "structural_hash": "27ad03e58f6c3b04c45ba4475df35b1b175187d501c418528b9c441a88f95cf3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01363.ts", "upstream_id": "BenchmarkTest01363", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n res.cookie(\"session\", userInput, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5779cc0ee1b9115ed8dbbe69c71bbe9edcfe0e8309fadff2308907fd274ff961", "structural_hash": "0c029e428d7480b76216fc3571d8fb050eec008ad8da016977d79c5efeff060d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23638.sh", "upstream_id": "BenchmarkTest23638", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n _fname=$(basename -- \"$data\")\n case \"$_fname\" in *.jpg|*.png|*.gif|*.pdf) entry_file=\"$_fname\";; *) echo \"invalid file type\"; exit 1;; esac\n echo \"uploaded\" > \"/var/uploads/$entry_file\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e11faa4aee131451be697755562ee01deed28ef0da39795d9a09bf2d45fb209", "structural_hash": "e47b9ce8e8aee3337cd12e9aa7c140f5065a82c6529d78a4b28111a9e49e8738", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02979.ts", "upstream_id": "BenchmarkTest02979", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n db.collection(\"users\").findOne({ name: { $regex: data } });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7850f662fec53a986ca69af96431f25a029e1902ffca0335aa20ca8f3c7ec71c", "structural_hash": "99428c3b9e68bc3241448f606041e522a1c11afb5b89585e66d2b7f578451b4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04050.php", "upstream_id": "BenchmarkTest04050", "language": "php", "code": "getContent();\n $role = (string) $userInput;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff7d0c66ccfce6092a9297364c7be66e280458eb3e5c3d2da1b2c8d77f0b395a", "structural_hash": "80c8887aa92f03a417947a57c32d5e85baf8e432493868899d2a734944a1f278", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02328.rb", "upstream_id": "BenchmarkTest02328", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n File.write(\"/var/uploads/\" + File.basename(user_input.to_s), \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b7a0a11e20e0d3b21109a7954dd7d0306307f5dadbf8b9980c98fb242f3cfe9", "structural_hash": "f50203e71ce635f82a05bde757756d302e4b937692e594c01f3ed55670019284", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02221.cpp", "upstream_id": "BenchmarkTest02221", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_HOST\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n std::string _truncated = data.substr(0, 64);\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", _truncated.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fae9fa87f60d146f51179afe078de8bc88fc80943c212eba97bcb58f6b684d9", "structural_hash": "6883a1cadabfb799714cb87c50e0a9708775c74d3baf4089611ed9cf9d6a1fc3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00104.rs", "upstream_id": "BenchmarkTest00104", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data = String::from_utf8_lossy(xml_value.as_bytes()).to_string();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b748bb795673964b3af885a12de048cccbad545626f557d3e11fbc35db9c892", "structural_hash": "3adf2591f0e91acf6fe5fdbccdd5b80233fe8954946b82938b193b3069b19899", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05475.c", "upstream_id": "BenchmarkTest05475", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"uploads/%s\", user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdb9c8128bf34ffd14d88432f96100aa17cdc937921dfa6211d4b73fdd790d27", "structural_hash": "6dfed59e6c69c1f77e0edfdf34b1de41d6bd932471e99d4bed815b8283fcbeb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16893.js", "upstream_id": "BenchmarkTest16893", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n function normalize(value) { return value; }\n const data = normalize(userInput);\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21074e5005b97ba6f082f3109356ad27e1b13747bf96f4eb1b6c6c7349475fd3", "structural_hash": "e6318c3153a0b415f9e3dbd4eeb79419f49be7ffa34b3372072bd8700bcd7da6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01147.rb", "upstream_id": "BenchmarkTest01147", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = format('%s', user_input)\n content_type :html\n \"
    \" + data + \"
    \"\n end\nend", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d86f5c17b99cb19bf9afc3c695fd254cf9294198fc7bbf643a1f8efe99a481c", "structural_hash": "28ef598b4b5ad8d03a1f30214ff5f3787728afa51e752c1119e137e23725d619", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01683.java", "upstream_id": "BenchmarkTest01683", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(originValue);\n String data = normalizer.apply(originValue);\n String processed = data.length() > 64 ? data.substring(0, 64) : data;\n String socketRaw = String.valueOf(processed);\n String socketHost = socketRaw.contains(\"://\") ? java.net.URI.create(socketRaw).getHost() : socketRaw;\n new Socket(socketHost, 80).close();\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f590b1d133b54a02d741671b675b347d243da5f1df5c71c777bfe7976dc334bd", "structural_hash": "4acb62291309f6ab1b9d2eb165a7800a12cac93085def7bc0f63a2d543a7c237", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11769.c", "upstream_id": "BenchmarkTest11769", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53005076892b7781deed6c957a69ba3ce0a896256717851f08521b6dc6fc0de2", "structural_hash": "54549abd5d64ceb1388a1a2b7ef3e35834f63c02d8c2d9d32438427fdc19d6bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01381.c", "upstream_id": "BenchmarkTest01381", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", data); fclose(_log); }\n}", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6912789de0708fd7b08cfcf8e808974195b700af863c5dae4e8b8076f74e8b3e", "structural_hash": "7225c75a8140a4337cb1894f9f34bd628a737eb55f9ffa4878f7cec346a9053c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01101.ts", "upstream_id": "BenchmarkTest01101", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n fs.unlinkSync(\"/var/app/data/\" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c0068e4617c046b3db8ec0fd1ad448c6bbddd867b1f40b74e04fd06be10eb57", "structural_hash": "5f00ec042c36f91ac3ba18d22ff7b712415a6bf095feaf9fbb48cdd2c0d212f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02691.rb", "upstream_id": "BenchmarkTest02691", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n payload, _origin = user_input, 'http'\n data = payload\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "512d929659b41cf8fd7cf839e10f79bd513b92616f7f5d097887421aa738c296", "structural_hash": "9c9dd3e77e6bd6990e0799d64cbe6a115c92a7924217ea8f8be82e46b5c30646", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00991.py", "upstream_id": "BenchmarkTest00991", "language": "python", "code": "import re\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = '%s' % (db_value,)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n db.execute('SELECT * FROM users WHERE id = ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "172f139e50ca22c3cc5dba3056de7e28846958b2757cef2969c8c89be3c39ee4", "structural_hash": "df4c874878c1c601bb9571f03674ef4c299cfd986044dca0f7095699cc2a8599", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04090.rs", "upstream_id": "BenchmarkTest04090", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(env_value.clone(), |s| s.trim().to_string());\n crate::shared::db_query(&format!(\"SELECT * FROM `{}`\", data.replace('`', \"\")));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6458995e4660c74e423e9aa514b04497d916a1b8a8e72882cd98732bb199d3f6", "structural_hash": "d54f19e024528a9aa60be1abbd1187cd4f5f41df7ca1d1bbccf2d2c04ce411a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01853.rb", "upstream_id": "BenchmarkTest01853", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"yaml\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n @user_input = user_input\n data = @user_input\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n YAML.unsafe_load(processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "281b3a6f6a5d7cbe7ef3107ed3a75e10ed55f56d4c7b22219e345ab9eebfc119", "structural_hash": "30bff6da31c1091f2af37c878b3a6fb9be18940fd01dbef6b7fdb92c11bc42a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01724.rb", "upstream_id": "BenchmarkTest01724", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n trusted_claim = processed.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a09fd20c119dafad5a999fcaab9dfacd33d95fde7d1673f3f3baa97c29d039a4", "structural_hash": "7e1519f228260c9b04c582bbc9b92776f77ac4572317b97dff4bfd97a4964338", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05730.py", "upstream_id": "BenchmarkTest05730", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n if header_value:\n data = header_value\n else:\n data = ''\n if str(data) == 'S3cr3tToken':\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "015ba4396e11dd27b352d6c2df20a139663ded72701fb8968a4dd67f68645024", "structural_hash": "c818c5f7f7d65350dd3530b4f2290c25726c012f4380f60540ca52be8357841d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12471.js", "upstream_id": "BenchmarkTest12471", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const data = decodeURIComponent(userInput);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "881cbde9fe3e35896314ca7139bfd41372c5ffefb4c46a940bdbce848f3a325a", "structural_hash": "6833f8d4759e4370ee29165a5fcc7f403bf12936e3503724d6a2b0e11636f769", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02594.rb", "upstream_id": "BenchmarkTest02594", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = user_input.split.join(\" \")\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n headers[\"X-Custom\"] = parsed_bool\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f0833e8895e91fa1fcd55e46e083f092a737edb5dfcc5d27dd89f035afca652", "structural_hash": "bac87cb029fee475c7358e28510797ed1aed8de9a43c993c34b1325eb31b810c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04882.php", "upstream_id": "BenchmarkTest04882", "language": "php", "code": "getContent();\n $data = (!empty($userInput)) ? $userInput : '';\n session()->regenerate();\n session(['data' => (string) $data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9c2c3a41a2d4f4933c8587d82e1a650f2db9bc610f9219f506ef31042d5d25f", "structural_hash": "dcd6dfb259fc2a9a83c924cc9132cfa72d83d9187668a67f74d92abd4e1b6c49", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03145.go", "upstream_id": "BenchmarkTest03145", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tdata := commentText\n\tif _, after, ok := strings.Cut(commentText, \",\"); ok {\n\t\tdata = after\n\t}\n\tparts := strings.SplitN(data, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 1, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8123eff114805f82bc4c2d2401b5b1f9411f9fb47eed4647661c2059015317c", "structural_hash": "c804e05409efd20cebce5cabcccc207a8b74949241c704a7c28f4421eb83208c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04452.php", "upstream_id": "BenchmarkTest04452", "language": "php", "code": "input('multipart_field', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $trusted = (string) $data;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2df523b11ec9770ce73f990e915d6c023522e5388bf62aecd926445a339ce51", "structural_hash": "505864e6b97777b74092e4376cd540e023f7e476895afadfa544626a94855e2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02726.php", "upstream_id": "BenchmarkTest02726", "language": "php", "code": "name;\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n file_put_contents('/var/data/output', (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51b3815b2460a38215f0c600512432e8af6da9a45a6b4ccd3091d2807d9bc935", "structural_hash": "61b418ca97bea2aed8167a224d78d8fa19b54515245ea55af94c9574a6c609dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00880.php", "upstream_id": "BenchmarkTest00880", "language": "php", "code": "getContent();\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n file_put_contents('/var/data/output', (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7db82e768231d83417fa5cf37c2b370be168098def0487f4a7563c44436acae8", "structural_hash": "3fb6d6cea6df6f83a2d85df071928b57d3b00d8d03834ae1c3fa91d1029d9de9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06941.go", "upstream_id": "BenchmarkTest06941", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, originValue))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := resolvedPath\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd0d2ecb2eb90557472b633d93086b382804ae206c754aaca25e6c2a118b7f77", "structural_hash": "f75de0049ba0b9b09f22934a19eda05129030337cbc23fd9ff3c03114a52cf43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02130.py", "upstream_id": "BenchmarkTest02130", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = f'{raw_body!s}'\n _resp = requests.get(str(data))\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e85547d579b99e13b1e443bac73733c48b33f0fbc0a02f530e605cbc7fa0fb95", "structural_hash": "6daef0552f730a4b707c88cb74389ec090a5bff499c1c5b62095694d58017119", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02911.rs", "upstream_id": "BenchmarkTest02911", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = \"config_secret_test_abc123\".to_string();\n let mut data = String::new();\n for token in secret_value.split(',') { data = token.to_string(); }\n let _token = crate::shared::jwt_sign(&data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e5f146fa2b80e7204384e5802ad8f5c2ce74f10c9caec3a3df7cbbb2c8b1e09", "structural_hash": "b03d2b320194ed87ddd18af79a5a282abbb97260ca7acf344561df368bf4a4e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01365.sh", "upstream_id": "BenchmarkTest01365", "language": "bash", "code": "benchmark_case() {\n user_input=\"q9Cb4Ad2Fg8Ht3Vk6Mp\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "275b9ff5e9ff6e4b4ccd03e8ef5abe3d2927b4d191049a8ba7f404c97d3e83e7", "structural_hash": "f4a6e34d85c933c8e13442cce52e29e3ebd0df5b36247b0ebea2f825ed93a217", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00526.rs", "upstream_id": "BenchmarkTest00526", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match header_value.chars().next() { Some(_) => header_value.clone(), None => \"default\".to_string() };\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ecf9714662fff1fea084baad114b0dd0bf8e8fa8262552457f2656a3b51c4e4", "structural_hash": "40f1e5a49bf594736c4f35807b5efda2274eec254e7366edb9e5dae1d52e256b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04590.rs", "upstream_id": "BenchmarkTest04590", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: forwarded_ip.clone() };\n let data = payload.value().to_string();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fec2b0cd387fccba4e10b97b71b4a558f1dcfc5db15584960bb9a74d37f1fa2", "structural_hash": "c555612506b644798957023523da1af2f8990070fe78a183d0c3cb5454695090", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02677.go", "upstream_id": "BenchmarkTest02677", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"golang.org/x/crypto/bcrypt\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", fieldValue)\n\tdata := _sb.String()\n\thashedPw, _ := bcrypt.GenerateFromPassword([]byte(data), bcrypt.DefaultCost)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": string(hashedPw)})\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34b5a6ed776436b19c523d352026327b0636d7597ff67580268e53627fb0056d", "structural_hash": "f88e4dce1f9fbab9833cddb15c21ba08423f179877a162272a36e7b49ed6cd83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00712.php", "upstream_id": "BenchmarkTest00712", "language": "php", "code": "json('payload', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n file_put_contents('/var/data/output', (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac411ef3c13822d1685251476eca9afe9e074cfc0b696e42c99cdad2d076ec8b", "structural_hash": "4d01f9387a37bb0cc7d344064c69191774bf4aaef6920673efc5db87b0d44705", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03358.rb", "upstream_id": "BenchmarkTest03358", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = Thread.new { user_input.to_s.strip }.value\n unless session[:user_id]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee6e0702c5a504658b2213a46bca08ad837724edd03a1fd080d169d9a36267e8", "structural_hash": "df34328607da96a7a0d8d7527ae3d0cd1a6b72ee1b29819598ca254c355f7047", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32171.sh", "upstream_id": "BenchmarkTest32171", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=\"${user_input:-default}\"\n echo \"$data\" | tr 'A-Za-z' 'N-ZA-Mn-za-m'\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02fae61c574fc4db59d67fa7b18ff7ff1ce35ae71874e8a528208b38457313e1", "structural_hash": "8580c20d6380722aaa5707b555a893bbc4fdd7133782013735bb98c802133888", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25357.sh", "upstream_id": "BenchmarkTest25357", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1b0f710af037db802cfacc39864eea98a55b070b448198137d27f5f09db1349", "structural_hash": "4b605e7f31347969bff512448419f512f730823b5b93e9242b46021c6611d0e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01046.ts", "upstream_id": "BenchmarkTest01046", "language": "typescript", "code": "import { Controller, Headers, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string, @Req() req: Request): Promise {\n const userInput = hdr || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n if (!shared.authCheck(data, req.session.token)) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dd4d062272360844db4c1b789b342d65c8bdacbf87787df6e5c09b26dc0d484", "structural_hash": "5a21a58e6e180c3152bea42e631252ace4121b8c4955462c3f4f01fb4ee9a6e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_42219.js", "upstream_id": "BenchmarkTest42219", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = `${userInput}`;\n ctx.body = '';\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cbb2f4666a2e5b4952fa432c61fcae5633af3542c47aaa843074ca9b9db43f4", "structural_hash": "16900a80f0bf86a3200ca8a5d94cb7340c64a3992014e8fc72d641d36f280211", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02761.php", "upstream_id": "BenchmarkTest02761", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $valid = is_string($data) && strlen((string)$data) < 4096;\n if (!$valid) { error_log('schema validation failed'); }\n $processed = $data;\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$processed, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc0e2c3b40621e55ce9ea2c8ff0cba4eb9dfa3116d38acb498c581ec8b26e205", "structural_hash": "894fa71fec7e272d85394f5643c9cdca8ed902c089488ed49efa8dcbc31fc983", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02626.rs", "upstream_id": "BenchmarkTest02626", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n struct FormData { payload: String }\n let data = FormData { payload: comment_value.clone() }.payload;\n log::info!(\"User action: {}\", data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3e9d9b9950c2c7cf0f110ebf19d47a03847b566c8e5a49d076506b529908318", "structural_hash": "10e2bfe28b9dea41f0b39aeb89d032c88256022c2464c11219fe678942146762", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06708.c", "upstream_id": "BenchmarkTest06708", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"cfg/%s\", user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f206581f6adfe800991d4ea464688b59d91406bc5c06430c78d2ef6a102c9c25", "structural_hash": "9a922454b643bbc2bbd2114b32982229f3726b8e659cafa334707dc81514c03e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05478.c", "upstream_id": "BenchmarkTest05478", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char _bn_copy[512];\n snprintf(_bn_copy, sizeof(_bn_copy), \"%s\", data);\n (void)basename(_bn_copy);\n const char *safe = data;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", safe);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a313bfed0aa853b376f00dc26786cc5a78490922fb3b1bcd65b19d90492b0bd4", "structural_hash": "b7af1654aae21616e10b5f7ed666ad060353cbdaeff15020de38db8f01ebea35", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05241.rs", "upstream_id": "BenchmarkTest05241", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = graphql_var.replace(\"\\t\", \" \");\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6d86ac04157096c91ac0702fa7bddd010379bc9a36800247f6b0b172796a367", "structural_hash": "909fd0be7fad63822e520bf1f6d108600a3f136f17ed274d20aab93907b81bdd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00854.cpp", "upstream_id": "BenchmarkTest00854", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n for (std::string::size_type _i = 0; _i < user_input.size(); ++_i) {\n if (user_input[_i] == '%' && _i + 2 < user_input.size()) {\n data.push_back((char)std::strtol(user_input.substr(_i + 1, 2).c_str(), nullptr, 16));\n _i += 2;\n } else { data.push_back(user_input[_i]); }\n }\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79d2564d37da13bad8cd5d36c6e7226bf49b273c3b4bed4a9e5bd78b8bfb7460", "structural_hash": "accf6a2f4091deb09f7de922818d18d6cfe2cdafc54d7697c324268b8b038d03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04460.ts", "upstream_id": "BenchmarkTest04460", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = `${userInput}`;\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56ead4a4c68567468873bb87de0bcb9b60449f7824b8fdc30a7f346506325bd4", "structural_hash": "87d30b7d77d64df30d50f91918818ffa6fd8c235710eabca0c0385a268c42c0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_21263.go", "upstream_id": "BenchmarkTest21263", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", uploadName)\n\tdata := _sb.String()\n\tf, _ := os.CreateTemp(\"\", \"app-\")\n\tif f != nil {\n\t\tdefer os.Remove(f.Name())\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89b7960ad91c013948b481cfa94cbdc80a2f17821d23deeb896f76a7c396211b", "structural_hash": "e195503978390535760e65ad22597d53507faee990ee2bd947f1f98713fe69da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04455.ts", "upstream_id": "BenchmarkTest04455", "language": "typescript", "code": "import { Controller, Post, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File): Promise {\n const userInput = file?.originalname || \"\";\n const data = String(userInput).slice(0, 200);\n Buffer.alloc(parseInt(data, 10) || 0);\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d81ba7f0fd45f96feb782fab0b6a07a63b6c68d2567c68a423d172f5323fbba1", "structural_hash": "aa7e6559b2834716d542c7fdc6644d477d3f14d5a8a080856c3c6c0246ea277a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25100.js", "upstream_id": "BenchmarkTest25100", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) {}\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10d179c006d32a83c0b769c30e0e5bf5d138764d8c9daab918722a2ccd486ed8", "structural_hash": "d54d2d587f79a9ee903c39f9471b12b0d099b59993e594ac54a127f6252a2bd4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00009.java", "upstream_id": "BenchmarkTest00009", "language": "java", "code": "import io.jsonwebtoken.Jwts;\nimport io.jsonwebtoken.SignatureAlgorithm;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String secretValue = \"config_secret_test_abc123\";\n String prefix = secretValue.length() > 0 ? secretValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = secretValue.toLowerCase(); break;\n case \"f\": data = secretValue.toUpperCase(); break;\n default: data = secretValue.strip(); break;\n }\n Jwts.builder().setSubject(\"user\").signWith(SignatureAlgorithm.HS256, data).compact();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cd4588ec88b87642df4bfd4ca1b649a073330d49344c6fd069e89c4c14272a9", "structural_hash": "3d98a99208d2f3ebfc7742c793cc0dc24c5dfe1551cfa993449eeab6aad98a04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05083.java", "upstream_id": "BenchmarkTest05083", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n private enum AllowedValue { PUBLIC, INTERNAL, CONFIDENTIAL, RESTRICTED }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n request.setAttribute(\"envelope\", authHeader);\n String data = String.valueOf(request.getAttribute(\"envelope\"));\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n return Response.ok(data + \",data\\n\", \"text/csv\").build();\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bba45a92e5ce7a3d95316109e8264be11f5d0e2533748cb802b23fee88d6f6af", "structural_hash": "005b206d0e76d9c09e9b62f089a27c82691d145b1f35c4d958183f9d94866f9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00003.ts", "upstream_id": "BenchmarkTest00003", "language": "typescript", "code": "import { Body, Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = (vars?.input as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n res.set(\"X-Custom\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a0a24a97e09838cfd1aab74bb162b0ffc530e604bd3b8fd1fa22b385ffec8ec", "structural_hash": "d7fdb8d1ec62bd77363d43bb5310ede5940e534174b965fd933b797931776e59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02840.php", "upstream_id": "BenchmarkTest02840", "language": "php", "code": "json('payload', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n return redirect($data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdd3796438138b852f10c824b10fa14d43647dc74fbac7af25434571e9168a5f", "structural_hash": "43ddb2d7376de15bc40288db5e1bb77ee1c313bfe2c487764e70cb4d2afafed8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06826.sh", "upstream_id": "BenchmarkTest06826", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n _len_guard() { [ \"${\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d08e6746d3ec6715f82bdc0d8c7b469c383ff1eb3d1055db0b9e5304f791c553", "structural_hash": "ce7ae4466bd0b4ada5ba05ef72c710002eb5cf10a0e0b1a979f6c2d906fecd08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02942.php", "upstream_id": "BenchmarkTest02942", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d139c726c418915e89f7b9be02bbf743d73556521abeaceb870cc722fe0df05e", "structural_hash": "ff05bb57f9d3516ad374ce87104aea78337c3719e2b6ca0b7a0fb403cf2d51d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00922.rs", "upstream_id": "BenchmarkTest00922", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse url::Url;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let _prefix: String = cookie_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => cookie_value.to_lowercase(),\n \"f\" => cookie_value.to_uppercase(),\n _ => cookie_value.trim().to_string(),\n };\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n let target_url = data.clone();\n axum::response::Redirect::to(target_url.as_str()).into_response()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "971b1f64abefc4196ebf973902e17216055343790eef3f19b1cdff94b912d111", "structural_hash": "574ef30b6100ace54c0c9a217d1004d8ceed77a9e49a64f624c919d929409fd6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00323.php", "upstream_id": "BenchmarkTest00323", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82ff3702707a3ab561f3378cf708909f6ba35e1cecce049223aba116fd3092b9", "structural_hash": "e689c28c5a5c0d5d03764689a64934b1ecde594fd40881fd3e12577ef3cb9f96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37219.js", "upstream_id": "BenchmarkTest37219", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24b010915c16205bebe9d891b14b46f9ccf86a62072a14f66cf5847ab12fcc7b", "structural_hash": "371dc600031dd0f841432cdc61e8f16c9aa8ce02342a32e2ba0365ee4014bf8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01001.php", "upstream_id": "BenchmarkTest01001", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = sprintf('%s', $userInput);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "489acd895c3e21c460dbb0f725ef1987077c8364a3c1804c5dccbb7332b284b4", "structural_hash": "75971159f52a5cbc10def5a1c28450c6eaaba25d8cb71b550709faa373662f2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01546.rb", "upstream_id": "BenchmarkTest01546", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n data = user_input ? user_input : ''\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b677d5f5563d7144b79fe3694d40051e82a074ac95b0bdd88f437cd6646f5eb", "structural_hash": "b394398712fe7a3c1dca61078da38bc05bc45a7aaaadd2e103f4f863ee4ca40c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11409.c", "upstream_id": "BenchmarkTest11409", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n if (_idx >= 0 && _idx < 5) printf(\"%d\\n\", _arr[_idx]);\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e9c63b32f16fd1115f9a7fba925d30019018c1179896ab9cdb00cc70d406596", "structural_hash": "a9ad119a554de61baafe3419ab4533e201ea3290a5b864102ab9f212b6bffd13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24749.sh", "upstream_id": "BenchmarkTest24749", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _tmp=$(mktemp /tmp/app.XXXXXX)\n chmod 777 \"$_tmp\"\n echo \"$data\" > \"$_tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1c4dca47bb1eb7071aa8773fdf01a5497de96efb9d558efef49a69b74f8c9ec", "structural_hash": "645407ccfcbddb2edb1b312af66077a185495b0a70e2359941b61d68d98505a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01934.rb", "upstream_id": "BenchmarkTest01934", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n data = !user_input.empty? ? user_input : ''\n redirect_to data\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90615e0221766ef04087f15dd13670c0570758344f7853a074e2563edca87801", "structural_hash": "7026c1125d6f7e8db0abc89d4faa327fcd15123d3385fbb21c82abe0989fc650", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39844.go", "upstream_id": "BenchmarkTest39844", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/iam\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tdata := strings.ReplaceAll(xmlBody, \"\\x00\", \"\")\n\tiamClient.PutRolePolicy(context.Background(), &iam.PutRolePolicyInput{\n\t\tRoleName: aws.String(\"app-service-role\"),\n\t\tPolicyName: aws.String(\"inline\"),\n\t\tPolicyDocument: aws.String(data),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25c5a064b815e45237cadfabb2f31f3b52f393000c19c43975196c6d22aa758f", "structural_hash": "b5ab1d669a046c1b4b0916769fbbd98bb7de3d4d6c74e10a86e467696f423101", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01106.rb", "upstream_id": "BenchmarkTest01106", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = [\"s3cr3t_key_test_xyz\"][0]\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c6f5cc43e69b8ed3aee8f849dcbe90861f3f7f287c6854a3c0f50843e8f552e", "structural_hash": "a4140b89d1193f3447c7599f75ba0e21e21f9fcf146a6c3b9e3891dc3db4ba17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01182.py", "upstream_id": "BenchmarkTest01182", "language": "python", "code": "from flask import Flask, request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = '%s' % (raw_body,)\n return '
    ' + str(data) + '
    '", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b17f90debba4b6059f670981f01ae11e2e7724ebe18cc38acf66990099372cdb", "structural_hash": "eac6dec591ae6d3959bdea5d24f7aa398a1bcb1879143d7e7b9cd2825ae055e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15508.c", "upstream_id": "BenchmarkTest15508", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, 0);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb5f39dc001557c467365dbb543f90c2e89c93d8a485042f9aeeee451385c3d8", "structural_hash": "34b47c878a7feb57a380577a283215827db721ffe7f11fe9b8b1338d2a30d9b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16370.sh", "upstream_id": "BenchmarkTest16370", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "393159d8e9fa98e5dd00a07f93d3dc9ac15f55ce78fd2b5d705cfd29b8fead22", "structural_hash": "5749e56d5ea94280efca0dbc30273b1ece20e88dad72a8815e995a343ca46df0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15126.sh", "upstream_id": "BenchmarkTest15126", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n mysql -e \"SELECT * FROM users ORDER BY $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26a3264670d4ed65233a8ca261a4fd4ee3f28567e4e4bb2f3865733aa1d90348", "structural_hash": "d2178ab81737d17171734e4ba9a0e69904832375c57e7ab96c9ed1389546f8c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_42662.js", "upstream_id": "BenchmarkTest42662", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = await Promise.resolve(userInput).then(String);\n fs.chmodSync(\"/var/app/data/resource.txt\", 0o600);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df464dc7f7d324f883010bc3984f49d8d8ec34c75613c34dfaf19a8eb96ff145", "structural_hash": "3d30a25ce4fd91ea55ede3c0025f8847aa82883b66b96750b051a06f7781e82a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02879.rb", "upstream_id": "BenchmarkTest02879", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + parsed_bool + \"']\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "591468cb3aed15e0135a599eaaaa79d5b08be799b2005e16689d14d15a9002a3", "structural_hash": "7bc423f677c134ca5b1c1c1c0079ab66ceba2a3fe0011f488ce7215403f175c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15229.go", "upstream_id": "BenchmarkTest15229", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(fieldValue)\n\tpassword := data\n\tif authVerify(\"user\", password) {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-309"], "category": "password_only_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c144e1c53c6eb2c7b85e6a1a117160ab2a20b42493738155cd34fa778aef438", "structural_hash": "9ab8b3dc21eba61804160d0456f7956cab7d170d1af8bbe8a0e2367b918c7daa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08185.c", "upstream_id": "BenchmarkTest08185", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"w\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d2847b2340a1398db32d8b75e97614c60dcc1b4ccef21af5577b581ff8f3385", "structural_hash": "21eacfd8121563ffc3f08c3561b91d95c99cce54689dff86c54e268f862fceef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00462.cpp", "upstream_id": "BenchmarkTest00462", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87679386b3fde0a731bdd8bc2386dd1623d009a6ca26fe42fff86f09a76b4085", "structural_hash": "63b780d5e23b5bd29818d8f813c46fcd6c85903e323ac9d188f9dbe976fd5aad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01700.java", "upstream_id": "BenchmarkTest01700", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.util.Properties holder = new java.util.Properties();\n holder.load(new java.io.StringReader(\"rawValue=\" + forwardedIp.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", holder.getProperty(\"format\", \"plain\"));\n String data = holder.getProperty(\"rawValue\", \"\");\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n Object evaluated = new jakarta.el.ELProcessor().eval(data);\n return Response.ok(\"
    \" + evaluated + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5aadaaf992deb30964d6b6c2ba52fa939243ff192eaaba686c605c786e28c921", "structural_hash": "46ef368a0f84733d634a14b21506981b3da4f8715fe43034d95128999efdb20e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17851.c", "upstream_id": "BenchmarkTest17851", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c31c5b1122381c20767dc6d5f74bf1ab094d9c67153adddea6c46b089a819bb", "structural_hash": "64b38ce1ff2783d17be456c6c28bf6e9fcf275909b0a0c3a39d5cc047e8b4c14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07304.sh", "upstream_id": "BenchmarkTest07304", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n divisor=\"$data\"\n if [ \"$divisor\" -eq 0 ]; then echo \"zero\" >&2; exit 1; fi\n result=$((100 / divisor))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a50ad14e92dd50c3a3840f77a686e11c8c29dabe7d4633c17d1c4ea34da74243", "structural_hash": "5d83b219a9379134c6f0e6d26246399ba161d282c8f5ef56aa9079bc3b1947f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02492.py", "upstream_id": "BenchmarkTest02492", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom app_runtime import db\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n reader = make_reader(json_value)\n data = reader()\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JsonResponse({'error': 'CSRF token mismatch'}, status=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e424e85b0735009807abaafb5da343478ca932f60b3d835a6ca78a42766c5213", "structural_hash": "540a023648342715c60c8daf1db986b85e31d3d014027e6f7b3f6d72dc56e374", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06844.sh", "upstream_id": "BenchmarkTest06844", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n chmod 600 \"/var/app/data/$user_input\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82ba6aefa25a86be5bef968d92548ad9c344f513eae71fa9a46f51b2acbbdf03", "structural_hash": "3ade06e5c0b63706a9c25b1bfd0aff4bb6d6894c84bebf3e2afb2f86f6e9ed30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02036.ts", "upstream_id": "BenchmarkTest02036", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const data = userInput != null ? userInput : '';\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33511a2fc6ebbaf529e442a690550b5813e10f2fa077333439db6aa60e62fffc", "structural_hash": "5b55f574a91ba544baa752f59dcbf3045d0c0e7f4d9eb3789aee7bb1d470e2de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18651.c", "upstream_id": "BenchmarkTest18651", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n void *_h = dlopen(safe, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a51695018d3cc770ab6cd2c43a23a27c7dc854457478eaf0f2b469da9987704", "structural_hash": "2b6df98e5995c7ae96a1dee73d19715eb46f608dfab221bfc984bda90e64c95d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01717.js", "upstream_id": "BenchmarkTest01717", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n fs.chmodSync(\"/var/app/data/resource.txt\", parseInt(data, 8) || 0o777);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b628bdf5de1a02d41af6b739576c1fcb88cd8ab9127c1ac3303fbd9d44c5e16f", "structural_hash": "b9ee6aedebf0e55a489ed6d96eace51185a7ff59bb7fad2d358aa80b62f2418c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00258.java", "upstream_id": "BenchmarkTest00258", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(uaValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0fab9ff24a8c83a9d35bb2897d5830c32ea5f38f203f7d9e04860f232790361", "structural_hash": "78dff7f36199b349a6f5b47b0c9fff556e76374911c463168d48618ac4beb7be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00736.rb", "upstream_id": "BenchmarkTest00736", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = user_input ? user_input : ''\n Marshal.load(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ebf53d096080b732c5dc3a56853f4c3f243b38adc6f8194237106b1827e5158", "structural_hash": "eaad83480fbe650f452f5eba49aa8d800e3b505664a0521a39cc9229a2dfba02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11996.c", "upstream_id": "BenchmarkTest11996", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _dst[16];\n strcpy(_dst, data);\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a0462b2fe55384b42547fb4ee94341b59463c5b6f9a1461d2ad9c1bb85bd86f", "structural_hash": "d7a195ab3f48b7d1cf0322698b39d33cabba21353dcecfaa0f817de19f7f979f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04315.rs", "upstream_id": "BenchmarkTest04315", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = auth_header.replace(\"\\t\", \" \");\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "136e8d7c074d22a86707ba47bdd3909ace77f074f0b4e68f3d9dcf1a02d18b03", "structural_hash": "cbfef71c9e684bcc2f9d0bdaabf4455df520aa726c99faf50b784b7e748e874e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04795.ts", "upstream_id": "BenchmarkTest04795", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as net from \"net\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT body FROM mq_messages WHERE queue = ? LIMIT 1\", [\"tasks\"])).rows[0].body;\n const data: string = shared.passthrough(userInput);\n const _parsed = zod.z.string().regex(/^[^\\x00]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n net.connect(80, processed);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f7f4a5ff05a2eb6a22f71dd5a89f0f9858261eb236226a5d7160deb28c37bd8", "structural_hash": "e59b3f6f4433d26427c9a933d8a90c99bdc2268e59ffff655263f06fb5f8d4aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00575.rb", "upstream_id": "BenchmarkTest00575", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4ec80c33f7f272097a3ba936de3ff3fa9f11d1627320812f7f49dd05e2c854f", "structural_hash": "3d077607eef488efe9a82bfc1130834426b4287e04dd710a33840d6cd82d2a37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05170.py", "upstream_id": "BenchmarkTest05170", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n data, _sep, _rest = str(origin_value).partition('\\x00')\n subprocess.run(['echo', data], shell=False)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ae88880e2d18df7731abb175db96a5c312c30d17986609a98870927adb111bc", "structural_hash": "7342e284786a1fc01db34fe4f6f54da330ade1f885b56674737e78cbb5ff8bb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03370.ts", "upstream_id": "BenchmarkTest03370", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data = `${userInput}`;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8864bebf08c2ed914e6bd4bb489079dac9a0f83a5af0fcc50dd7c09c3635bae1", "structural_hash": "06a5198e56a7de5c28ff76e1cd0ded8c3599991ff550eaec45439273a7e34a36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04929.py", "upstream_id": "BenchmarkTest04929", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom starlette.responses import JSONResponse\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n dotenv_value = os.environ.get('DOTENV_VAR', '')\n pending = list(str(dotenv_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c7568aa725fb6e3ce5d6f23671a4039e4d8a52424cbbb3ee7bcd7266b97b62c", "structural_hash": "39d5dad9ba1edac69a0de387d99036c7c547448e1fd351831a74015e8d62bec4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03569.rs", "upstream_id": "BenchmarkTest03569", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = user_id.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n static _RE_SCHEMA_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[a-zA-Z0-9_.-]{1,256}\").unwrap());\n if !_RE_SCHEMA_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n let _role = processed.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "431d147cfa2981d6338f9e7ae1e59cbd54ba1ac5789e5a2927cfd603db8955ee", "structural_hash": "2bd0d099062bbc7682b10e250a03dfe2cec2978691c02bad54101323f1007a27", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26880.js", "upstream_id": "BenchmarkTest26880", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = `${userInput}`;\n const storeCred = process.env.APP_SECRET || \"\";\n authCheck(String(data), storeCred);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c769f3777e30fc58c4e4a3c7671e5eec61bc38085707d6af85b7a4b5a781c7b", "structural_hash": "e4105d00df95a3660ee173ca13336f802c73c0990fd9433881cdb1bec4f162cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23446.js", "upstream_id": "BenchmarkTest23446", "language": "javascript", "code": "const { db, passthrough } = require(\"./shared\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = passthrough(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n fs.writeFileSync(\"/var/uploads/\" + processed, \"data\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e9f716bb5efc997373f56959b905e5516f29a989fb0795f38411a92ba4cc71d", "structural_hash": "42fbf4747376208401d490b7570385c83dbea40140850c630b05112659de0a52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05091.py", "upstream_id": "BenchmarkTest05091", "language": "python", "code": "from fastapi import FastAPI, Request\nimport yaml\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'app_display_name'\n data = (lambda v: v.strip())(secret_value)\n with open('/etc/app/secrets.yaml') as f:\n store_cred = yaml.safe_load(f)['secret']\n db.connect(host='localhost', user=str(data), password=store_cred)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5de3b6cbb13eadb5bd82960d1e3d09658506291bd1172d2ddd59a094d1a8eefb", "structural_hash": "64107cd7c24c5bbe6f836382745ba23a52960d23f1c18b4a7e0fd305bcc044d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08182.sh", "upstream_id": "BenchmarkTest08182", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "171ca85ba362f59c509fb1a1e1f34e8cbac68621b1f3c20a30827eb1a7750d12", "structural_hash": "028b27cc3c53f6644a9e032db0f7edbbaba3c92b6d07645457d58ae15cc889fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00143.php", "upstream_id": "BenchmarkTest00143", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n eval((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45e5ff39532b72b6c80bf3a9fd38f85d246177fdf04800e36013e57bb29e6aa9", "structural_hash": "004ae2538732ae4635add935e03935bf29f5b3fdbb1f741627872b723d081364", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_33556.go", "upstream_id": "BenchmarkTest33556", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar data string\n\tif len(graphqlVar) > 0 {\n\t\tdata = graphqlVar\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f7b52d722547099b86593660be90fd78d53825e57fca3f8f560127689877cf2", "structural_hash": "7cd1a0af2e17ca71d06c2d2b001b4a34c58752c49ee36bf7114d946f085b786d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01918.rb", "upstream_id": "BenchmarkTest01918", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n @user_input = user_input\n data = @user_input\n render html: ERB::Util.html_escape(data)\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec790e8b5f31f4478c1cb057f8df0f63a5a26ed930ac19f3f39012320e46397e", "structural_hash": "15f149593e72c3a9264010d48bdf04e56ed154c20e2496dd3041afd23b7beaa3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03342.php", "upstream_id": "BenchmarkTest03342", "language": "php", "code": "header('User-Agent', '');\n $data = \"{$userInput}\";\n $cred = getenv('APP_CREDENTIAL');\n $_match = hash_equals((string)($cred), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5282ff91eecfdd14ed3bb61e725640104d75adf5634e053058f209528e21d67c", "structural_hash": "cda49a289c93b3bbfb97171fccc7d3962ac1d7edfff38043bc7183038162c899", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01616.py", "upstream_id": "BenchmarkTest01616", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nfrom app_runtime import mongo_db\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n reader = make_reader(ua_value)\n data = reader()\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n mongo_db.users.find({'$where': \"this.username == '\" + str(processed) + \"'\"})\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c7f0c0bea8ee3855d22e2fb949a1f8a0c52e7ebe77b6a61315ab82483fffb57", "structural_hash": "759962cdfa120be171fae5b7e4befbba7c61b0d63b26f88c42fd7844206dcd92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00521.ts", "upstream_id": "BenchmarkTest00521", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9a0c23b071025789935a0003e919da9c5931dc29e3b330c691452221c0e956b", "structural_hash": "841cb42a1a5ea37614601187216096cc8b1368f4ddf2af389882218eed36edd4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04019.cpp", "upstream_id": "BenchmarkTest04019", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DOTENV_VAR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"http://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a70269a268444db020c3f522c47b9b283b2e5ba56940a890cf661beec882751f", "structural_hash": "fa409cbc6bffb8973e7256113f3e4c07bef09f851f4ae026689eb1054ace2f0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03325.ts", "upstream_id": "BenchmarkTest03325", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = \"default_setting_value\";\n const data = String(userInput).slice(0, 200);\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0976e962cc6178ece6e3a5791b7016954890b8ea87755bbbe70f8e136edc0255", "structural_hash": "755aa921e8dea0c43ccb89e42e5614a7a89b170ea574edc9eed098546f379651", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10029.sh", "upstream_id": "BenchmarkTest10029", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"${user_input:-default}\"\n printf \"\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c63714ab0008ef73b571a5379d3be101c03ae3c11edc348308fa05cbede38c4", "structural_hash": "8760cdc6c7d2733851ecba88c86971fb34c86858989f6944c9a1e61ce974629e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01062.rb", "upstream_id": "BenchmarkTest01062", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n processed = data.to_s.delete(\"\\r\\n\").gsub(/[A-Za-z0-9]{4,}/, \"****\")\n headers[\"X-Custom\"] = processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f114b8186a8955b1c06fd7e99ef634c89ffc8a66a31cd503bbe7318a7abf8268", "structural_hash": "ed4b8b4f5fc163ab38900a33f2d970d8c141c22153d13b7b41a6c2f93913c595", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04423.php", "upstream_id": "BenchmarkTest04423", "language": "php", "code": "headers->get('Referer', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $logger->info('Action: ' . $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82996b20716d10847a25ccb117c559bcd5b7093fad040e1c10fdbe53f2473f87", "structural_hash": "e31bb6c8e2fe14e385dae0537576ecdca63d239a5c592a5e0e2adb14494ed6dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01013.php", "upstream_id": "BenchmarkTest01013", "language": "php", "code": "input('field', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n posix_setuid((int)$data);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1922fff5d3e46e0c2e9b6882a2f11e5863083be3a8fe097f633575cbc6d1022", "structural_hash": "ae6e849aadf51801fa244a4c97bd8f64eb68a3d8063e1a26e105ace21c8a2c75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03347.py", "upstream_id": "BenchmarkTest03347", "language": "python", "code": "from django.http import JsonResponse\nimport os\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n data = f'{origin_value!s}'\n store_cred = os.environ.get('APP_SECRET', '')\n auth_check(str(data), store_cred)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60a8e6d759420c119bce570dbf37453af7fdfb907f3a95053fc10d1ed7ead12b", "structural_hash": "0286565a80c3c98f384ef5aaa6f35d6c9ec9f31ae7ac2226d2cc915b89a732d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00688.rb", "upstream_id": "BenchmarkTest00688", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = format('%s', user_input)\n cred = data.to_s\n authenticated = !cred.empty?\n unless authenticated\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e2e56a187b6f3b875f8db5ea7f573d82906e799969fe099c4009c7acb0b2a4f", "structural_hash": "59344843903ddcea83a1074dfd0069970265700426db16e51ecdd988e79f0326", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04408.java", "upstream_id": "BenchmarkTest04408", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = String.format(\"%s\", authHeader);\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a844707c4fa3c73ae148c9a827bd8700dd7fcbda805db4afe8d7da0ba56a3f3e", "structural_hash": "c1415c448ecce245be81c39692b53728ffa887ae1e9124e069f21e4f53127a3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01669.java", "upstream_id": "BenchmarkTest01669", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(userId.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object evalResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd8a9021eddca39e1c96f3118c16bcb3172551ffb4cf49ccf3c017aa335b078d", "structural_hash": "35255045b9b158d1ac02c7e6d4eb4a4e5b0012f735fad063b34592cb70696d73", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02663.cpp", "upstream_id": "BenchmarkTest02663", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic thread_local std::string cpp_shared_input;\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n std::string safe = (data == \"/bin/echo\" || data == \"/bin/cat\") ? data : std::string(\"/bin/echo\");\n std::system(safe.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "996c538679cc9e5025b83865174ef9bbae69472e30549bc619ec45c403df5f48", "structural_hash": "4e54cd1f1e941156b21661c4c34b97a59bf197ba9432f85e07d2798f526c3a67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02409.ts", "upstream_id": "BenchmarkTest02409", "language": "typescript", "code": "import { Controller, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = await Promise.resolve(userInput);\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"metadata endpoint blocked\"}); }\n const _isMeta = _host.startsWith(\"169.254.\") || /^\\d+$/.test(_host) || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host === \"localhost\" || _host.startsWith(\"127.\");\n if (_isMeta) { throw new ForbiddenException({error:\"metadata endpoint blocked\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e97e865b585dc9bb2f127f71389c51943e06ec42bd1e34e2ed6e911ab046e5ff", "structural_hash": "6372ecf27e6bf31e0cc8ac93ffc77e5276da0468ee8183b37f06b6f25198774b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07479.go", "upstream_id": "BenchmarkTest07479", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tlastRequestValue.Store(dbValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tdivisor, _ := strconv.Atoi(data)\n\tif divisor == 0 {\n\t\thttp.Error(w, \"zero division\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]int{\"quotient\": 100 / divisor})\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc907973b279e82a826dc7675f9c3fd33757a34bad9e052147be1d24e6b5108a", "structural_hash": "e5fee628fb048692abb0b6ba4d3823edd10d03ea670764e8f1700601d4bef533", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00130.cpp", "upstream_id": "BenchmarkTest00130", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35b4a91ec9da8ec012ebe08fa2114b49f1ccfe402444d91c90b815ea41625fdc", "structural_hash": "a46012d6abd173765f42b35ac18f2258d85dbafc2ff34f369587f6c17e8b4fd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21007.c", "upstream_id": "BenchmarkTest21007", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", data); fclose(_cf); }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59d21fa3f63754bcb6c92aeb0ad2e39e6fe08b732a42b33b4f13c6fd61789fb8", "structural_hash": "05b69729f6eebd25fba0a481b503d3d0952d38a50b6b8d982680c06a61ceadaf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08622.go", "upstream_id": "BenchmarkTest08622", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(cookieValue)\n\tallowed := map[string]bool{\"https://app.gocdn.net\": true}\n\tif allowed[data] {\n\t\tc.Header(\"Access-Control-Allow-Origin\", data)\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-346"], "category": "originvalidation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7b7e37c54813c54ff522fa012366b019457477efb97c4d413f2e248f4392994", "structural_hash": "ec8f324325ab4af574732a2bfd1c57177f3eb127a777836507ab57fd774f9dac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00913.php", "upstream_id": "BenchmarkTest00913", "language": "php", "code": "header('X-Custom-Header', '');\n $field = 'data';\n $$field = $userInput;\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $processed . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd8c905e82699b3ad1516f7345131f8d5701be643c4b1b25095b1c3519f35191", "structural_hash": "56846dc50a19372bd9027c8106bc4d92772f0439bd0d1c8748c1a08902d9469a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04968.c", "upstream_id": "BenchmarkTest04968", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n const char *safe = data;\n if (strcmp(data, \"status\") != 0 && strcmp(data, \"health\") != 0) safe = \"status\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", safe);\n system(_cmd);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d36ab1d45338513aebe3717690274435dc2aa7cb42924665e54f98ce5aa89d6", "structural_hash": "f1aefd4ea201792ddcd033533fb4c0ce35ae1b540a3e545116730319cfc8c203", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05475.php", "upstream_id": "BenchmarkTest05475", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $data = hex2bin($userInput);\n file_get_contents((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4c12e6756ef1c7478c03f0737866bda08dadc1db7455b0095f3083324e38c94", "structural_hash": "29c287b6b78e5c3f58946f27442d18e06e66bc7fc2a8db1203792e19f401907b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03142.ts", "upstream_id": "BenchmarkTest03142", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e50f4811f11101fbaeac2f8f2cf159d963c7a74714c8a212c204d87007f17f46", "structural_hash": "6cc719a70c34500c30bb253f6021c2dc2dc3b93ecea0fb5cc963e784b2793cac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00560.rb", "upstream_id": "BenchmarkTest00560", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n unless session[:auth_token] && Rack::Utils.secure_compare(user_input.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8b2e17bef6f6dfec2adab0f4bdea3357b0eab691060b5f76aeae9aaa2086391", "structural_hash": "5b2ce190929b3476f1da5f296ad9df8af834180d827a788b51109d4dad970d40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00548.php", "upstream_id": "BenchmarkTest00548", "language": "php", "code": "headers->get('Authorization', '');\n $field = 'data';\n $$field = $userInput;\n if (getenv('APP_ENV') !== 'test') {\n return new Response('
    ' . $data . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ec726d4269a51ee05f42a2cf5698327fb1567789b094dfd3f046b9b999f4fd2", "structural_hash": "3e70079867ed1aa98f3fc82226bf9aa039a24524c036b0021fe6f84b584030ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21407.c", "upstream_id": "BenchmarkTest21407", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f660ba40c473e08b23cd7625d15a6052467eb5c49c85b2aaa8fcdca270b430a", "structural_hash": "775c8da2ad460482279e720a01a3a88ec846cbd09cb4ba1fe3bee1b53dfe9f7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03660.php", "upstream_id": "BenchmarkTest03660", "language": "php", "code": " true]);\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d93c5ce8369516be61a54326b8275b6a3808fcf79b9981ec67cf2caba50841e3", "structural_hash": "2a434a9fdf1fc6c199219212b6611e37b5ec5b48dae89daf84a723369624ec8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18729.js", "upstream_id": "BenchmarkTest18729", "language": "javascript", "code": "const fs = require(\"fs\");\nconst os = require(\"os\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const tmpDir = fs.mkdtempSync(os.tmpdir() + \"/app-\");\n fs.writeFileSync(tmpDir + \"/data.tmp\", String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4eb626264289ad09c7b5c77be507259afa326e153637a2f89af85960fc5dc26", "structural_hash": "7e90abf952d8727d5077667b2abfc85feb9cd164d3c893c0a9de97b3a71ba442", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05996.rb", "upstream_id": "BenchmarkTest05996", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = JSON.parse(user_input)[\"value\"] rescue \"\"\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56dd114d2aed9a71973a95fa4f320408ca8ff76750ef00a74baf46e64cb52d45", "structural_hash": "7ea0d20300b823eb7503bcce69112865cd1b3903ef338fc1a7c2c0b73f25e657", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03625.rb", "upstream_id": "BenchmarkTest03625", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => data}).first\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "235fc760753d6d5ef06f17b03f18c5aa5d20f9c3a9533164b7f9f41056edfc5f", "structural_hash": "4f11bf85aa7b2407df6ede21e339b0b31172b335767a13c89b6872cf09abef42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00862.ts", "upstream_id": "BenchmarkTest00862", "language": "typescript", "code": "import { Controller, Headers, Post, Redirect, ForbiddenException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Redirect()\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(userInput).hostname; } catch (e) { throw new ForbiddenException({error:\"host not allowed\"}); }\n if (!allowedHosts.includes(parsedHost)) { throw new ForbiddenException({error:\"host not allowed\"}); }\n const targetUrl = userInput;\n return { url: targetUrl };\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7691a521d1bb4710155779ca8820aa0ed363196a1377efa7c28182b35d0e22d3", "structural_hash": "ead72d0960273f75aed19b6ac26b1a58b9b08682a21b68c6eb2a287f06dc4f42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02858.py", "upstream_id": "BenchmarkTest02858", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nfrom app_runtime import db\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(comment_value)\n data = collected\n logging.info('User action: ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa495578656f1b1cef3c9996594f90507203dd42fb7280794c8ec4538ae360ae", "structural_hash": "fe1e4202c95dd30905b50d0ba02419a4ae7945e3b15fcec81b1c136e2523c75f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04252.ts", "upstream_id": "BenchmarkTest04252", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = await Promise.resolve(userInput).then(String);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cd03486352bea8ba6bdd82c630fbaa048cc439519e0692e53411f7f1720d3b0", "structural_hash": "ade3bb5ebd6c47398aeac50ea7c7e284e0e28b6e697edc84b440796a200ef95a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00727.rs", "upstream_id": "BenchmarkTest00727", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"setting\", \"default_config_label\")]); m.get(\"setting\").copied().unwrap_or_default().to_string() };\n let mut data = String::new();\n for token in secret_value.split(',') { data = token.to_string(); }\n let store_cred = std::env::var(\"APP_SECRET\").unwrap_or_default();\n let _ct = crate::shared::encrypt_with_key(&store_cred, &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e15dd40456f944b1e1e5d28c6a42c9ef9493cbdf2940380cd148ed237fabfa3", "structural_hash": "f1494bde862b50519e4678eb102b3c9c7151714d3f980ef4cecb93277c220477", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18120.sh", "upstream_id": "BenchmarkTest18120", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _h=$(printf '%s' \"$data\" | sha256sum | cut -d\" \" -f1)\n if grep -qxF -- \"$_h\" /etc/app/passwd.sha256; then echo \"auth ok\"; else echo \"auth failed\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8bbf89d1ea108faa4fe1f2c6bb4d7edb21b92b12cb387366f6fbeb4df6507e14", "structural_hash": "b99502d362d8b61d1252a4ec4ad736c1b21a5d65c4c2cbc0f41eb3aadb31c686", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02838.ts", "upstream_id": "BenchmarkTest02838", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n res.send(\"
    \" + data + \"
    \");\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f3ba39527e907a739d5cd6af24fe7c95741a7b864a9b35ae43d5c04b4259f3f", "structural_hash": "e1caa3ee81d6d1595a5d684496cc098fd7d58e2668739bbd29f6b50b4f57d538", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01202.py", "upstream_id": "BenchmarkTest01202", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n origin_value = request.headers.get('origin', '')\n data = origin_value if origin_value else 'default'\n return HTMLResponse(Template(data).render())", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0491d3edfab8346c477572eaa84c459d3625f98e753a9774c5cd45f1fd4cea16", "structural_hash": "2abd8a5d829d4c65849e65ef31861601f3e0a356c0b9d1b88c4c0af955013fe6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_35387.go", "upstream_id": "BenchmarkTest35387", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n\t\"go.mongodb.org/mongo-driver/bson\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tif !validInputPat.MatchString(authHeader) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := authHeader\n\tvar mongoFilter bson.M\n\tjson.Unmarshal([]byte(processed), &mongoFilter)\n\tmongoClient.Database(\"benchmark\").Collection(\"users\").FindOne(context.Background(), mongoFilter)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38cf5f8191de0aa3b3f5e91b2253a675c18780ccbd368f10341e64ad98765e1d", "structural_hash": "f281ece6a05fa7addb82c60d40696c86eb2de270f0b18ad8791c650de2610e2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27172.sh", "upstream_id": "BenchmarkTest27172", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n rm -f $data\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d2efbdc3ae610ff9396f5f889d54aa6efbf80f86b3bf42f0b1e4c98715d6bf4", "structural_hash": "fbf1b40f3ced53f510a22179bf356d8d57ef611b52eb74c2ab8e30adbe6465cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02142.py", "upstream_id": "BenchmarkTest02142", "language": "python", "code": "from cryptography.fernet import Fernet\nimport os\nfrom flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n secret_value = 'default_config_label'\n if secret_value:\n data = secret_value\n else:\n data = ''\n store_cred = os.environ.get('APP_SECRET', '')\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8844a91d1597376261d30db8d9662e4d33efc95937bff4d872769d6c178766aa", "structural_hash": "96bef31555d777aa65490b460c72644acd0cd91fb1e84fd03248f345ef0e2e1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05116.rb", "upstream_id": "BenchmarkTest05116", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n response.set_header(\"X-Custom\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7d81d6e978aed08f0879269500101ef0ff19f8a5262b985cbcb881931d51a48", "structural_hash": "ef04bb82d13594df53be53d35965bbeecaa34526e5b3972a53aaaada78ee1e40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20830.c", "upstream_id": "BenchmarkTest20830", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n long _req = strtol(user_input, NULL, 10);\n if (_req < 0 || _req > 2147483646L) return;\n long _alloc = _req + 1;\n printf(\"alloc:%ld\\n\", _alloc);\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e16b5e79e84cf84ec7a3d329d961f65b7140f2fa399bcc99b10ae73d1a732f63", "structural_hash": "5b55f36dfd4541940f7739eada6cd4dc91dbfd8b2fc386da959c1da056abd251", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05083.java", "upstream_id": "BenchmarkTest05083", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data = String.format(\"field_%s\", originValue);\n java.util.Map records = java.util.Map.of(\n \"1001\", \"alice profile\", \"1002\", \"bob profile\", \"1003\", \"carol profile\");\n String record = records.get(data);\n if (record != null) {\n response.getWriter().print(\"{\\\"resource\\\":\\\"\" + record + \"\\\"}\");\n return;\n }\n response.sendError(404, \"not found\");\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:idor", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2d73cc7d6356b83fe77fd4291d8745a58be411e4c20d5d1f28745b9cde64001", "structural_hash": "7abb413bba923db917c909daed1bc8b0937b2e92347d3d914597816fdaa75658", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01606.java", "upstream_id": "BenchmarkTest01606", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.function.Function preprocessor = s -> s.replaceAll(\"[ ]{2,}\", \" \");\n java.util.function.Function fullPipeline = preprocessor.andThen(String::strip);\n String data = fullPipeline.apply(fieldValue);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d24d583e8f6f6a5adf04158bbc9d8340e06c0897636d49eba6c97490f9b647f0", "structural_hash": "733387faaf28b8b998f63f4373c40e8344934a8bb420cbd897d582532a585b2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01346.js", "upstream_id": "BenchmarkTest01346", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1637b6cc94c9bd579cceaf9ff46f17b3280ee85dd9e9b3e4371b0bb2cd252d73", "structural_hash": "dfadb69f4997804af4071ec685d26807278d161d3a06c3d1c579bcb4e64db37d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17991.go", "upstream_id": "BenchmarkTest17991", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\thexBytes, _ := hex.DecodeString(dbValue)\n\tdata := string(hexBytes)\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\tc.String(http.StatusInternalServerError, ldapErr.Error())\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+data+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tc.Header(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "565dc2b62719b2edf223fc721e0452d280426101d3016c7466a6fcafca6e06b4", "structural_hash": "bd0610b3f116cd9856929aa9ebcf1639d06da34612c517f730917aae9f1877ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02698.ts", "upstream_id": "BenchmarkTest02698", "language": "typescript", "code": "import { Controller, Headers, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string, @Req() req: Request): Promise {\n const userInput = auth || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab29c8dc803ae0b49a7199404efc5ee99b0e5a971afe83d7f6ac188b357dfd0d", "structural_hash": "f60865f88e4bb01d9d74d6500623b9501fcf94fe132e49062de26a801c8f664d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16013.js", "upstream_id": "BenchmarkTest16013", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "121ef6e6ef6fa08eab9cb392f741aa8f5f161ff8d8dfda595ce6f2a2f3064b10", "structural_hash": "521cb880d8ce0f9ff9509b64e46d56bb6c81f1020720bc371d21ef16b6a04aed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04817.ts", "upstream_id": "BenchmarkTest04817", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = \"app_display_name\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const dbPass = process.env.DB_PASSWORD || \"\";\n db.query(\"CONNECT user=? password=?\", [String(data), dbPass]);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e6ba4e5c001e327217cd26b3d2357a6ebe776422384011187f7ace51587f525", "structural_hash": "11bce46f612a4d9b3703b476239747a80562ee28c8aca1a50b77ac30d77e5790", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01042.cpp", "upstream_id": "BenchmarkTest01042", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4c6f68288959734466df953c1636be0e7213c9fbca4701bd2cd653fe49c2c57", "structural_hash": "b1a75024530359c43a9b249d3c4d44e5b6f11b667c2acc7adbcd238be1a85af7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02156.py", "upstream_id": "BenchmarkTest02156", "language": "python", "code": "from django.http import JsonResponse\nimport logging\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(auth_header)\n data = collected\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37dd5779bdfe2ecb813507fc71a22304143a63cd714bdbd3076a786e8b9d3ac2", "structural_hash": "138715eee14476a0006de3188693cb825f602c78731a6d5cd30a5351912f2a06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19275.js", "upstream_id": "BenchmarkTest19275", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = String(userInput).slice(0, 200);\n try { JSON.parse(data); } catch(e) { }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5df894985670f2ac8f6ead184b2c4eba992ae840017b1211d901e0fb73db79ef", "structural_hash": "1038ae2ce085a69387ce6b9706da2f9f7fe8ccc314249528c679584cc83b8941", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03695.php", "upstream_id": "BenchmarkTest03695", "language": "php", "code": " 'private range blocked'], 403); }\n $targetUrl = $data;\n file_get_contents((string)$targetUrl);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9259a61ca3feb1b8b2b8ecab53b446a4da813d3b296882619466b156912681a8", "structural_hash": "422ba6bfed69983578f34acbd5e92a82211bc3713d0850ad895ad2963efb01f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14046.sh", "upstream_id": "BenchmarkTest14046", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(printf \"%s\" \"$user_input\")\n _host=$(echo \"$data\" | sed -E \"s#^[a-zA-Z]+://##; s#[/:].*##\")\n case \"$_host\" in \"[\"*|\"\") echo \"private range blocked\"; exit 1;; esac\n _ip=$(getent ahosts \"$_host\" 2>/dev/null | head -n1 | cut -d\" \" -f1)\n _ip=\"${_ip:-$_host}\"\n if ! echo \"$_ip\" | grep -qE \"^[0-9]{1,3}(\\.[0-9]{1,3}){3}$\"; then echo \"non-ipv4 host blocked\" >&2; exit 1; fi\n if echo \"$_ip\" | grep -qE \"^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.)\"; then echo \"private range blocked\"; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c4fa251732bd563abc56469723cc8b1e8ac61c150f9c878dcaac7252aaaee67", "structural_hash": "852de249bd9b4cc9e178d5526c691dba1bc28057556bfd8aad2d6481c649d87e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03665.java", "upstream_id": "BenchmarkTest03665", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(uaValue)); }\n catch (NumberFormatException e) { data = uaValue; }\n java.util.Hashtable env = new java.util.Hashtable<>();\n env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");\n env.put(javax.naming.Context.PROVIDER_URL, \"ldap://localhost:389\");\n javax.naming.directory.DirContext ctx = new javax.naming.directory.InitialDirContext(env);\n try {\n ctx.search(\"ou=users,dc=example,dc=com\", \"(uid=\" + data + \")\", new javax.naming.directory.SearchControls());\n } finally { ctx.close(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "866630905aff8a6ceab4f1d35dc8cfa8241cd4f9a1a8eb146ac7d1c9e30e797b", "structural_hash": "e035d777e18da046d696289130277226a39cff72307d9dc1b560991769635981", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02571.cpp", "upstream_id": "BenchmarkTest02571", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n const char *_sess = std::getenv(\"ADMIN_API_TOKEN\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a3ae664ef55c69785bb172a7a0668ffb3bff83a14da83bcbaee51c2071c3bf7", "structural_hash": "c02da6146e01a3b9e3f312e1c0f0e2f53543dd488d91aaa984a719cd00b6531f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01557.cpp", "upstream_id": "BenchmarkTest01557", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data = cpp_module_transform(user_input);\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c50b6669ba1a6f3103f4723b258ee3fcd1fcb79d9b515de4de2660642e28c42", "structural_hash": "871c074dc97d3f6b5b56af44c15ba0bfbf5e7c395f5a475dd4d0efb10e0f5e97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02734.py", "upstream_id": "BenchmarkTest02734", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n parts = []\n for token in str(multipart_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d7393efc22a8abd7b113e9e33eeea2f11c3c3d8358c77dbf056867d4450d9c0", "structural_hash": "14118d20b770fc40d3f6c09e41e981c23a9d9f9bfbb87a704b08df052d4aac25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01256.cpp", "upstream_id": "BenchmarkTest01256", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8debd838db23d44448dc185f19a03509ec5a8855ec89dcc4a4c0fb4b8473341b", "structural_hash": "8477bf32fd3e359f484ecd18d1ab0568c6b15392a60b9d81ea14e07cfe7779a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04958.py", "upstream_id": "BenchmarkTest04958", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = bytes.fromhex(cookie_value).decode('utf-8', 'ignore')\n os.system('echo ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c23cc79c4225865b59683268b09ef35a00279d9f0d5ef71938631dccdcaaf36a", "structural_hash": "f5e896563cd68619fc19437007fa1c33654662e6d0bd20d3577172448a609ea1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35787.js", "upstream_id": "BenchmarkTest35787", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = userInput != null ? userInput : '';\n if (!authzCheck(req.session && req.session.user, \"admin\")) { res.status(403).json({error: \"forbidden\"}); return; }\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-602"], "category": "client_side_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c975c3e8e1a7153bf66f49748c3a39de2045402567db3c4ec0709b16892f74e", "structural_hash": "523f4169c9967160c17004fa9465139037ba394f8991af575eb6385b941350ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01391.php", "upstream_id": "BenchmarkTest01391", "language": "php", "code": "header('X-Custom-Header', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('output.csv', (string)$processed . ',data' . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac050198fe20646d9a4d82f1010f8d25a7f95c200fd40f996f7811103758bc52", "structural_hash": "93be220cf4c1a5b82582781d84ea8e27c76518576c61681fcbb8bb978a4370b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02180.ts", "upstream_id": "BenchmarkTest02180", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as libxmljs from \"libxmljs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n libxmljs.parseXml(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65192fd532fe5b36292ca1246ee0c6363dcc714edc26ae4e43feb3d6348df4fd", "structural_hash": "3a340265a7039f0ba8ec64749205eea54ceb8c664d92cfd9a31a9b98c1abf987", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04644.py", "upstream_id": "BenchmarkTest04644", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = ' '.join(str(raw_body).split(' '))\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Access-Control-Allow-Origin': str(data)})", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b20aa82645848ca5c361d55a6da97c6f12d302cbd005965aae33f8afc460f492", "structural_hash": "389de43311fe08622f9f5cf96ff78a4b942238ad84d5b58a7d7f8a7bddc722e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03478.java", "upstream_id": "BenchmarkTest03478", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.Properties box = new java.util.Properties();\n box.load(new java.io.StringReader(\"rawValue=\" + pathValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", box.getProperty(\"format\", \"plain\"));\n String data = box.getProperty(\"rawValue\", \"\");\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object codeResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bb6240f5009a81cdd93a44d9740f7f3bb91de4c34763dffbfc60866dda9e4fb", "structural_hash": "9b344e57e8414dec5a61480e0ca14f69faf9a1d525662242fdf95c9f21b05085", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18607.js", "upstream_id": "BenchmarkTest18607", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a853a9d80a0e727518b5f3b25b0b296e0bf2e684f6f00bf64a0297a7c5ec7575", "structural_hash": "f6422de30af9dd27710951fe0b0e85b0e8f4892e29fdc2811a7f3502b3637549", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04077.py", "upstream_id": "BenchmarkTest04077", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n upload_name = request.FILES['upload'].name\n kind = 'json' if str(upload_name).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(upload_name).strip()\n case _:\n data = str(upload_name)\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return JsonResponse({'error': 'invalid integer'}, status=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JsonResponse({'allocated': allocated}, status=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dbd6f9376480a418504b27ea79d1a486f818ebcc86d85cb3d42919aa1e718a7", "structural_hash": "6021caadf52096b1376bdf1802f5fa2a64d928a142e209275112d1c25b55468f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03838.rs", "upstream_id": "BenchmarkTest03838", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let tokens: Vec<&str> = field_value.split(\",\").collect();\n let data = tokens.join(\",\");\n Command::new(&data).arg(\"--run\").output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "876c6009401a3569fdd33467e3efc63b6c13a37f44d81158d0557bd87f26890a", "structural_hash": "2492b51b3105014e30909cdc25f07ec96990e60411883b05cdd3c782efe6735a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_40269.js", "upstream_id": "BenchmarkTest40269", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.DOTENV_VAR || \"\";\n const data = String(userInput).slice(0, 200);\n authCheck(\"admin\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6f328b705ec77bdcb8cda612f2fad90a73f489f11a5d35abc922e2028223dd7", "structural_hash": "2c26f511740bd645b2555a762a3eeec2974119697624511051ede098e83f76dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05182.php", "upstream_id": "BenchmarkTest05182", "language": "php", "code": "cookies->get('session_token', '');\n $data = vsprintf('%1$s', [$userInput]);\n $result = $conn->fetchAssociative('SELECT name FROM users WHERE id = ?', [$data]);\n if ($result === false) { return new JsonResponse([\"error\" => \"not found\"], 404); }\n $value = $result['name'];\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59d1ec2f388876e2e18ccda03917a5608a7df361cb89ea8e8df41fb9a3d7b6b3", "structural_hash": "3cf14dae4abb843140166eecac7b0d24785e3eb2921c945bb07eb052a8ffc47d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02826.cpp", "upstream_id": "BenchmarkTest02826", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data = std::string(\"value=\") + user_input;\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aff60402c1b59f082b0c1ce1808bc8a20a78b289e71ca450472159a940ebafe5", "structural_hash": "cd6bebfb2de5e92d2cb6a9bdebf14b65b30747100da507f16a701945d0040705", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_38498.go", "upstream_id": "BenchmarkTest38498", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", headerValue)\n\tdata := _sb.String()\n\tparsedURL, err := url.Parse(data)\n\tif err != nil {\n\t\thttp.Error(w, \"invalid url\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tallowedHosts := map[string]bool{\"api.svc.cluster\": true, \"cdn.gocdn.net\": true}\n\tif !allowedHosts[parsedURL.Hostname()] {\n\t\thttp.Error(w, \"forbidden host\", http.StatusForbidden)\n\t\treturn\n\t}\n\ttargetUrl := data\n\thttp.Redirect(w, r, targetUrl, http.StatusFound)\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7e644b4ab2863379614a84f822267ea148be606435d9eb45e8c73bf881887c3", "structural_hash": "974ad824665d935c65e68b62a22b969a4d8c98ed7f8b3c04fe8a16d0ac130931", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01527.py", "upstream_id": "BenchmarkTest01527", "language": "python", "code": "from django.http import JsonResponse\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n data = '{}'.format(forwarded_ip)\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6748db95afe7d40b9a5d318dfbfaa33df548a4b04a81eb2062ae821a0292c2ce", "structural_hash": "2a13b3ff934b7df3e78114e22139541675902d7bf91a3a2507b903c9ab124207", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02689.java", "upstream_id": "BenchmarkTest02689", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadedName = java.util.Optional.ofNullable((String) request.getAttribute(\"uploadName\")).orElse(\"\");\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : uploadedName.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4048a1e660ec52f6f9a31175a735500ba14dd86aee874d74b0672ae983efce28", "structural_hash": "4e9666492c5bb5e2a196d9e0a03ae01bf36e9bd9a1be0618380fab6a510555bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04523.py", "upstream_id": "BenchmarkTest04523", "language": "python", "code": "from flask import Flask\nimport html\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(comment_value)\n data = collected\n processed = html.escape(data)\n return '
    ' + str(processed) + '
    '", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d53b92a32dd28e74123788a19ba0031d72b5194de9bbff5b1ab6eeaa109193d0", "structural_hash": "4016821193ea81284122ae84dc0ba5a603280f2d442d695d55a02073c4198e07", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01912.py", "upstream_id": "BenchmarkTest01912", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n auth_header = request.headers.get('authorization', '')\n data = f'{auth_header!s}'\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0380086932eae21dc73a50e5ec16a3f1514533c1b5fae738244e0fb5da5367ad", "structural_hash": "47efc2768866fda9c8246d79a6a2b1b596ba8cf39373b0915b0c41834aea0caa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01283.rs", "upstream_id": "BenchmarkTest01283", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(forwarded_ip.clone());\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1846d2b0ac2dc08d92d613ea29eb9baed264382280158284e9cfc59e87e51315", "structural_hash": "20ff4a0b399e8ab101ccb39dfcbc638a5ef26190b0f2402d04cb6524acf3c5f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00646.py", "upstream_id": "BenchmarkTest00646", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n def normalize(value):\n return value.strip()\n data = normalize(host_value)\n return JsonResponse({'error': str(data), 'stack': repr(locals())}, status=500)", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e45791ed76089707ba14d198459c1d9e2611d8ff4a5f3772e69d448ed6c5477b", "structural_hash": "76849a2681024f436a0c8ffe3acb6d8cd3855b9c55bf9c63b33d32206c968c65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10793.js", "upstream_id": "BenchmarkTest10793", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { res.status(403).json({error:\"forbidden\"}); return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d02b59179a3617999eaac571e79e444c99c635efd558065228c756c143c49415", "structural_hash": "5a290045b4682fca29634285d70efb3ebbc0bc39347afaf33819625c45bed6d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05204.ts", "upstream_id": "BenchmarkTest05204", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n childProcess.execFileSync(\"echo\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "081f5aed7d07ee36799d0523d33d484ea6eaf25a0084d5d368674d8709b836d1", "structural_hash": "c8ffc94729c922312ae4417ac7f8c9efdd4a285a7ed2125933073434604684d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16233.c", "upstream_id": "BenchmarkTest16233", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96a21bd0b07a5f5210c9ebaada038fd00103785d4c0e414b8e5e7ab414857c29", "structural_hash": "8ca9b8baab8c91b4e3f22787a502c75fa82398b8518f2b8b2d313e143c421bd0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07983.sh", "upstream_id": "BenchmarkTest07983", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b690d2881b331072d0cbb9fe53548250d5cc82376c583ce99e8122b6a47dccaa", "structural_hash": "5230b4adda0a7cd4c5526319900561fe64341fa36efc0c84c580aa2ae5cdfd93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01240.ts", "upstream_id": "BenchmarkTest01240", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b3e48e3be5301ebc82a02abc0d1795cecbb7c03e50b8447356d94bb638d1d06", "structural_hash": "c5389e567e9101a26b606ffbc282c62df0c1c678789e697d418270d68ad39250", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03375.java", "upstream_id": "BenchmarkTest03375", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{hostValue});\n ProcessBuilder pb = new ProcessBuilder(new String[]{\"sh\", \"-c\", \"echo \" + data});\n pb.redirectErrorStream(true);\n pb.start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "881942cbd7ddf46396cbae62ad9ff7170d0f0e7729a6eeb41190824638ef6375", "structural_hash": "b06fe78a8f6a6a64eb843e6e14753ba98821619afd82938325da0a53059b86c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03519.py", "upstream_id": "BenchmarkTest03519", "language": "python", "code": "import os\nfrom flask import Flask, jsonify\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n env_value = os.environ.get('USER_INPUT', '')\n reader = make_reader(env_value)\n data = reader()\n os.system('echo ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e9a565f6f232ab34ae8c21c1acfcda0e311e0101b6c14ef60711c7ce6245aa7", "structural_hash": "525d94788cfdee5afb252dbf7b099ea5b7f9c7915e0ccfff709b0d2d7c790d0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18343.go", "upstream_id": "BenchmarkTest18343", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(graphqlVar)\n\t}()\n\tdata := <-resultCh\n\tallowedFields := map[string]bool{\"name\": true, \"email\": true, \"bio\": true}\n\tif !allowedFields[strings.SplitN(data, \"=\", 2)[0]] {\n\t\tc.String(http.StatusBadRequest, \"field not allowed\")\n\t\treturn\n\t}\n\tprocessed := data\n\tparts := strings.SplitN(processed, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5ddb51fbc348ad2bdc9019bfd216b6de017234c7d98bb4c22b4ee44c79ace03", "structural_hash": "cbcf3c8bfa894149433d05ea57a148194cf9177586ed50974ae45f59c5c20d11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01156.cpp", "upstream_id": "BenchmarkTest01156", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75bf2d1deb642f43bb12be2717b8429894fc04d373f42ee90a957947779142d1", "structural_hash": "6c0eec8020d1aeb2ac9fd9ef5e082cb4f37f97d8d306eda78c11dbc00bee56e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06192.ts", "upstream_id": "BenchmarkTest06192", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { res.status(403).json({error:\"forbidden\"}); return; }\n const checkedPath = resolved;\n fs.writeFileSync(checkedPath, \"data\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31b509915b55b84595ddd0bad557004e6cf54a559936744f9b0b2a062b3fdbbe", "structural_hash": "c41b93351dce34e8194e04874fd0017a586e61697bd9d9f747599dd3495e957f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01133.rb", "upstream_id": "BenchmarkTest01133", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17ea3f3439739d6ef1b4af3b293365a5abd53ec064a2b7006b43e55abeb637cb", "structural_hash": "3e8cb3595819c728e3a88aa1956ccded3eaca85e3965a6c588f9ed32aba07653", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05412.rs", "upstream_id": "BenchmarkTest05412", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n crate::shared::store_session(\"data\", &env_value);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3584207bd376e2ae202c48513bb9281284fd28d74928dc876f2a27e5d833ab6", "structural_hash": "6e7d14ff890ff36b7844243b3751ef68a203dc4972ed560ab5387ca7ec85662e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01805.rb", "upstream_id": "BenchmarkTest01805", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n data = String(user_input).strip\n eval('require \"net/ldap\"; ldap = Net::LDAP.new(host: \"localhost\"); ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", data))')\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "507ebd8b5ad15f3b3faa835bb562b108a8d271f48e9d15ef9e6153b42564e464", "structural_hash": "99be5fd11638f36e0a90462ca7e7f4baa6bc711a37adcbeafbc56580398a20c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05533.rb", "upstream_id": "BenchmarkTest05533", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n data = Thread.new { user_input.to_s.strip }.value\n Thread.new {\n eval(data)\n }.join\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b56e6a09df10e6fe61093582d3e416bfaeed86600ab2f5765c2fd8951056edd", "structural_hash": "7eb899af607ca910b6675b63f2246b6ca969cc86357b8447753e1cb3edf324f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04885.ts", "upstream_id": "BenchmarkTest04885", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n globalThis._loginAttempts = globalThis._loginAttempts || {};\n const _who = String(data).slice(0, 64);\n if ((globalThis._loginAttempts[_who] || 0) >= 5) { res.status(429).json({error: \"too many attempts\"}); return; }\n globalThis._loginAttempts[_who] = (globalThis._loginAttempts[_who] || 0) + 1;\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3cb3691f0fbdb42383827473bf0f5fec65c4089bc092982b267fce0eede89859", "structural_hash": "b5e519abedb4fa1036da07e77f11309ba65437c9da46d72bab0f01cce1eeb4e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00109.ts", "upstream_id": "BenchmarkTest00109", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72df401f03418248175d00b6209d12a88619dc42ff9d9035a8994429b9ac5f0c", "structural_hash": "c75e766190b46c6bf159c1160d596a5f88d8dda36e91fe4aae0af1fad5f446ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00500.cpp", "upstream_id": "BenchmarkTest00500", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "836fdb419e9713ea38b0bc38433690205c8731e724041d4584e7e485bda0862d", "structural_hash": "3d0c990cef9a7862ada2d54d68a91346ce8e97bcaf6af1dd14ab966e0b9e7123", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12195.c", "upstream_id": "BenchmarkTest12195", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n long _v = strtol(data, NULL, 10);\n signed char _c = (signed char)_v;\n printf(\"%d\\n\", (int)_c);\n}", "label": 1, "cwe": ["CWE-194"], "category": "sign_extension", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sign_extension", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2ba12c3308a8bff26f5de9ac0f37de627bc94253bf8e96f11fe1c379a4fd962", "structural_hash": "212b62f47cfe1bb9fb53c5d8bf62a412a9288d1c37e03bdb2be9e3dbc74bdd4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06458.c", "upstream_id": "BenchmarkTest06458", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n free(_p);\n}", "label": 0, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e52c0c9dfc553659e6cd11f4b00d379b35c6425037e2fdb38cba6e640a72104e", "structural_hash": "f4e668dbb19d79e7c9e607eba426f14f8b157bf7f5397043134e9bfb25cb60b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04672.js", "upstream_id": "BenchmarkTest04672", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "184d2b25195da8b5c9ec3cea729a9b6e15cee4bd69cb22945c9caea0a61c9c6f", "structural_hash": "8b1bec5637ed104db1b0c3d955bc59f731f1ed21c0f473f1315a7c18383db15e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13721.go", "upstream_id": "BenchmarkTest13721", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := string(bytes.TrimSpace([]byte(rawBody)))\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"audit actor=%s action=revoke_sessions\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bebf67945f7aa78a8289ddeaf81d5c1635409f43e4df4d15c7ecb4b08454f33", "structural_hash": "54e5d1cad65e793dfafce813c09417669f8aeb7bff78b575ed11d9802223ca63", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32681.go", "upstream_id": "BenchmarkTest32681", "language": "go", "code": "package testcode\nimport (\n\t\"html\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := strings.Join(strings.Fields(authHeader), \" \")\n\tprocessed := html.EscapeString(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b1ab92aa4b9f7cb180e1a50792948a913f042c857a818e70bd6b9c0dc166448", "structural_hash": "9b5a8ad1adc5fd8a4d567eb6d98c95b24852a78d4246228901a7aeca9f05f58d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_32108.js", "upstream_id": "BenchmarkTest32108", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = \"\" + userInput;\n global.sharedState = data;\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a361edfda16b1aa889a2e3b576cf222f1f0f19155fd1675e3899dfd2bc69f28a", "structural_hash": "6e5b8cc4b927606afc24f7ed8fd5d1ba238ee1d2984ef7ef7f7de3795b1ad15b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04066.py", "upstream_id": "BenchmarkTest04066", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n kind = 'json' if str(cookie_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(cookie_value).strip()\n case _:\n data = str(cookie_value)\n if data not in ('asc', 'desc', 'name', 'created'):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n os.unlink('/var/app/data/' + str(processed))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d7a46b48d182ff70ede6573b8731406b912a1ba7a33c266be8b9c65fed78b41", "structural_hash": "66504cdd119ad1843af5e5dcfe0734f892625aeab667700b504d7a18c6dd95c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_06029.php", "upstream_id": "BenchmarkTest06029", "language": "php", "code": "header('X-Custom-Header', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n mt_srand(ctype_digit((string)$data) ? (int)$data : 42);\n $token = mt_rand();\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca9f58573045d0121599fd06c1aa76c557f4184839a01e68f04ceb27758295ea", "structural_hash": "6d66a89764d2b7dc6935fe7edc3c3c73e1d8b59ce8fd22c958822653436c38a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00210.rs", "upstream_id": "BenchmarkTest00210", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if forwarded_ip.len() <= 4096 { forwarded_ip.clone() } else { forwarded_ip.chars().take(4096).collect() };\n crate::shared::ldap_search(&format!(\"uid={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54f8df24510173e467b8a464347f268725c2328c639ce2bb4bdb0a10e4d451f4", "structural_hash": "79e52e9d0cb762e149fe2f71ce62e0975730dfd122b5cd97c9e2410b6e582a7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19817.sh", "upstream_id": "BenchmarkTest19817", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"Content-Type: %s\\r\\n\\r\\n\" \"$processed\"\n printf \"{\\\"status\\\":\\\"ok\\\"}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d554ff027c107dd79d6efda2bad7832233fb9c58f555b182e99d05f1d351bf8", "structural_hash": "f9fa0099c8d67b60cd064fbacb4a7da4035a90d0aa19aafc7cfb30eee0d175be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05179.go", "upstream_id": "BenchmarkTest05179", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar argValue string\n\tif len(os.Args) > 1 {\n\t\targValue = os.Args[1]\n\t}\n\tvar data string\n\tfor _, token := range strings.Split(argValue, \",\") {\n\t\tdata = token\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+processed)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "976c8141f03d3bf64cfdb5ff74b600b9cd1fcae12f7bccabf97a023007b2da37", "structural_hash": "4d5341add37b6a369fe991632513f08a4501279090dfa8a95fc7cbb446e3f9c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05414.go", "upstream_id": "BenchmarkTest05414", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tdata := BenchSvcPassthrough(multipartValue)\n\tparsedInt, err := strconv.Atoi(data)\n\tif err != nil || parsedInt < 0 || parsedInt > 2147483647 {\n\t\thttp.Error(w, \"invalid integer\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tboundedVal := strconv.Itoa(parsedInt)\n\trequested, _ := strconv.Atoi(boundedVal)\n\tallocated := requested + 1\n\tw.Header().Set(\"X-Alloc-Size\", strconv.Itoa(allocated))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e4553b173ccc91b08f440fa1cf12f91e3bf0d2316999f30b83cac2155e3705d", "structural_hash": "9598914f10576f7a910683da30d661b63bf66891aede80aa7e9a99f2aa89a393", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01469.rb", "upstream_id": "BenchmarkTest01469", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"yaml\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n YAML.safe_load(data)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c12c0b369dbc4dc0a63110794416bae13e183c00c081cd8bfd7fa38c3565409f", "structural_hash": "6f360b04ed2d85bc8f8d9eeda98ebb0037d45f107a8421e7d55b0f2ebf2643d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03771.sh", "upstream_id": "BenchmarkTest03771", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(echo \"$user_input\" | base64 -d 2>/dev/null || echo \"\")\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66c4c2c6ba24e57b8e7724806f150e49c0b235b02f8abb6ba20f39ea418d77da", "structural_hash": "a0133ba3c4a1593955e21bd4204c382590a9edafbf60f0aff2601c99734f8b10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01432.sh", "upstream_id": "BenchmarkTest01432", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n chmod 777 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "541e53b780278443aa2430065b15c37ba1fbb57c0927d3a142a46b529bbab297", "structural_hash": "2b0dd40a8c7245dec1a9bb90344da2393d3b4bc7ffb8719139c357876554ec3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00502.sh", "upstream_id": "BenchmarkTest00502", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_prng_seed2", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d52fdab757bd8ec3e69e63ab892384e7f52706d3a58159e0871497fe46c1c504", "structural_hash": "e7636d2715c1afe01cca996995aa8e019deb3d0d58b381c7d70e9060423804d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05337.js", "upstream_id": "BenchmarkTest05337", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf051be38d8d9f8360295364237823f3a1dc265827e83ee37df965809ecaff5d", "structural_hash": "b8f88262f071644fec17e1c7b113c4a158fb50ccb26e138bbfeac38dd11cdfb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05310.rb", "upstream_id": "BenchmarkTest05310", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"resolv\"\nrequire \"ipaddr\"\nrequire \"open-uri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n _host = (URI.parse(data).host rescue nil)\n _ip_str = _host ? (Resolv.getaddress(_host) rescue nil) : nil\n _addr = _ip_str ? (IPAddr.new(_ip_str) rescue nil) : nil\n unless _addr && !_addr.private? && !_addr.loopback? && !_addr.link_local?\n render json: { error: \"private range blocked\" }, status: 403\n return\n end\n target_url = data\n URI.open(target_url).read\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d1bca27c2c16bffa23ead878bd3b06a5896864869b42b528d6aba95ab70097c", "structural_hash": "801328559adbc64611a629711b8759a9a9a6c713b1bc6696e43bed5bcd6851ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19418.go", "upstream_id": "BenchmarkTest19418", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"sync\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar profileBio string\n\tDB.QueryRow(\"SELECT bio FROM profiles LIMIT 1\").Scan(&profileBio)\n\tvar _b strings.Builder\n\t_b.WriteString(profileBio)\n\tdata := _b.String()\n\tvar secretCache sync.Map\n\tencrypted := encryptForStorage(data)\n\tsecretCache.Store(\"current\", encrypted)\n\tc.JSON(http.StatusOK, map[string]string{\"stored\": \"encrypted\"})\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_memory", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50c3ec8703d1758f6cf34d4987156c27add474440cac360c9d1d43b18708943d", "structural_hash": "57dd5a086c0597ad10c47edc7cf139efe268706232d3e23c7fb13db4a2530344", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02014.ts", "upstream_id": "BenchmarkTest02014", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90c055b506701ba961b9972db599407b20994388beafe57bc4666f6893871630", "structural_hash": "578f9c12c79ec2387c42aa4efcfe1c8389dd31178e4a5e9768ef608438318c99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32469.go", "upstream_id": "BenchmarkTest32469", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/base64\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdecodedBytes, _ := base64.StdEncoding.DecodeString(dbValue)\n\tdata := string(decodedBytes)\n\tparsedInt, err := strconv.Atoi(data)\n\tif err != nil || parsedInt < 0 || parsedInt > 2147483647 {\n\t\thttp.Error(w, \"invalid integer\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tboundedVal := strconv.Itoa(parsedInt)\n\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(boundedVal)\n\tif idx < 0 || idx >= len(arr) {\n\t\thttp.Error(w, \"index out of range\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tw.Header().Set(\"X-Lookup\", strconv.Itoa(arr[idx]))\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf86238ca148ac6c95510ffc1153072ecaddabed2abec5a3a58049c57b279e4b", "structural_hash": "14ffb7df256ab0e735788b8635f470b78faf413e72121dcb9ec02effe3c60a65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12866.sh", "upstream_id": "BenchmarkTest12866", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n echo \"$data\" | openssl enc -aes-128-ctr -nosalt -iv 00000000000000000000000000000000 -K \"$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-323"], "category": "reusing_nonce_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "353738b428ac5109700ac5f76736b4ccd0250101856e2689f7fc38e50281e9c7", "structural_hash": "d80b23593ec4d9b97b5ede304ad5aaa67e41a8b5790e06dd52fcb9a5840e2a98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02963.ts", "upstream_id": "BenchmarkTest02963", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (data !== req.session.csrfToken) { res.status(403).json({error: \"csrf mismatch\"}); return; }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "42456d751138eb0327b377312b75d77a82cffb066085c0e4b2b61ae1b3bafe02", "structural_hash": "134cce29dc7fe4df8d50fbd2b684cacdf0ee5e8e07939dda69ecb4e09fdf412a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01170.rs", "upstream_id": "BenchmarkTest01170", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n let mut data = String::new();\n data.push_str(&config_value);\n let _stored_digest = std::env::var(\"STORED_CRED_SHA256\").unwrap_or_default();\n let _ok = !_stored_digest.is_empty() && crate::shared::hash_hex(&data) == _stored_digest;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ae3361e7ed9755207d7bd5f827e36980e02486f7f807dfa518e4ce5771bfe50", "structural_hash": "ad785be170600dc1b376fa96c9f741f147e57b22f6bc395fdb89f6f1f4f63412", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27067.js", "upstream_id": "BenchmarkTest27067", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n if (!ctx.session) { ctx.status = 401; ctx.body = {error: 'no session'}; return; }\n const processed = data;\n ctx.session.id = String(processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da9700cdd2254f59265b848fca17a439e8fc550b559a674c2213d4c2514d4993", "structural_hash": "bfbe84a3de0213012b6f05ed1604ac9a800f9b9405257ad0171119f777cca00b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01120.rb", "upstream_id": "BenchmarkTest01120", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n Nokogiri::XML(data) { |config| config.dtdload.noent.nonet }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad4ff1ed05ac4f32241eca75b0df75a468e413ef0f18bbc948847ad03a1ecfc4", "structural_hash": "4aa7b9addfabd4315669ef2a6a6bff52113e8de1483d5935515dc893c7560f66", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20852.js", "upstream_id": "BenchmarkTest20852", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + processed + \";\");\n require(\"/var/app/plugins/generated.js\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "470617158e0e5ccfa823baf7db5a9ddf45a3c7eae410af224a3e86281c97d7f9", "structural_hash": "d8dda5bc4d5c36ff2d8bd01b61c3ac3ffb957bb6ceb7d29b0aa58fe3dee9769b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35599.js", "upstream_id": "BenchmarkTest35599", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-311"], "category": "missing_encryption", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f0c301e92b5aae3ad5e974b2e76f7db5fb5081b88c096a00a65783c6a36628e", "structural_hash": "1fc0bd536e239e65fdc2759ea7d35ff0a0881f690fecf4a41ad854859d81d68d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04244.sh", "upstream_id": "BenchmarkTest04244", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n data=\"${user_input:-default}\"\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"audit actor=$data action=session_revoke result=ok\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d55547484d80730f965dfae39a46ea5a431dbf313bf45e64250cd39b6e07154", "structural_hash": "6e32946fb8240fd0ed9431b9b905101b844415a97879c1de8e03b46a734f5bc9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00411.py", "upstream_id": "BenchmarkTest00411", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n if cookie_value:\n data = cookie_value\n else:\n data = ''\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n with open('output.csv', 'a') as fh:\n fh.write(str(processed) + ',data\\n')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "820e6964047ccb6ee5209713a8ed9f87c5a9258cc02b0184f1efc53b0a4f22a8", "structural_hash": "48fac815c180989acbde3cfef478e10d518708f503a5a186d9cb18f5ab9537e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05761.c", "upstream_id": "BenchmarkTest05761", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23d54c373dbe33c6641ee77be41c2057e8ebe8b077a9f41be6e34530485bbcc1", "structural_hash": "8113689a1bd454b3a6b835bf627d23645525ec67e1605564fbc8995417f66caa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20821.c", "upstream_id": "BenchmarkTest20821", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n const char *safe = data;\n if (strcmp(data, \"config.json\") != 0 && strcmp(data, \"data.csv\") != 0) safe = \"config.json\";\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", safe);\n remove(_path);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6e22a2d7edeca88ee60bb489ac91a24f52c2c3c4728ef7f613c586ea4331f9b", "structural_hash": "38631a1a2d08ef53d98ea5e4585e5a9e617ef33f2379dba8907697732e740415", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01096.cpp", "upstream_id": "BenchmarkTest01096", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string safe = (data == \"/bin/echo\" || data == \"/bin/cat\") ? data : std::string(\"/bin/echo\");\n std::system(safe.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69428c033eff12b3f44eac4b85165a63f1e8d4815e0256bc81780f768629b6e6", "structural_hash": "c3ef8684c24e98efa0d25d498f6edf5dada642b6bf06cd843cc269973593c7ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02599.go", "upstream_id": "BenchmarkTest02599", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar _b strings.Builder\n\t_b.WriteString(rawBody)\n\tdata := _b.String()\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db7f5bbd677a458c2ad91ee41172aa32bde7a3ba7f735b0fa99f8e9621ba0d47", "structural_hash": "e8110d22900476ca568c16424976bc187c6bf3555de61b4cee0c052765a03a95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02663.sh", "upstream_id": "BenchmarkTest02663", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n IFS=\",\" read -r -a values <<< \"$processed\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "933c4484d21ab74e9ce09d487bc811a845fe1caefbc5aa04efe8619a04f7c1dc", "structural_hash": "e85332fffb92b8b43de898ca370e0172a7342397766d2d821f09b78e53eaf07f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02412.rb", "upstream_id": "BenchmarkTest02412", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab70795846628a16284b53f7b331842476f7d00365b7da3e3db7c53aa0b18c59", "structural_hash": "955b5f9d3d87b91aec2813cf37ed73b4261a159f54791b53083ab4eb407324c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03893.rs", "upstream_id": "BenchmarkTest03893", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut pending: std::collections::VecDeque = graphql_var.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aacb081043eca981488cda3463b859a1d2e8d54dc941bf770c18795855ab1486", "structural_hash": "8fbaf310a5d15bbda2574da204c923427bf2d8a62e266f2d340da092fcfd71e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17138.sh", "upstream_id": "BenchmarkTest17138", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n chmod 777 \"/var/app/data/$user_input\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85433a4fbbef2c82a7814b3383a0216ec57aedfcd12e83816e5a4a27c94a1daa", "structural_hash": "00cc9824b7b7a4f756742d4d292e412cf962caae4a32a26d530780b494ad1677", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01436.cpp", "upstream_id": "BenchmarkTest01436", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data = std::string(\"prefix-\") + user_input;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c5694a46ab31f66b974d84d55fd67b67758f80523b40073c48373fcc065aa8c8", "structural_hash": "dbec87d520ec033d21af8262ca888b76fee814e91589b40d315e4282832f7475", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03822.java", "upstream_id": "BenchmarkTest03822", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String prefix = commentValue.length() > 0 ? commentValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = commentValue.toLowerCase(); break;\n case \"f\": data = commentValue.toUpperCase(); break;\n default: data = commentValue.strip(); break;\n }\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n dbf.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n dbf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);\n dbf.setExpandEntityReferences(false);\n dbf.newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11325ea5195b92f730424eeffceb1e9ff09327ee0ccb06a782fd9f5ac9c80de9", "structural_hash": "1459b5694e87e4608cbb5bf1826652f6567bf0f71416ffb8cf51fba71c297c48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04391.java", "upstream_id": "BenchmarkTest04391", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + uploadName;\n String data = valueSupplier.get();\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3709813ffc82e9f1f389b7bd4afe5c951e38e098fd6e38af91898f2108896cc", "structural_hash": "a9cd97ef6b16efc06395aca8e59fdebe47a86cdfc019f7d04c74d0d9789ccc64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01316.ts", "upstream_id": "BenchmarkTest01316", "language": "typescript", "code": "import { Body, Controller, Post, Req, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Req() req: Request): Promise {\n const userInput = dto.payload;\n const data = await Promise.resolve(userInput).then(String);\n const role = String(data);\n if (role === 'admin') { return {role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbcb1e29d78557f362c0a5d55792f51924d5741eff1fbba50da6d39d9526e492", "structural_hash": "799c8f446ee891587915005bcb93210c6e0dc4439c3d5e5ec13357adf066a1b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02394.rs", "upstream_id": "BenchmarkTest02394", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let _prefix: String = db_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => db_value.to_lowercase(),\n \"f\" => db_value.to_uppercase(),\n _ => db_value.trim().to_string(),\n };\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a213cd651d9daf8eb781e9d449b80830fe34efb39f93ac84b24a136cf20d3311", "structural_hash": "5c76c2b48dd43142cc90a3ab71bce8b8191a38127235c5299c815a890c83e521", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01756.cpp", "upstream_id": "BenchmarkTest01756", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", user_input.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b052cb8bf2edaa06a7fcd5ac155848b12fed05a1b481d181c5d23932c980105c", "structural_hash": "bf603b4ea08f11439fc8c5ddcf334e9b9aa65730b7860a853e9834db078bb0bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00396.ts", "upstream_id": "BenchmarkTest00396", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { res.status(403).json({error:\"forbidden\"}); return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d20aed43820e59f884fc849f9afbc7dba200ceb25780c6ea10884a75d4af0449", "structural_hash": "ef8cbf352db441d152a76c4d800fc0f146d3e777132aa652c8dfb63d29793cf9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07478.js", "upstream_id": "BenchmarkTest07478", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = Buffer.from(userInput, \"utf-8\").toString();\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "917b9f6a287099e4118306e00a89f4cbe50e45377e692884f429e433e09033c0", "structural_hash": "70a9cc954167aa864a2f5987fb8c69725f634c374a9ea6c62438d967a421c191", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01956.rs", "upstream_id": "BenchmarkTest01956", "language": "rust", "code": "use axum::extract::Path;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(Path(path_id): Path) -> impl IntoResponse {\n let path_value = path_id.clone();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(path_value.clone(), |s| s.trim().to_string());\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9877c0a5c0c5f0b9a9b7febfb1576e86f538e64b4feec92d395aac525c08846", "structural_hash": "f9d39d6bacaf4c964374d0198ee5c0164a96bbc72a6cf7efd60701e0050997fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06460.js", "upstream_id": "BenchmarkTest06460", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const data = \"\" + userInput;\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-201"], "category": "sensitive_info_sent", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "add8300a6e12c5d01f262ba4cd970eed94c66c7452485a67a119c64ffa8d555f", "structural_hash": "cdbc536e4c01d67585a863b86d8a75e69f2bc0ea2dde2e39822375a07cc743a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00915.py", "upstream_id": "BenchmarkTest00915", "language": "python", "code": "import os\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n env_value = os.environ.get('USER_INPUT', '')\n data = env_value if env_value else 'default'\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n if result is None:\n return jsonify({'error': 'not found'}), 404\n value = result['name']\n return jsonify({'name': str(value)}), 200", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7de31310525a8dc4ed18fc4c7b4deb25931c873229e007074e0a90bd9c98848", "structural_hash": "ec0f687016b1cd6e451ac89f7f65807f9cc4c0ba8a351feb6badc6c06df37176", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_16182.go", "upstream_id": "BenchmarkTest16182", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(headerValue)\n\t}()\n\tdata := <-resultCh\n\tvar u struct {\n\t\tID int\n\t\tName string\n\t}\n\tif err := DB.QueryRow(\"SELECT id, name FROM users WHERE id = ?\", data).Scan(&u.ID, &u.Name); err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9270b5b069b0d70e35cb94f9605a9fdc403e9eadcfbe36fd2008b7fcdf5f554", "structural_hash": "13666ef1e19a90de10ba49c67e067965af4359991a5d984b32739950728bc1f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19031.go", "upstream_id": "BenchmarkTest19031", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tform := FormData{Payload: uploadName}\n\tdata := form.Payload\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\tpanic(\"generic error\")\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06fbec25ba5afeb0e6ce3ba980397d082b7754931aa1b8cd7fd24c03719c180d", "structural_hash": "5cfbbd5ea13d67955d3502014320e39e252c9644622eda15fb907a9512d4e606", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02934.rs", "upstream_id": "BenchmarkTest02934", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = header_value.to_string();\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3f95f075ec6f156b70a641309f1d9cf117e21653d7c78418e65e46e5e874cee", "structural_hash": "1f78369c5970e68d49629bcdda73febf9c1dc21a2e0177bf3aa5d7e96726e422", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02302.php", "upstream_id": "BenchmarkTest02302", "language": "php", "code": "headers->get('Origin', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $resp = new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n $resp->headers->set('X-Frame-Options', 'DENY');\n $resp->headers->set('Content-Security-Policy', \"frame-ancestors 'none'\");\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20ec406e249d217e64bb10c289e253f591a337675d2e3b3aa1918c6fcea8221a", "structural_hash": "f68ba1afec9531c506289663f31d1216631810f966eb89542aff8dac02094178", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02914.java", "upstream_id": "BenchmarkTest02914", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n String data = envValue.isEmpty() ? \"default\" : envValue;\n String fetched;\n try (java.sql.PreparedStatement ps = connection.prepareStatement(\"SELECT name FROM users WHERE id = ?\")) {\n ps.setString(1, data);\n try (java.sql.ResultSet rs = ps.executeQuery()) {\n fetched = rs.next() ? rs.getString(\"name\") : null;\n }\n }\n response.setHeader(\"X-Name-Length\", String.valueOf(fetched.length()));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7baf3865084f486eac90b273deabb114d9bf568b847cb997766751136957d25b", "structural_hash": "bf4dec7ff9a9df4cb5b411f3408ce4372ac220142aa701b44ed3d016039f5184", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06674.go", "upstream_id": "BenchmarkTest06674", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"sync\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvar data string\n\tif fieldValue != \"\" {\n\t\tdata = fieldValue\n\t}\n\tvar secretCache sync.Map\n\tsecretCache.Store(\"current\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"stored\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_memory", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02ed79a96ac1152c1dc6d0bd24c7841c8b9ee4d49ef560e7da4d08ccc8237fef", "structural_hash": "665d2b300f5b397681d30430092cdda92a5fa0b6b7fb988cc1084c94ddc3bc9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04110.go", "upstream_id": "BenchmarkTest04110", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", cookieValue)\n\tdata := _sb.String()\n\tc.Redirect(http.StatusFound, data)\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55e0a30ec2829def96aef9adf5d77268f85e5eee39a7e7ece9edeba2c5271afc", "structural_hash": "3f15cebb8bbc8e492c002cfcea028d3cd284fa85415c2aed5a6891b337b87b15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03838.rb", "upstream_id": "BenchmarkTest03838", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7570a6ab4c1f0e00e5142224b7bf57339b3098354c70f0fb67e8aa5c4a7e897", "structural_hash": "5f235725912ae65d50da133ac7569e39a20aad8c4ac5c61254ecb2b157ae93f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02476.rs", "upstream_id": "BenchmarkTest02476", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(raw_body.clone());\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n use sha2::Digest;\n let _digest = format!(\"{:x}\", sha2::Sha256::digest(_body.as_bytes()));\n let _expected = std::env::var(\"FEED_SHA256\").unwrap_or_default();\n if _digest != _expected { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92522356a5496dd276738bb78fd6faba0c8d1f247facf791d425f55334c233f4", "structural_hash": "58851649d46197da2f989a2bf1d1cb5a2abd74268f0992c443ca1873fc48d9c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05229.sh", "upstream_id": "BenchmarkTest05229", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n mongosh --eval \"db.users.find({name: '$data'})\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6cb45f12ffe6a44395967923d33302d26bf9939e5cb0f320667d0952cffa7507", "structural_hash": "03145db13958b050326f7e05e2fce98c1ab82aa0d258297aa6c033921a8e3b00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04684.php", "upstream_id": "BenchmarkTest04684", "language": "php", "code": "input('multipart_field', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1bf0aa59bfaff7234ff0e13aebe39dc20f52de0243844d8c5e58d4279095892d", "structural_hash": "41401d0ecc080f7c6480d2fb6b1a543af03426e4d612be56fa200c6adf24c4a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04750.java", "upstream_id": "BenchmarkTest04750", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String data = normalize(uaValue);\n response.setHeader(\"X-Forwarded-For\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4dddffbe10fe508e4f79fc3f16461b25796ed31f902e9b018bbee781074c185a", "structural_hash": "34defe07fb3ce420f52b9c371613016964ba09fc276504c460ecb68c932303fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03083.js", "upstream_id": "BenchmarkTest03083", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-565"], "category": "cookie_no_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "caa13b066f2687a2f41a3daa62ef1af704200ca89f2fff5a60c0712101c393a2", "structural_hash": "a8a4d0e74b0ca8a3d575667e5e14ca3834a9b71f8eab6a9634ce744eca95b877", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01236.sh", "upstream_id": "BenchmarkTest01236", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n echo \"data\" > \"/var/uploads/$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4a80a5e254b2caa44aeb4a8280f1c40d883dc5a78042491ae04a5339177f074", "structural_hash": "a49e1a6baf6491621190b4e615da4ec69edf7e1115ae94adb08536610719c2aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00926.py", "upstream_id": "BenchmarkTest00926", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\nimport json\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n graphql_var = json.loads((await request.body()).decode()).get('variables', {}).get('input', '')\n data = '{}'.format(graphql_var)\n return HTMLResponse(Template(data).render())", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eed87c6c9a513ddf5206178456e96e4f7de69104c58cfa57903a1808d3a8803e", "structural_hash": "d250f5a778c779c134c019fbeabdd19c16adac03684db2a57be5a48289686504", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02935.sh", "upstream_id": "BenchmarkTest02935", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n eval \"cat \\\"/etc/app/private/$data\\\"\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c140e2a7509bfd0d32b80640087f212ea6ac8d34f76d7d6a17274db38914ec19", "structural_hash": "3240b5f74967d0935942e640003e64c365ec2d3c78fbd7760e0cc0691a456364", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00885.py", "upstream_id": "BenchmarkTest00885", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom lxml import etree\nimport re\nfrom starlette.responses import JSONResponse\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n reader = make_reader(multipart_value)\n data = reader()\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbb945a8c9f7c8cf14b3938fb8c17505ebcd78ef18ff44390c1935329838cc4e", "structural_hash": "313da8bc0c69edab93e0a367e5dc54580f3480c1b58b005feba8401a4aa81a30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04557.rs", "upstream_id": "BenchmarkTest04557", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(comment_value.clone());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e6b836088b1ad9f56fc3c0b691deb582111ab762a11933ab73702b078498ea6", "structural_hash": "d047a30d719b3c93f976fa65948db6dd66efc4f78a50fc5a7e5e757a949ba140", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_39079.js", "upstream_id": "BenchmarkTest39079", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n ctx.session.id = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2a961a1539f57d67a754305c60a7869efdce7d5cb3712f49bcb413f271e5734", "structural_hash": "d0e295baa55013eb8fbd402edc0d7d165196e95978ebe42867e7552cff932a9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04880.rs", "upstream_id": "BenchmarkTest04880", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data = xml_value.replace(\"\\t\", \" \");\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f88b966d47f1b164e795ff97cb43f8290bb1e9612d0fce5668a7630294ecb552", "structural_hash": "334e3f575fa890f8009b8863c0b5aac06007ecf6fc7973fb9936a30ba8637ade", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10727.sh", "upstream_id": "BenchmarkTest10727", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n exec 9>/tmp/app.lock\n flock 9\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79519e72d2106d9979b93ecb3efe3f8cd98d4d0856dfab3b100fab407b8e111f", "structural_hash": "89224c081f44c4000a8d4b214e9844ca16beba232ea4d0e38c2116df736391e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37005.go", "upstream_id": "BenchmarkTest37005", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := fmt.Sprintf(\"%s\", authHeader)\n\tpassword := data\n\tif len(password) >= 4 {\n\t\tDB.Exec(\"UPDATE users SET password = ? WHERE id = 1\", password)\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-521"], "category": "weak_password_req", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "519160f26ffed82fd919132dd945e0d3274b53dc8fd3e2bba7c80feab390cac7", "structural_hash": "716b0535190785d734de17dfe5a9dface13d1ef5dfd83397af0a6d20098cd3ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14203.sh", "upstream_id": "BenchmarkTest14203", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n _primary() {\n cat \"$data\"\n }\n fn=\"_primary\"\n $fn\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ffbbf9aba14ae388e928df6b64fe786dcf6241909adc8483ae5eba24a8ad96a", "structural_hash": "666fe5e92514a88d3c7ef696887d918b2ea2f180f1aa6a360100f6e142bda178", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12162.c", "upstream_id": "BenchmarkTest12162", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_passthrough(user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n }\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "090014a7721f9d168b5ed17ba66df11f42488ae4f7d6cf2ca1e24763f6de37d3", "structural_hash": "36e7bd7d3b0ebb1f4cb059ce5d297d8813ae8ac0b117accae1442c75b44f58fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05518.rb", "upstream_id": "BenchmarkTest05518", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n render json: { wrapped: wrapped }\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93c9fd78d9938376825b173eeb6156cee4651996949ae1d6f4746abd7c57c025", "structural_hash": "95858ddcc4e2c2629d01a28befe14f15d3cd14aeeee456b8971c8a5cd6f1dd02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21995.c", "upstream_id": "BenchmarkTest21995", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n printf(\"%s\\n\", _p);\n}", "label": 0, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "115e076d32d290f6f399229acf09c405986780638bcf21f2e819bb622b5ec263", "structural_hash": "3c1792147c728d4aee4e77908c24785522a4f0a1f5f65aaf9921a265507a5a19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03517.cpp", "upstream_id": "BenchmarkTest03517", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) return;\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8aeb04f57042d4a642028f8e0bf8058b318245fbb0f98db1d8c2c9a5a447857f", "structural_hash": "bf7e1267aaa378d2073d46dabdb066123cb1f424a7b147a81f5e60350a3f42ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01162.rs", "upstream_id": "BenchmarkTest01162", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let mut data = String::new();\n data.push_str(&raw_body);\n log::info!(\"User action: {}\", data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06c48d498882f5ae380c4612ee6d73c5c15c4f0a7a25febd8267f7b9b746ae7d", "structural_hash": "8d602083953b2e05f1ddfee6d9babef73b9e566313aeceaf6d10eb5d3759301e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_21357.go", "upstream_id": "BenchmarkTest21357", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tcapture := func() string { return rawBody }\n\tdata := capture()\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91c9b2654f1eac81f87cb3ea44f9e3b2daec09fcd6d20493f275b71f4dd3dbc5", "structural_hash": "76f8925fd4050897bf422723211dbcb222d0ac40afd7723b839866686a747ccc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14627.js", "upstream_id": "BenchmarkTest14627", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-336"], "category": "same_seed_prng", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "612993b0368b9a6308a48ef5ab869788a40f0b045b6344fe4e44fd8c487d4b59", "structural_hash": "0dfa889a039dc288518a9a2cebd1169205c9c65884dd6f5c1477e449285edc72", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11578.js", "upstream_id": "BenchmarkTest11578", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(processed)]);\n res.json({ updated: true }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f47bf656faa96728ef8d094946354819106de1346649709212ce2923bb96bde", "structural_hash": "aa6a9cdda5fdfb1f951eb14ce99497ce2ca85b584b47fdb1d32852bfe2cea227", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19360.sh", "upstream_id": "BenchmarkTest19360", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n rm -f $processed\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31369a748bd8ebf259c9b18c77a6861f7824bef8fc3b97687888fb8b40544eec", "structural_hash": "c2d8c2a00fe44947efdb3d6c3dab03100d824d60d6d805b33fc83c6a8e665a9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05797.java", "upstream_id": "BenchmarkTest05797", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.Map.Entry entry = java.util.Map.entry(pathValue, \"cookie\");\n response.setHeader(\"X-Tuple-Context\", entry.getValue());\n String data = entry.getKey();\n com.fasterxml.jackson.databind.ObjectMapper safeMapper = new com.fasterxml.jackson.databind.ObjectMapper();\n String deserialized = safeMapper.readValue(data.getBytes(java.nio.charset.StandardCharsets.UTF_8), String.class);\n return Response.ok(deserialized, MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b69bdc817353217a084762608ce95c3150787be92e9f260c6603f77a6e04ca0", "structural_hash": "a0702c844ee73ef4e1d9ee741f790f644fd8beb4f613e78343ee0a20c42fde78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04098.py", "upstream_id": "BenchmarkTest04098", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport json\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = json.loads(raw_body).get('value', '')\n return HttpResponse(mark_safe('
    ' + str(data) + '
    '))", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac5e33c37b9a18cc899ab75b2a202e01b8cee6fc1989d958f9084af04f6e8603", "structural_hash": "46949a50bac0ac9382c759c8a227aac6487ab27ab5a14063da77b72daf56cfcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03338.cpp", "upstream_id": "BenchmarkTest03338", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && user_input == _exp) std::cout << \"authenticated\" << std::endl;\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4807397c4e9eb72cd1a5d1c6312ed356ec4878b0c36213233f1c01a54cfc4dee", "structural_hash": "dbf1880cd97ae4110e68b141365b6842974bd03564aabe3ca71e89833c7534ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05813.java", "upstream_id": "BenchmarkTest05813", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.Map.Entry kv = java.util.Map.entry(commentValue, \"cookie\");\n response.setHeader(\"X-Tuple-Context\", kv.getValue());\n String data = kv.getKey();\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { response.sendError(502); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b7ff50bceafa8a2ed1ad8f8fb680c04fc044b74223deb55b4a36ae97510d834", "structural_hash": "fc330cadedd9439c3e4d594fa1628b88c57ac510d169c4dcd6c11bb44d543a4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05503.java", "upstream_id": "BenchmarkTest05503", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = jsonValue.replace(\"\\u0000\", \"\");\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35fbaa0798a961b1cdd648e7f0dfef68d8facc034a6ce1a82ac4a680a26d2b4e", "structural_hash": "c16109c3b642dc6ba33bb441897cdeab4d888df3f898216616a1db7205b04476", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06086.sh", "upstream_id": "BenchmarkTest06086", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00bd284fabe8fa5313f064155f181a923a79f56b00f1bfaf9ff680816f7ac602", "structural_hash": "36fa07f93545a188bbd0c45f78ea89e2e38d6f5a90c45e715667950430342765", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05637.php", "upstream_id": "BenchmarkTest05637", "language": "php", "code": "getContent();\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae2ca155793941744d8f2dd21fa2a81a3c0f45901aa4118aa009f6a847612a99", "structural_hash": "f40549d3b64abec31cfba7f2ad43df5e44807e85f55bbfb8a0dec65c466f4448", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_02487.js", "upstream_id": "BenchmarkTest02487", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n if (process.env.NODE_ENV !== \"test\") {\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4896d474ab87f2ddbc3b4e7707b34a306f98547fd06286ede7b7cf6fe143678a", "structural_hash": "85af60e4ceb7c758a9019c12b988800a0cf201550c11a7f54fbccc34913f8ff7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05361.rs", "upstream_id": "BenchmarkTest05361", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let _prefix: String = upload_name.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => upload_name.to_lowercase(),\n \"f\" => upload_name.to_uppercase(),\n _ => upload_name.trim().to_string(),\n };\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8379d89c0c6db684185f97cd9c7ce6942854a4d50508824811c20a0e4bc46f31", "structural_hash": "2ce8fc65dfb2e86bc58297ca3549ad655259e0422dc61e70a46fb582a64c634d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27318.sh", "upstream_id": "BenchmarkTest27318", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n printf \"%s\" \"$data\" | sha256sum | cut -d\" \" -f1 > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c33caad7b0eee3edecfaf66a30b620b61d4538e5015739e00637c7ce8ee98318", "structural_hash": "df027b7faf80255dd42feae7efd64d03246ec1791ccf532067908d7fe12e4f2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05773.rs", "upstream_id": "BenchmarkTest05773", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse tokio::process::Command;\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = urlencoding::decode(&user_id).unwrap_or_default().to_string();\n Command::new(\"echo\").arg(&data).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6721136b9f3fa6b7d6d5c5b7d89d0ad914fb59ed87c46fb678ce18d55ec30237", "structural_hash": "43036805f67d639873c9cc91993b4ae1fd6ae91406ed920acc48e99d85abadc8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05723.ts", "upstream_id": "BenchmarkTest05723", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { res.status(400).json({ error: \"out of range\" }); return; }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f127121040c1acb581d0ff8326154794f973454b3912b47124ee2014856382c", "structural_hash": "178963ef6e110e742289c21c6d27a01707fe321c454505a988e33c98453aefec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04761.py", "upstream_id": "BenchmarkTest04761", "language": "python", "code": "from django.http import JsonResponse\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n reader = make_reader(xml_value)\n data = reader()\n if request.session.get('user') is None:\n return JsonResponse({'error': 'unauthorized'}, status=401)\n request.session.cycle_key()\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22c90c79523a72e2e355eedcb0b1774dda5e6e52950b08e9ab3f3c186ce38b7c", "structural_hash": "e7a42c41b95f5b1c9c77bba614a43a097da2dc70240677c71cff138c8375cf81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04789.ts", "upstream_id": "BenchmarkTest04789", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n JSON.parse(data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b372aa4c811cefbadbbfc84e32222bbed595c2c529060b4d827bb393bb596e6", "structural_hash": "e26824cd35be65c164a3e53341176638f8a08e40d4651f184dfa0ccefec8a3d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00332.rs", "upstream_id": "BenchmarkTest00332", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let (payload, _origin) = (env_value.clone(), \"http\");\n let data = payload;\n crate::shared::db_query(&format!(\"SELECT * FROM `{}`\", data.replace('`', \"\")));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4417adf5d6088042154808e2c4513204f1a9596f772c4c9a188aefaa1e493dc1", "structural_hash": "de3c582f494592f2e9ff8725caee7edfc2069c6f708af85b2746ebcda10acc36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01313.rs", "upstream_id": "BenchmarkTest01313", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = multipart_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efdafdb75526c633ca541ce03ed00157d8dc9ae864211315cfd9626627ab5bdd", "structural_hash": "f614b7bec990c74d1ede7100f4f40ca6ed1ddb9d09f5daacdf21082d6812e841", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00219.rs", "upstream_id": "BenchmarkTest00219", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let data: String = cookie_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| cookie_value.clone());\n let processed = data.parse::().unwrap_or(0).clamp(0, 2147483647).to_string();\n let requested: i64 = processed.parse().unwrap_or(0);\n let count = requested.clamp(0, 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "863294786266fc3896fc7a5a54897982fc459771bf6446c81d05a6f1ea70a7d1", "structural_hash": "6fe346732c9c359442a80f198fc837ef97d5e73e6aa0bab39674c793398c7fff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01398.py", "upstream_id": "BenchmarkTest01398", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n upload_name = request.FILES['upload'].name\n kind = 'json' if str(upload_name).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(upload_name).strip()\n case _:\n data = str(upload_name)\n if data not in ('asc', 'desc', 'name', 'created'):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n eval(str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a49fdaca6ed2b48d3c7f2ec6ed6cc024c4c665d75a551e6b897649e4866d17c", "structural_hash": "0350b04f979dddbd577ca7997f72d6f776e60b0c3680ce26c36c81b91e4c732f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05287.rs", "upstream_id": "BenchmarkTest05287", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(env_value.clone());\n let store_cred = std::env::var(\"APP_SECRET\").unwrap_or_default();\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1963d66f1bb2604956263ab2bb0b11a599cdc653408e5242d4cbbe89b0e732c", "structural_hash": "f1387035c08722d5a6915db129ec6eb4ed72a496a17a5e8c97646b36cd62cced", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03978.js", "upstream_id": "BenchmarkTest03978", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-807"], "category": "untrusted_security_decision", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16e8455f429ca717ec88df88156e2eaa0649767efafe2c5ee07318f18edb800c", "structural_hash": "1cb4ccee7e9a568e5e6ab49c7e1e42af386c63c1789b813bd04f28737804d87b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00502.ts", "upstream_id": "BenchmarkTest00502", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, BadRequestException } from \"@nestjs/common\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n eval(processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a60e07e840eb60a925625cfe3e89c0618622a249ff64722ff579c69091fbe8a0", "structural_hash": "336de3d49fe9bba3176a6738a250f8fdc31e06553aaba65b3e5cd5beeed25678", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04909.ts", "upstream_id": "BenchmarkTest04909", "language": "typescript", "code": "import { Controller, Headers, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = xff || \"\";\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(userInput)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = userInput;\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(processed)]);\n res.json({ updated: true }); return;\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01af0313b436cb2119b3f9f56838dca79d62b453756f189918720cf87d0962fe", "structural_hash": "8a4832af309bb6976771e3fe9afedc2643cb7e418e2556603ed35717adb2a8e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13090.c", "upstream_id": "BenchmarkTest13090", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n long _v = strtol(data, NULL, 10);\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 1, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "007ef97d23a191667fb316e5d8c01efa651a66349f04b2b99796acbe38bba529", "structural_hash": "025cfb5caaf52b442b9abb96ae1ff422e0cdc2efbe0a943887368e2680fbb155", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02497.sh", "upstream_id": "BenchmarkTest02497", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"${user_input//$'\\x00'/}\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7834b8c1ffae2744de59904a30e63430ee062d171fb1a5cc1a84b848d26ed8e9", "structural_hash": "8073256d7720fefab1524506edbc7eee594f21a56a6ee2c4a981a12dc56cd2c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01316.java", "upstream_id": "BenchmarkTest01316", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = fieldValue.replace(\"\\u0000\", \"\");\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { return Response.status(403).build(); }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n response.sendRedirect(targetUrl);\n return Response.ok().build();\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08b5582cd9ad7cb380a496b6b221aba2a7139d7fc0ff5c13c7a2eefa2b91b050", "structural_hash": "d8f7ad7c7e7cbcb722f4a8a4ef8cae024eb7ec93bc68a303e0a02ec0e3ba9d3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00048.py", "upstream_id": "BenchmarkTest00048", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n data = handle(env_value)\n if len(str(data)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfbeb76cb0ef12ecd9e9be1133a5f31a796ae43512905dca685ad7c92056cefe", "structural_hash": "cea6e77d9bd91ea75d9fadca57524f7019dbc0be7604072512e410844a63b033", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03623.rb", "upstream_id": "BenchmarkTest03623", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n unless session[:role] == \"admin\"\n render json: { error: \"forbidden\" }, status: 403\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "541a591a333203f08bd3e45788e80044bd07e8592768b884ccb5437b7bbfed93", "structural_hash": "150788cd51ae84f66bb5f6b4d38bcb91941fc739957b8186fa7183a2ec49a776", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00237.js", "upstream_id": "BenchmarkTest00237", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82c0e1098532745e3b3e2ca2ab3f11902b1c50f0e8c0ad5c8ddce20e7f0507a9", "structural_hash": "e0af8bbb301358ddd2809ad5528df1818e1b5c55ab8bcb0f43d47ab1b0f169de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03501.cpp", "upstream_id": "BenchmarkTest03501", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b56bdd2d7a04b5d4aa48818cbdbd580b64e716e5401d84a70b69d3cd5af9d8e", "structural_hash": "0c89f42e3205754c5f06c04daaaa28f98b0d8e91424ee307e2a834246344bc21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10954.go", "upstream_id": "BenchmarkTest10954", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := func(v string) string { return strings.TrimSpace(v) }(rawBody)\n\tparts := strings.SplitN(data, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 1, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab1730050c349488f59549afc8c8b48ba59942bfe7799f8549761f147ef2fd46", "structural_hash": "8fdeb1cea67d08ed835f335c1e28d565760dddc331e55f64c386f2b8fb633432", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00221.rs", "upstream_id": "BenchmarkTest00221", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(raw_body.clone());\n if ![\"ls\", \"cat\", \"date\", \"whoami\"].contains(&data.as_str()) { return HttpResponse::Forbidden().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8775338f8a6eacd0b5e16f499012a2c71452ef3d83a1997a9f601e65f606455a", "structural_hash": "d0b44283b571e99ac6c44bdb281dbab5aefcc87017ef10374fb85de4a690da4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02183.rs", "upstream_id": "BenchmarkTest02183", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = [\"s3cr3t_key_test_xyz\"][0].to_string();\n let data = secret_value.to_string();\n let _ct = crate::shared::encrypt_with_key(&data, \"sensitive-data\");\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7308d0b9ea03663208f03b3a8727c77bf9f04f94ac980debdfe9f6fc9da207f", "structural_hash": "814126d5c0a6f41cb86951b06e96774cfeb5c94ab04956b673438832a73f4431", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03834.ts", "upstream_id": "BenchmarkTest03834", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n db.query(\"SELECT * FROM users WHERE id = ?\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbcdbc71144a6f3678e8ae6592bcf8a12f316805d97c45dfe84ae39e322e9e91", "structural_hash": "797bdd79b49d267cc709bc5db5f10ce5bfcdb69286e771db173cd8603ef691b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05014.php", "upstream_id": "BenchmarkTest05014", "language": "php", "code": "getContent();\n $data = str_replace(\"\\0\", '', $userInput);\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ff66f849631f5ee34d6a390518c48bb6a809c4b19b4d08c22ee1911d6d184f9", "structural_hash": "f84fcb7a076392cbbde723c4a0fecaac0333d7b308ac7838277ab4dc80ec7e09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05522.py", "upstream_id": "BenchmarkTest05522", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n reader = make_reader(header_value)\n data = reader()\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a008cac2a06085ebb7827cecc2548b640ad02bd2c0cd5addc8605562213b5a3", "structural_hash": "53cbcefdae1dfaaff3293fda0fd28f2855685720a6051b1e4fbdcaf8a69f7698", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03535.java", "upstream_id": "BenchmarkTest03535", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = userId.isEmpty() ? \"default\" : userId;\n int requested = Integer.parseInt(data);\n int allocSize = requested + 1;\n response.setHeader(\"X-Alloc-Size\", String.valueOf(allocSize));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9523c284153d0c077515b0d12b024703d6632d4f45f791fde1dc861326665afd", "structural_hash": "520fd483a935c83c5630e8d2a5817b2d5ff42e810c290798db9001eef1bf75ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33514.sh", "upstream_id": "BenchmarkTest33514", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n case $data in /bin/echo|/bin/cat|/usr/bin/id) allowed_bin=$data;; *) echo \"forbidden binary\" >&2; exit 1;; esac\n eval \"$allowed_bin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb49942d95eee9fc667832a3cc518a80d9cca04d20c95a1305481aca77a01dcd", "structural_hash": "5a0c2eda7abb05d5f3920fd21e7217ba1d0476ad7544fa4b5ee63700815209b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03640.go", "upstream_id": "BenchmarkTest03640", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"golang.org/x/text/unicode/norm\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tdata := originValue\n\tif _, after, ok := strings.Cut(originValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tnormalized := norm.NFKC.String(data)\n\thtmlBody := \"

    \" + normalized + \"

    \"\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tw.Write([]byte(htmlBody))\n}", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "446830a1cb7f02ed15c17074e59df77c9623410e8375997c0c14bf28c2c5c76e", "structural_hash": "aab79ea63b2a98a7b45c979cb143cddbb41cc320e95cce17946983f72a2d9dd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19029.js", "upstream_id": "BenchmarkTest19029", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n Buffer.alloc(parseInt(data, 10) || 0);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "028c9fa003494b69877e5331289d0d874eda6ef8341bc6f70cd2f522e0c24150", "structural_hash": "598e5b0a30e50ed4bc1c76a0dd9873e38f072229ebaa75adcb7483674d61c82e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05510.rb", "upstream_id": "BenchmarkTest05510", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n URI.open(data).read\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac5d289f0f310e7118846d14a58f53df515935cc25e061160c428735132610a3", "structural_hash": "756a709bc5bc1ee540b04beee8964efe2e3f57183ef1702eb79113088e3d20ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14616.sh", "upstream_id": "BenchmarkTest14616", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9f65cee9297f748f29476a6925b7a121bffd0871165a26f03aca060f4342df1", "structural_hash": "fe52bf60b3613262a6f25f70f649d8731d59923b89ddee63e0bdc672bf7b80f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02576.ts", "upstream_id": "BenchmarkTest02576", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n if (data !== req.session.csrfToken) { res.status(403).json({error: \"csrf mismatch\"}); return; }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8147c1725b3a7d8ec85ed3bae03d63ee8d68f9b6e21297f56f862110a529653", "structural_hash": "a9f9ef36d15c70d9956c6d8c6e43aa77af95b02ce94dce8fb4c0c421f1b88db7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03401.rb", "upstream_id": "BenchmarkTest03401", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"default_config_label\"\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f4b2a03939fb7a9b8037ca027823176838ea0fc22e15ff5b13ac16ec2a609f6", "structural_hash": "9740b058d6a44ba7efe0f9aaa456661a4aa8f09f3addc817bb7a0387ed9012f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02264.rs", "upstream_id": "BenchmarkTest02264", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", cookie_value).ok();\n log::info!(\"User action: {}\", data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de06e0aaa8d00d6f422e9a274e93e1fddc89d1f64b6f4dcf0fe4b5127499a1a1", "structural_hash": "f527fadfdb39c93cfbfbee70e2ab579b1df398d54e2c7b177e60a8a72b382d25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05740.c", "upstream_id": "BenchmarkTest05740", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n void *_h = dlopen(safe, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "152ceca7a444faeeb1e07dfce4980960bb0e45d590d835fac400df1be387f33b", "structural_hash": "9a2aa6c33e1f73d83eb5faa623af99fce1a8fa795b3d28a7c73043a2111070cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02237.py", "upstream_id": "BenchmarkTest02237", "language": "python", "code": "from flask import Flask, render_template_string\nimport re\nfrom flask import request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n data = f'{forwarded_ip!s}'\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n return render_template_string(processed)", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08a02ff43aca579fea38c3f147c4f62f840fa767933ff46a9eba5beaad6d81d4", "structural_hash": "724a309345b067d7a9c00637a3c2bb7431c2fbdb3d126c4502412aba94b4aa95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00639.py", "upstream_id": "BenchmarkTest00639", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n data = '%s' % str(auth_header)\n db.execute('SELECT * FROM users WHERE id = ?', (data,))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d575c39cb99787e50bb6b684648fe15ec7ea721a0934ecf289277068edcfcbe1", "structural_hash": "1c535d7ed5486c33d2fb5224f088aa6ef422c8b55baca053a386617866e76109", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17464.js", "upstream_id": "BenchmarkTest17464", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "282c0f3ff4721fd7f1e1491527fb7c4f5a8d4b343f712d72424435aadfc9675c", "structural_hash": "a5aed02d96b6c0f4315bcfc8ee078dedeb72bc33f23e12bab482cbd0bbf065fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04966.rb", "upstream_id": "BenchmarkTest04966", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + processed + \"']\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56666043472f27c24ea4b946697738fa3f8004650a5bef81ea54047c3e88ab1d", "structural_hash": "d4bde44826b6c651eefb75198f84a7c236605b18224bc9783988dd55d6cce06a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03865.py", "upstream_id": "BenchmarkTest03865", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\nimport hashlib\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = '{}'.format(field_value)\n _resp = requests.get(str(data))\n if hashlib.sha256(_resp.content).hexdigest() != _resp.headers.get('X-Content-SHA256'):\n return jsonify({'error': 'integrity check failed'}), 502\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01211d29edbf23d01d2b18b509740466b1b105e958a24de909786667a077b4a5", "structural_hash": "81dfeda4c5b2bc2489539fd910ff49e5ead8135a60dd2e5bbc9524a5e1d363e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01721.py", "upstream_id": "BenchmarkTest01721", "language": "python", "code": "from flask import Flask, request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = cookie_value if cookie_value else 'default'\n return '
    ' + str(data) + '
    '", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30d69a9077ac2efbe3e6ee58ddd6c472dad3a721fc70b466c19a266543f28811", "structural_hash": "2b3f1f16d26140e1e75cdab34e36f365c9328cce6ddfdf4b831aedb194085a5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00877.js", "upstream_id": "BenchmarkTest00877", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fffda10b9853cd552099a5ed7cef6d40216a82608558d1b2935bea969bb18ff9", "structural_hash": "5d01bbe8ae1e065fc4315c63cf5984f10df61864d6fcaa7c78220e9245fd7840", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25165.js", "upstream_id": "BenchmarkTest25165", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce6b8f556464d0dc74dbaef73b66678f88e57373d3532f1d3709c97940b212ac", "structural_hash": "aa6c9ef75ee34b21d68fbd3d7653e8cfb342baf335cca0ea6b2e9e3072c79a95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04524.php", "upstream_id": "BenchmarkTest04524", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc16d56f62a04b22f147dc8e227b752362da750b615e2233029996c0402585a5", "structural_hash": "e494189d8b84b081e331d3c4c20986ef6db5e3f208f2094f4de201094ce88131", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01713.php", "upstream_id": "BenchmarkTest01713", "language": "php", "code": "headers->get('Origin', '');\n $field = 'data';\n $$field = $userInput;\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3c385e0a1c8281b66147fabec8bd68962f41b4770343f2602d9b86f5316b151", "structural_hash": "dcf30ffabadcf7efa47d91b79b3f2bef996f3caee4bb3b03be972da8c73dfc83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17526.js", "upstream_id": "BenchmarkTest17526", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (!authCheck(data, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2419148e059b705b24605ee37a2b50d6884c4cb7c73211e114c440eaea5bb19", "structural_hash": "a1f0049caf85ed36b7c96405d4ebf4b47cbd04a0207667ed70ad281640e273f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18914.c", "upstream_id": "BenchmarkTest18914", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n free(_base);\n}", "label": 0, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3ad9373d79ebd9b082ec5e241d260a2bf98380e737e92ca5d280bed5196d360", "structural_hash": "250ece079b275faa7ec950c8ae3de062a3fb55a017c613764a8665b18959b15e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01507.rs", "upstream_id": "BenchmarkTest01507", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let mut pending: std::collections::VecDeque = xml_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a9d74910a2b0256957aae1511fe57eb302d2744a0b95ad489bde187b02e4cfb", "structural_hash": "21ceba3dcc31225adbeb60fd2b93858c718188f9961889b86c0b3e9d25068d67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07114.js", "upstream_id": "BenchmarkTest07114", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = Buffer.from(userInput, \"hex\").toString();\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94183b3125aac6be0152448c5c79405f032b0cd3c903a7f930a1f767cd331b48", "structural_hash": "f5e0eaa8741be22dfde1ecdd91466ceabbd8c7a2ddd9efd6af77deea7a29bc83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05680.rb", "upstream_id": "BenchmarkTest05680", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n trusted_claim = processed.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23aa4ee19f14c40dc7ad162d06b8d92842147a04b88552c61246d19ddccbd622", "structural_hash": "db69d2537e0f1ba90b927a033d1fc9d3267f9960cfb3a3ac3394c8334728c2e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02541.ts", "upstream_id": "BenchmarkTest02541", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc51156960e17a3bc350b696757b86f3b6daf37323298d4edcfb02c5d0113eaf", "structural_hash": "39367470caf81db22e86cac1c63e798e8e5f8cfe03aaa4d8d42f7b8e41b428ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01210.php", "upstream_id": "BenchmarkTest01210", "language": "php", "code": "request->get('multipart_field', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $request->getSession()->set('data', (string) $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "caa375949f0abc31ade1450b66543e4568873b354aefccab06a75a47c28cb40c", "structural_hash": "265e367c0e3cfd41e40651112b141aba77554eadc2a078e44c61a278d6a1a6bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05415.py", "upstream_id": "BenchmarkTest05415", "language": "python", "code": "from django.http import JsonResponse\nimport random\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n data = str(ua_value).replace('\\x00', '')\n random.seed(int(data) if str(data).isdigit() else 42)\n token = str(random.random())\n return JsonResponse({'token': str(token)}, status=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c630f81e7aae458fd6294c6f1b440dcb4ee9cd2bdfc88aeaa6bff506bae0b72e", "structural_hash": "59ce5ec6dcf8c1fe5e37244fb900c0714cd07a35a20698e907cdd05bac728267", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01181.cpp", "upstream_id": "BenchmarkTest01181", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff7a778ac68cab0485dd5f0966ef81ed516e76c99c4ffed43e2ec5a6ea038cb5", "structural_hash": "23fd967bcc7f86d137d1d7855a446c4cffb7ac4a4c9db0ea361449f2773a0be4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06050.go", "upstream_id": "BenchmarkTest06050", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tdata := BenchSvcPassthrough(headerValue)\n\tDB.Exec(\"UPDATE users SET name = ?\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "400353ddc0880c4cdc45c234e69828bbab34ca57c59af7aac2e762da25901e81", "structural_hash": "264730cd589d8978e0a2dfafafa1aac1b6a048dc722e3ec1cd27b1dd7bc0651b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02386.ts", "upstream_id": "BenchmarkTest02386", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n childProcess.execSync(\"echo \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d3b4a4afd62a02fcf63443e5b2d7ee515932971ceb5aba8e521156c146d3dda", "structural_hash": "30fe67edde3a1e2c358c2b201e15ccd89d253f78b4c2bd19780092899d60bebc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04756.rs", "upstream_id": "BenchmarkTest04756", "language": "rust", "code": "use axum::extract::Path;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse urlencoding;\npub async fn benchmark_case(Path(path_id): Path) -> impl IntoResponse {\n let path_value = path_id.clone();\n let data = urlencoding::decode(&path_value).unwrap_or_default().to_string();\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n use sha2::Digest;\n let _digest = format!(\"{:x}\", sha2::Sha256::digest(_body.as_bytes()));\n let _expected = std::env::var(\"FEED_SHA256\").unwrap_or_default();\n if _digest != _expected { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6612a3bffbc8a6d431e0c31b87282f112c73c3f4dfae848620d74090c84daa79", "structural_hash": "6cd63528d0f7c538240405655b9bfc6f385dcc8906cefdf76d74d796e77a0efd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01718.cpp", "upstream_id": "BenchmarkTest01718", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _doc = std::string(\"{\\\"field\\\":\\\"\") + user_input + \"\\\"}\";\n std::string::size_type _fs = _doc.find(\"\\\"field\\\":\\\"\") + 9;\n std::string::size_type _fe = _doc.find('\"', _fs);\n std::string data = _doc.substr(_fs, _fe - _fs);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9df12b7d5d4572ade6c6d4a98df0326f33437fe60f5a692179ce313fef2c0fa9", "structural_hash": "3dbdc8b192833aa3141230c6ca8fba3ba467b6f4efb74cdf995ea152127f6d69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_11511.go", "upstream_id": "BenchmarkTest11511", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tvar _b strings.Builder\n\t_b.WriteString(fieldValue)\n\tdata := _b.String()\n\tdefer func() {\n\t\trecover()\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 1, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e271acef82e84eb00d491f3ed5d725963dc34d81e6a5437224ab971203fc8f8b", "structural_hash": "c70889abc64ac70458948c3f8ab491120dba2d9fc128943f5796aed0b4d97ff7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03958.php", "upstream_id": "BenchmarkTest03958", "language": "php", "code": "json('payload', '');\n $data = ($userInput !== null) ? $userInput : '';\n return response(\\Illuminate\\Support\\Facades\\Blade::render($data))->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8256a3921bf9bb04c95ae61a72ca9f1ab8132f18172668370c84cfe2618a1ad5", "structural_hash": "3e4298898f38cd5a7832c257903e1c6c6a26530eed486181924c837b12fd57c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00108.java", "upstream_id": "BenchmarkTest00108", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { PUBLIC, INTERNAL, CONFIDENTIAL, RESTRICTED }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String data = String.join(\" \", uaValue.split(\"[ \\\\t]+\"));\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n response.getWriter().print(data + \",data\\n\");\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "083a543705fcd9325f48b6ce43ed0b4e85d2e9478b378cab50f3e45db9e58a32", "structural_hash": "eb86599e3cf9ec07f210b2bbb010da3b8487922cc900ff8eae7dc1498b312a5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04133.php", "upstream_id": "BenchmarkTest04133", "language": "php", "code": "cookies->get('session_token', '');\n throw new HttpException(500, $userInput);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d39b40817263b8f44083c517ca16ba504d1a76054e219b94b601281a7b7ad291", "structural_hash": "a295f4c1f74663ebe5c02db12e9c2a6b7028b6f458ab172785403b5178c7a087", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00649.php", "upstream_id": "BenchmarkTest00649", "language": "php", "code": "header('Authorization', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d85fd9d3fcc879c84f98fe456f8d8638e6c9bb077e11de15eddeca04f8c73513", "structural_hash": "988242a0d65669e275d5c20bdc53f2039e5f1cdd7028545a7690f03f35240bf8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01149.py", "upstream_id": "BenchmarkTest01149", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = raw_body.decode('utf-8', 'ignore') if isinstance(raw_body, bytes) else raw_body\n if data not in ('asc', 'desc', 'name', 'created'):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n eval(str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e67cb487b9f3c7efcdea219ece5b5f77f0820de3aff8d6a1d1254df9b4b302a4", "structural_hash": "0d4e84e02852cf49f081ee80ef87beaad3c5f52e9a8219d9c29b53f5b42ffab0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01258.cpp", "upstream_id": "BenchmarkTest01258", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "098853689f2c867c4eccdf6ae35243218aea3b5734f2594c7f2625e738a430bd", "structural_hash": "3069fb2abe473c6c8a79a025211c66ac591670cb218fb1b54840d968fd34eba7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05192.ts", "upstream_id": "BenchmarkTest05192", "language": "typescript", "code": "import { Controller, Headers, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = xff || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(processed)]);\n res.json({ updated: true }); return;\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2049175846a261a3933e829799008306159d0e6c55c503202b25523788eb18ea", "structural_hash": "126a580c214f24b3db4d1744726c89471bd368704f04b9bb2f8c5dd5103c715d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02409.rb", "upstream_id": "BenchmarkTest02409", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n payload, _origin = user_input, 'http'\n data = payload\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a2c2e01d587b8146070596508e0c480c1b596531f7db6403dccd524ef5624f2", "structural_hash": "38957d24c655fd707e4843864951de8f82be12b9b1804a71fcd23f52d37e0abb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_18079.go", "upstream_id": "BenchmarkTest18079", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tvar data string\n\tfor _, token := range strings.Split(forwardedIP, \",\") {\n\t\tdata = token\n\t}\n\tfor _, a := range []string{\"read\", \"write\", \"delete\", \"admin\"} {\n\t\tif a == data {\n\t\t\tRespondJSON(w, http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\t\treturn\n\t\t}\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-285"], "category": "improper_authorization", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "088b132658d5ac989ad454b012f019ec8802db4026e1752fe7d52d3eac175e36", "structural_hash": "e624284628608d01487f1606acd98c3b618b24a6d30a76db02b1b38c205f9394", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05691.rb", "upstream_id": "BenchmarkTest05691", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n data = sprintf(\"%s\", user_input)\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n render json: { wrapped: wrapped }\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c36d7cddc23a19b29c27d7d4fe6f6dffa07d4e74ff5af594f2e89cf192c46f3", "structural_hash": "bbf02cf33a94710bdddd4fe599b33214cc6b5519db253429f523519c9ed4eb4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05574.sh", "upstream_id": "BenchmarkTest05574", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n rm -f \"$tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db0de8fc16f5fcca48dfe1594dffa855a2d4a1ec4f33ce1e7232daaad292cb3c", "structural_hash": "bf2a3b54a59ca299bca4d5daf403bf81b954bd0c7bc4fe5a697f66e5196d617e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01573.py", "upstream_id": "BenchmarkTest01573", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = '%s' % (field_value,)\n if not auth_check(str(data), session.get('token')):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f679c1fbeb83763769ad5edd0bebf97b56e475cc6d7ba3658692f97a1210ad4", "structural_hash": "414a46ce30916e837a22072505f5b86ba451680a276fe45ad9546de35829f1dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03220.c", "upstream_id": "BenchmarkTest03220", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"cfg/%s\", user_input);\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34d957801c5ac46b32efa6874dc6f0700dc4f81cae4cc8b05e62ac3a08935e89", "structural_hash": "3363ea690966f8f38d5f1816987b71ea05891aabc36fbba3a27b7e8d8b12fed3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00204.js", "upstream_id": "BenchmarkTest00204", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db62a831e4dcceb634733dc66a54a0f0879240fa29c1d218545c973b4209282b", "structural_hash": "6801581da9f79cf36efd45139b6b5f3f1bbe18dbeb3c953b6c209c791d1edec4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06467.go", "upstream_id": "BenchmarkTest06467", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tsegments := strings.Split(multipartValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Header(\"X-Custom\", processed)\n}", "label": 0, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85aae6cc3923d98afac60b28448e2e41f1512f46fb54aa7dc3169aad527b0061", "structural_hash": "e71e0138d26baec608c3b7988973e5d07addb5794c66cfc7ebea472742b99fee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01091.rs", "upstream_id": "BenchmarkTest01091", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&auth_header);\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6cd4181b72d74ebd8bd9ee6928e3130a581c308c0692ed1dd25d3e5d16ab645", "structural_hash": "98f8f185d29ff0846ac756365cfe95a4823788fa84e761f765f8ea1aa89e78a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_11844.go", "upstream_id": "BenchmarkTest11844", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tform := FormData{Payload: jsonValue}\n\tdata := form.Payload\n\tanswer := data\n\tif answer == \"fluffy\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-640"], "category": "weak_pw_recovery", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cba86dddab42eabe6a2b9aa8bfdcb1532c527cec6499d6c5d7f47dae0f0c4fcf", "structural_hash": "84f0537e5c45b446c6cdc220c5ac252927c35df8c5e539c9ba5dab90c242a2e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00505.rb", "upstream_id": "BenchmarkTest00505", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n payload, _origin = user_input, 'http'\n data = payload\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n Rails.logger.info(\"Action: \" + processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1055e068e603b5be8214ef80069b18767034fdbeec33403a5774cf26a055a6f0", "structural_hash": "e89807d0fed86262c55e826674a0d218ce60f88f35cc8fbdae72bf0227177155", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01159.rb", "upstream_id": "BenchmarkTest01159", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n Net::HTTP.get(URI(data))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "786256fd44c05d00553a006351622d0928700fc7aa90b6d71f33cae262290e2f", "structural_hash": "8ab08f95eff86e4f81b1866b7579e0f7f046c1586fb7b643d002f4b012ea60be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11610.c", "upstream_id": "BenchmarkTest11610", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a2f456a2711723b6dfac781de76993b78d41e5de4ab3559375c40d8b395f4fb", "structural_hash": "b7c326d11b1787a0a4ba4088f81b00f62c31ac9a114407f00184d79ca7657c49", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03021.ts", "upstream_id": "BenchmarkTest03021", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n db.collection(\"users\").findOne({ name: { $regex: data } });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "902c1606cde510d75f8e67089a4600159cc35ef93d1c94bd7428ae16000f807f", "structural_hash": "b7bc04a31645049b2c15d982a99c750700b28de95832cf7ccd3f1e08e1839bab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00870.php", "upstream_id": "BenchmarkTest00870", "language": "php", "code": "header('Host', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { abort(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3ec373a6e9c73f6125122d20a38f2893c189f79a1892bb2245bb2a8663d78b6", "structural_hash": "fa18d48b1239705748b94fdfe4c3339068a9a48ea359d85ead4db3edb1e4eb0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21219.c", "upstream_id": "BenchmarkTest21219", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f554510a385ac485a6d6126c17e4145833dc959cbd32c755d422944872542756", "structural_hash": "2aef7b4a8f293eeb0c51b9b4a4f8d9dd5aaa2dfa2d9023e80082c4a4767041a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00470.rs", "upstream_id": "BenchmarkTest00470", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let queued = raw_body.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab4c205a800501ac036bc20a53b88c2f80cf09f7cf08d3e4d74d1e6f28f84322", "structural_hash": "14c7d736b1fd19effec3198b7a2eb501ce04bb83d9226a252537a2d864f93de6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00318.cpp", "upstream_id": "BenchmarkTest00318", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n std::cout << data << std::endl;\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a73c7992f4603632195caa790488345d0d60001e1e43b101f51bfab36557bf2c", "structural_hash": "490cf0d885c945455f3082d01e3401641107229530230e262d540ac47c6b50b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13126.sh", "upstream_id": "BenchmarkTest13126", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5675a7e6ebe9fe7c1b7b200f3ed8651294282df112096e837f03212e72e7e4bd", "structural_hash": "c90550187bff3e3141a8e9975774055815956425b77db1a35f391545c21c4ab6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00767.rb", "upstream_id": "BenchmarkTest00767", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = CGI.unescape(user_input)\n Marshal.load(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b43043c8806958a3f1ac089f5f9d83f9d46b491905e8bcc484021aa910798d44", "structural_hash": "305d3493da1c391cdf612a6c9457737c6953d0dc70ba376f479d751afc39cf36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02950.rs", "upstream_id": "BenchmarkTest02950", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: field_value.clone() };\n let data = payload.value().to_string();\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5fd93222991e856da463689b2f4fe977cd51855de857eddb8c17e39d0b5e387", "structural_hash": "d2159ab13916bd4943c1fd41aceb58cc61f03dff9f0f15cfbd7d738e7bd4e0d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04460.php", "upstream_id": "BenchmarkTest04460", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { throw new HttpException(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n $conn->executeStatement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f9b89dd4373bc632a4b7dea4a337d104b271f29b7f6a6748efe1ab5a000fdb1", "structural_hash": "759cdd4a245ccc2a4b5f4eb533794ad6323d8b2d9ef55e3dc6271f0324d83641", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05693.go", "upstream_id": "BenchmarkTest05693", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tsegments := strings.Split(headerValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcontent, err := os.ReadFile(\"/opt/app/plugins/report_renderer.so\")\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86a74f8fdc4d4487150bce5c3e60da800d8a2483c0b0d2e6187208179f81b233", "structural_hash": "32a7e636f5ff27eb002ebe4c648c1abd8d2398c670862b502cdefa0d2e72a327", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05905.php", "upstream_id": "BenchmarkTest05905", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $data = str_replace(\"\\0\", '', $userInput);\n file_get_contents((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e1a65aa599540c58eb7209dffe15525f252125d5f0ebfa22864930ff3cb96f4", "structural_hash": "1560ff77aff6f3699f0a1c92f18e9d78cf34ef632f2632c3bd8dc7de25c28efa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06065.c", "upstream_id": "BenchmarkTest06065", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n FILE *_tf = fopen(\"/tmp/app_export.tmp\", \"w\");\n if (_tf) { fputs(data, _tf); fclose(_tf); }\n chmod(\"/tmp/app_export.tmp\", 0777);\n}", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0ef80b372cd923a0cc5b84d3c3cbe0c11a74465b412d7e1b3bb6b0261e5c1b9", "structural_hash": "d39af0517d6da4bec79d93d8c6feaeb34e9ebb54902dbe40f2e29e380c26e59c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03317.rs", "upstream_id": "BenchmarkTest03317", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: header_value.clone() };\n let data = payload.value().to_string();\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e55726bef2986ac757da7a76f607f885aa25adfab2e9f03e8241176cf953348", "structural_hash": "9cc16bcb54c2c1150931673b4d31bfaf72d88a8ba7daa0ae3a759bb347443d81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22157.sh", "upstream_id": "BenchmarkTest22157", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n cat \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2bea3ade7f128bce970c4c9eeb517be7681a3d4cddb2ab656317606913ee8ee9", "structural_hash": "5f4adf91d57f778f0a3e0cd28d13a01b7ccf9a8c3504878bec8a2c2bb8efd8f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02468.ts", "upstream_id": "BenchmarkTest02468", "language": "typescript", "code": "import { Controller, Header, Param, Post } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n return nunjucks.renderString(data, {});\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c392e755783d96f7553e7fc93506424e58408949a6b4ea7936697a64a7dd09f", "structural_hash": "89d4ccbabb8e21f73e2de0084c14f7a8d1f7900f296d58a609aec70a00688372", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_34880.go", "upstream_id": "BenchmarkTest34880", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tform := FormData{Payload: dbValue}\n\tdata := form.Payload\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\tpanic(fmt.Errorf(\"invalid numeric input: %w\", err))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9332e3b1d99d7d5428ea8b984cacfb6366c5eaefa6cebc315b472e23fa73a6b", "structural_hash": "f707a90942c1446b4c9914431892d25b723b8b6f12a34b2cf9f54d5d12de4c2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02813.rs", "upstream_id": "BenchmarkTest02813", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let tokens: Vec<&str> = referer_value.split(\",\").collect();\n let data = tokens.join(\",\");\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7183071b09c11266e0209f1b645194d98c0433d52917a636a6d76f0e2d036f7", "structural_hash": "877bde7353f35f1df1a5e1c94a57185a7ef72082bd5b3cb12e7aabc37e6d21bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06163.sh", "upstream_id": "BenchmarkTest06163", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e9cbbccd4bdfb706f6a095c359d3fcdbef1ea6bce297dacd6e4bb807ec56ae5", "structural_hash": "484f65d233ede121b43e6e0b411068579382d170695d7e92e73eb8c147eb61b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04283.py", "upstream_id": "BenchmarkTest04283", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom fastapi import Form\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n data = RequestPayload(field_value).value\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19b41d7632714ce5364940f4eea0ab285b5cd47c3ce905aede094ae326875c0b", "structural_hash": "6fb105f19c4ea5c4f264db2c645544fa7790a102670e6df6ab365f20be0f3b15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04323.rb", "upstream_id": "BenchmarkTest04323", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = CGI.unescape(user_input)\n File.write(\"/var/data/output\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "307b42663f5fef11bad6d41d83636f4ede2ab502d305639c8b64581e82640f8f", "structural_hash": "136873dfb479a08c57b6ea12e69c5a7dd30bfa18a6cc4ca31d56d70b37627a5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04686.rs", "upstream_id": "BenchmarkTest04686", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let captured = upload_name.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37b2090aea3714ca76ea7fd3a7c57fbd99db0b79a8378855d69e19fde8645e45", "structural_hash": "5286bca4d042b87a9a1d791c3a56e7e997e30fd51782dab2fc50220682200f6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01599.rs", "upstream_id": "BenchmarkTest01599", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = serde_json::from_str::(&graphql_var)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8aae779340d9501d6872c9e54f9485be11c41b0370036cce4e30fc08b468ad6", "structural_hash": "99390b4ac9374fe8668a63e5b5b07e7fdaf9813089f6e42512eac8958c9722db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01025.rs", "upstream_id": "BenchmarkTest01025", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = host_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30940c767457b32e64f545030dd936a29400382861c866bd330983fdfd83cc0e", "structural_hash": "89a7dc1238b8eef05ea840d6122c12f980deb3e7fa3bc952de2742422fc55755", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13139.go", "upstream_id": "BenchmarkTest13139", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tsegments := strings.Split(userID, \",\")\n\tdata := strings.Join(segments, \" \")\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\tc.String(500, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa7ee1eed0ef9fcf8fe548590c8eda370f1fe2e2f8fb711874a9702699045419", "structural_hash": "1e6420ca7c52f7caa7089a470c2dd4f07c2640e382d56c0396456911ef4f50ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03580.rs", "upstream_id": "BenchmarkTest03580", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let queued = forwarded_ip.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb9ec8cc182c246397129491af4fe0fb079366f40945ec7a0b483d5840a57253", "structural_hash": "bee93209315e37538f38d752d42ee0cb55fcf2a4df654e1f79738674570e163d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03129.rs", "upstream_id": "BenchmarkTest03129", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", user_id).ok();\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf2b9e75fd64dbac1cb38f054b80836c960dad3368b1287c6cde8322431086e6", "structural_hash": "09d9e36a77a60e7256943f87f07f0735a9fd6bb38233787d03a71dd1e293a7ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04986.rs", "upstream_id": "BenchmarkTest04986", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let transform = |v: String| v.trim().to_string();\n let data = transform(upload_name.clone());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56b1f3b8e17bd7aceb18aeb85fb6d137ac14067aa299d2aa18af93f48ab5d9a2", "structural_hash": "02e3fa0de648def05b265361260f61ca744de67d8ccc85f43aa3e979769cae8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02663.rb", "upstream_id": "BenchmarkTest02663", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbb31fd30752d7dbc35bb4fb91ce18e1f09f39d113a3ab1be58bec49c1ccdd15", "structural_hash": "3dae6beec2a682da2f19a7c3b752f25d01b1e87af5135d71ff803d91c44e6d39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21870.js", "upstream_id": "BenchmarkTest21870", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n req.session.id = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82b42565a3c73856fa6079c82f63a77d25a2ead0cc9368d877f01b68b5ebea1d", "structural_hash": "e6bf885ebd1c0d5a4b44f1321abfb18d22a1ecab59a13923d07001a32171c4c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30129.js", "upstream_id": "BenchmarkTest30129", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d6b3ebdecf6f6a7515eb024c628fc81121090680746f225c73059f117c309d2", "structural_hash": "c8a306c7f55432868ad6f89e9543861c912bfb8e3f5b4eaf3fb90777fad2f88b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03333.cpp", "upstream_id": "BenchmarkTest03333", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = std::string(\"value=\") + user_input;\n std::system(data.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ca8137d0976958e0ea18a84e5abac5c1371e10197a003a2bd72549bf0a1e95c", "structural_hash": "1e18ca8a5a030e0bd4caa53889950be6b4b0007db76974c39f915448747c160e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04979.java", "upstream_id": "BenchmarkTest04979", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{refererValue});\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79b431c0e55ca7e7a8897a9422d11cfcad2df84da04f28354b98fee97ac8b42a", "structural_hash": "84cf273e56b66254ada770d38f1c7d23fce75178030d2ebb53e3523980ba183d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04836.php", "upstream_id": "BenchmarkTest04836", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab78cdf39713430b526795b7aee66ee989aa191a74d2f0896856792e24fe88ba", "structural_hash": "981cc925e6a727ed5da5f703f5b1def73ed776eebd15d1f04caf30f20887655c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02741.php", "upstream_id": "BenchmarkTest02741", "language": "php", "code": "query->get('id', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { throw new HttpException(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n $conn->executeStatement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d02cfa4e5c509545b762edbf07c8f2f8c63d7b29343b4825dd3f7db503648e60", "structural_hash": "87585fb4e984e9976a652eeb039e1ac370dd0aed282901adba9d4a2386a86605", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03404.rb", "upstream_id": "BenchmarkTest03404", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n content_type :html\n \"\" + data.to_s + \"\"\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f673634b0912c5759c6a1f747139cdf3029479393cf241d68c6a02113ae2fce6", "structural_hash": "b86e79b83364954f9ee124292b1a9c303e49f614d9faeb2d3cc5d7ec5ba807d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02886.ts", "upstream_id": "BenchmarkTest02886", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c701f9649f7ce1d1b7c75a4f26e43cbb7e16aa101918b53aa831694e32d7e7c", "structural_hash": "2d9765ce8fe3976d697acf6bed5b828c69900c79c3ce8748038bf76a1b07dfdb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00322.rs", "upstream_id": "BenchmarkTest00322", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: forwarded_ip.clone() };\n let data = payload.value().to_string();\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47fbef31ed956f6234676b445361854dd688139c6490454d4a5e3b7cb3e47280", "structural_hash": "c5071aa80922769f7ce7197d8dbbb9386d133079890bb7115589396e2b4430cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02211.rb", "upstream_id": "BenchmarkTest02211", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n requested = processed.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n content_type :json\n JSON.generate({ wrapped: wrapped })\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7915370252f1f127ad71aa6677a766b355fd4f8d34571aa73c6e50b96da676f", "structural_hash": "16655f07be778f3c82718d5804331566feea7b29ca6990909c21720381173e0a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10113.c", "upstream_id": "BenchmarkTest10113", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0f84ad66b2ad7daaa61da9baa8b194cb3bd4c53398fb9f9a011b43a12cd33ac", "structural_hash": "8dccc8009aa2f96fdecf2b8bda8a78583f41bc0defa6549f9d00a1e1c64a4538", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03451.rb", "upstream_id": "BenchmarkTest03451", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n content_type :html\n \"\" + user_input.to_s + \"\"\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2368c607879b8b943a4b09a3a69bf1099d80ea83c39e0b268a09a95e68c68e8", "structural_hash": "69b4ddddd0d02ea642ba161e4b38992f35537ace79ea5950eff7179faee7b09e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03133.py", "upstream_id": "BenchmarkTest03133", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n kind = 'json' if str(path_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(path_value).strip()\n case _:\n data = str(path_value)\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9feb661923f0adcf4bceb5fb98a00700bf2190fea55ee8d141098045523e477", "structural_hash": "b540fea25595ebecc664a148ec7d108d1b29ebb1f4dbc47b34b561b2c65d5505", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06806.go", "upstream_id": "BenchmarkTest06806", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tpending := strings.Split(commentText, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tos.Setenv(\"APP_USER_PREFERENCE\", data)\n\tc.Header(\"X-Config-Set\", \"APP_USER_PREFERENCE\")\n}", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5c569ad5155923864e98c3d7d78370059976882ced496a689de9e92701b5902", "structural_hash": "722824fddcb605e491f934c238f9a7c1affb0122e06df3106dbf9dc5f10ad4e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06294.c", "upstream_id": "BenchmarkTest06294", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: printf(\"other\\n\"); break;\n }\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2a06cd7dcbbebe0e1c6f02c76a252cdf5dcc578b903c993a467b62c44a87b2d", "structural_hash": "62858f0148c579769ad73c6a987ce6eaeb4cd0ed56d4d6b8676d7c66f715397f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_34379.go", "upstream_id": "BenchmarkTest34379", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvar data string\n\tfor _, token := range strings.Split(fieldValue, \",\") {\n\t\tdata = token\n\t}\n\tvalues := strings.Split(data, \",\")\n\tif len(values) > 0 {\n\t\tw.Header().Set(\"X-Param-First\", values[0])\n\t\tw.Header().Set(\"X-Param-Dropped\", strconv.Itoa(len(values)-1))\n\t}\n}", "label": 1, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfa8a394743bb7cdf7fbb70cc1113ff30bf143015dfa6acc0ee62650a28fd96f", "structural_hash": "18d664d00a4ded43652260ccd9ca4dc414d2b63f739ad02d6633e515ca5e960b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00424.ts", "upstream_id": "BenchmarkTest00424", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n childProcess.execSync(\"echo \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0695b71a74e6408ddfca63a9a3109735ba31a2d6a0bb8280cebb24e8e6e6dcaa", "structural_hash": "dcd2e3d1f34617e9f66aa7796f54b67fa51ad0c004a9c6605f6cc512f97aa5ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19287.go", "upstream_id": "BenchmarkTest19287", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvar data string\n\tif xmlBody != \"\" {\n\t\tdata = xmlBody\n\t}\n\tif strings.HasSuffix(data, \"/public\") || strings.HasSuffix(data, \"/static\") || strings.HasSuffix(data, \"/.\") {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-288"], "category": "auth_bypass_alt_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1cbd6d754b548107bc4f52c044c738dbff6f9260d41ffac7a2f59b0b6d125fcd", "structural_hash": "16ac90b45e82fec37af1e6b86ed5c86573c870fc1c7ebee5e4cb7cc1bcbf82a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_29956.js", "upstream_id": "BenchmarkTest29956", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n ctx.body = \"
    \" + processed + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83eff754de6a3060dafd03d01699f5d12e80fb5821b2c07527d81e70d726fe21", "structural_hash": "5c158f729a913d4b2b2f2863477322367b33e6b9c87b19d08eac0e111a8d8a6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03436.js", "upstream_id": "BenchmarkTest03436", "language": "javascript", "code": "const fs = require(\"fs\");\nconst jsYaml = require(\"js-yaml\");\nconst { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = jsYaml.load(fs.readFileSync(\"/etc/app/config.yaml\", \"utf8\")).field;\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n authCheck(\"admin\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3a19587c979b4735636af12e2a4de0c4ef77e54228c6368ee032dc9cb6a0626", "structural_hash": "09de54237096bd3b9fb22012e8766cb7668aca8cf20852e798c7bd717d8aa3d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02852.java", "upstream_id": "BenchmarkTest02852", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = userId.replace(\"\\u0000\", \"\");\n return Response.ok(String.valueOf(data), MediaType.TEXT_HTML).build();\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d560d735e2f66af2d644acd77070a24b8f3810f1cb0a64a5b5f5b5c9d7e99f0f", "structural_hash": "64a205e63ab65dc353b788184ff26fc785af964e65cc5276669154ae3ef88e4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03382.ts", "upstream_id": "BenchmarkTest03382", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data = String(userInput).slice(0, 200);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a06d3d3bc9a481dff1decc3cbef8891770299d19b23a0561c699e8cbd3213d1", "structural_hash": "f2a6ec00d33809eea470e2547ecefd4fc7031b1fe47c9fb8bceae9431700323c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01158.rs", "upstream_id": "BenchmarkTest01158", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let data = crate::shared::passthrough(env_value.clone());\n let processed = if data.chars().count() > 64 { data.chars().take(64).collect::() } else { data.clone() };\n crate::shared::send_error(&format!(\"Error: {}\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "805c052e67a3a258da83d540a08886197682cdbb962a4a9799da97cd45c8688d", "structural_hash": "7be15a928196bcc7cfd567dd38486ee8c80a339a60d69612164d5488cc8c64e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01294.php", "upstream_id": "BenchmarkTest01294", "language": "php", "code": "getContent();\n [$data] = [$userInput, 'http'];\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d16fce3e60a750488448f06c86c997b069bfc0b6541ced4be59fcac786b2e78", "structural_hash": "c08bd680166bcee7036f11636c1b07e173c19085d09f1a9ab1cfbb54f0b9638e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05729.ts", "upstream_id": "BenchmarkTest05729", "language": "typescript", "code": "import { Controller, Post, UnauthorizedException } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.DOTENV_VAR || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n const _credSalt = Buffer.from(process.env.CRED_SALT || \"\", \"hex\");\n const _credHash = crypto.pbkdf2Sync(String(data), _credSalt, 100000, 64, \"sha512\");\n const _storedHash = Buffer.from(process.env.CRED_HASH || \"\", \"hex\");\n if (_credHash.length !== _storedHash.length || !crypto.timingSafeEqual(_credHash, _storedHash)) { throw new UnauthorizedException({error: \"invalid credential\"}); }\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa021973d13a98845c2a855e3d6ace290d675a8d93c9c6e99e16b2fd9a64f99d", "structural_hash": "d87602e878e931f4eee2ba65a6474c5579d567ec635b2fd812fa043ab7a07e50", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01189.cpp", "upstream_id": "BenchmarkTest01189", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec6130303853387eef0a771feff23387df99c7a4dae1efde3d94ca4dbad4eb2b", "structural_hash": "f690263b0c2239c7e505f9558fa0b0557a8b8a8b69e7c0bc6032d9221a9721d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03339.c", "upstream_id": "BenchmarkTest03339", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32e32a0bc108679cda13fc595b20ace6807e2419d2201c2205b6ee75737c8efd", "structural_hash": "171d1327a60c8466060249529ae4132c3f1c4b7fb1e5b9fa6c9ec08b67936fb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00123.rb", "upstream_id": "BenchmarkTest00123", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => processed}).first\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62c6e1631d216449172941730806cad28b1a2793d9a1dfcfe5dc4f798b5afe13", "structural_hash": "61d3db4fa6705e22616defff5a84aa62b8a08290e31351672e7234d41f66dd00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33727.js", "upstream_id": "BenchmarkTest33727", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30a5b6d9c797ee6d0418e2cbe486214a1db84eef363aaa45118bee419b5d04de", "structural_hash": "785047686e6fc400f82387f282f0bd8463873345e22094c1ba9dc0949aaa6580", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01683.rb", "upstream_id": "BenchmarkTest01683", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f47a17e6a2cbfdde5b1f1c74a1b6e5a2a8cb1e946cc52565c80511db022626b", "structural_hash": "43d4720ae2bc8687e4d867dadc9fbac4bafeb0a1e01f260b2a499b4174400aa8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00489.ts", "upstream_id": "BenchmarkTest00489", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d66cfc6c8a8e65d60b8b3ff3cb338fb08b1ccdd4d4edb0f30f7462c59f55f48", "structural_hash": "b81035bdb0678f0c0e251c4e479e3c3b6b1eb29aaa48e1fe13c87fba87199831", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04339.ts", "upstream_id": "BenchmarkTest04339", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d599b23f60f916d42ad94ea9286a33a0fa0a9c3432d9a3add385663907a30580", "structural_hash": "7e98e2c6ebdc9914e0ee4a40dff0aae1fec7056420bd5b16f3d66657e6d8de44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28149.js", "upstream_id": "BenchmarkTest28149", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed2aead8e82ccfe4e247a0ca7992ac9736a811fc032a03d2b5cf07bc6cc82b5c", "structural_hash": "33c2764e75263886459d7fe8cb2cd8faa3d90947ab876ec98d6648ed6f7f0c00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00713.rs", "upstream_id": "BenchmarkTest00713", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(user_id.clone(), |s| s.trim().to_string());\n static _RE_SCHEMA_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[a-zA-Z0-9_.-]{1,256}\").unwrap());\n if !_RE_SCHEMA_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n let _role = processed.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91e524b97a39f0d6311bc8a68818186dcb8878abcd9e162b32a89e2857947bb4", "structural_hash": "6e760683eaaa34e3a61b83740f6cf1f0f88b3ba7218a12cf6136a76ff9c1196a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00957.cpp", "upstream_id": "BenchmarkTest00957", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1abf9a8b08f3265849788400af81ce27c21f8b9ec7e5ba7b06ce74eac1819865", "structural_hash": "0fd70897275d08413e5068de3e3ebf3c57883f381414d305733e25e1114a25de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01372.cpp", "upstream_id": "BenchmarkTest01372", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_HOST\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n std::string _fname = std::filesystem::path(data).filename().string();\n if (_fname.size() < 4 || (_fname.substr(_fname.size() - 4) != \".png\" && _fname.substr(_fname.size() - 4) != \".jpg\")) return;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c641db85edf5065f8a077f67aa44afbc6242b1cad8af341fe2e7b95ef47d7cc8", "structural_hash": "51ca131ddfef2a9226d9c191ce501c9bfe5b48f1284c622b3c3daaada29ee224", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04570.rs", "upstream_id": "BenchmarkTest04570", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: config_value.clone() }.payload;\n tokio::fs::write(\"/var/data/encrypted.bin\", crate::shared::encrypt(&data)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15d68dce2c8ae13220b9d994ca6d81313b9326eb3c448467a881e313a519b4dc", "structural_hash": "1d6e8066ed4dfcd4646f6bafa2a5dc03de3914147cdbcf955c00b6630cb6a36a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05496.go", "upstream_id": "BenchmarkTest05496", "language": "go", "code": "package testcode\nimport (\n\t\"regexp\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tdata := pathValue\n\tif _, after, ok := strings.Cut(pathValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tinputPattern := regexp.MustCompile(\"[a-zA-Z0-9_-]+\")\n\tif inputPattern.MatchString(data) {\n\t\tc.Header(\"X-Validated\", data)\n\t}\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4818e462a19b33cb60720e2fa14c81a529b160eef1e65db7a3bc4be89cb2f0e", "structural_hash": "c37bc0ad28280149aadc4298e710fa51f50cf9f79b4823bcecec20092975fc43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03614.py", "upstream_id": "BenchmarkTest03614", "language": "python", "code": "from fastapi import FastAPI, Request\nimport json\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n ua_value = request.headers.get('user-agent', '')\n try:\n data = json.loads(ua_value).get('value', ua_value)\n except (json.JSONDecodeError, AttributeError):\n data = ua_value\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f098f586d230fd1bfefeea28adab7c8016eb648f07515a9878a1d4bd783d91d5", "structural_hash": "8560cae1072d5abe41e1c048e900ab75730c0b2570acc93fbc3f754a6fd0b4eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04703.rb", "upstream_id": "BenchmarkTest04703", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n File.write(\"/var/data/output\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eba1732c2c80dc37e19f3f6ddac370504539f3d19eab760c9efcf5f97177ba18", "structural_hash": "a2e0f487c6e57d73f7d9528d6c2fd665522fd15fe42228ca57df09fab789a1ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06101.js", "upstream_id": "BenchmarkTest06101", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.DOTENV_VAR || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90a78f666a46a48245bc0e15157ffcc6cc1285ffb2a2b56f2c1e7d2cf6c110f0", "structural_hash": "5c9d3b93a862ec4e5d3adc57deedbacfcae7eafb41d223946357958f9f0cb8e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04825.py", "upstream_id": "BenchmarkTest04825", "language": "python", "code": "from django.http import JsonResponse\nimport ctypes\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n def normalize(value):\n return value.strip()\n data = normalize(ua_value)\n requested = int(str(data))\n wrapped = ctypes.c_int32(requested + 1).value\n return JsonResponse({'wrapped': wrapped}, status=200)", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75d0853a355b5d4073d233ac04e340ea845f123fe83441403dd7a9bc87fb31c4", "structural_hash": "6799bb641aa90cf7d30d44b0bca6f0ea4340ef1916aec15fefe53b85fdf3b55c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22889.js", "upstream_id": "BenchmarkTest22889", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n db.collection(\"users\").findOne({ name: String(processed) });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66a3a3c8d04b6545e18dad4068720ca13b408f29449ba8be427e9d030001b665", "structural_hash": "4bb7fd37d768080e0893b1f39a6d8a0509ebeaa87abb4d3652689c79b08ad1e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01476.ts", "upstream_id": "BenchmarkTest01476", "language": "typescript", "code": "import { Controller, Headers, Post, InternalServerErrorException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n throw new InternalServerErrorException({ error: \"unable to process request\" });\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4bc8ef751b3b755f8d606266ad81ddc3e6e6c77925e96575b91bd9a120698ef", "structural_hash": "1d3f0f8fa78b20354b5f4550a03aca83b5f83cf607db3bd6504bf744e213cba4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11022.js", "upstream_id": "BenchmarkTest11022", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = fs.readFileSync(\"/var/run/secrets/eks.amazonaws.com/serviceaccount/token\", \"utf8\");\n const data = await Promise.resolve(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n require(\"./shared\").sts.assumeRole(String(processed), \"app-session\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "351f0f5251f3edda2e1adad7e914c5c0cfd2044de258fab2564e0560becf2d3e", "structural_hash": "69822e1a8e79ec1f350ff124f0ae4078c578ec45f66fde8271915eb1d1116d09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04732.ts", "upstream_id": "BenchmarkTest04732", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6613ab63465b72dad037d76faf64cdf7d2d5dc3de6f68cb8bec163a552d59c1", "structural_hash": "8870ce7b634cd76164657d1e9c780a9edb8caa80a03a60e41926df56eb11e1ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05830.py", "upstream_id": "BenchmarkTest05830", "language": "python", "code": "from django.http import JsonResponse\nfrom django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport re\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n parts = str(user_id).split(',')\n data = ','.join(parts)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n return HttpResponse(mark_safe('
    ' + str(processed) + '
    '))", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2f042bb89f53d58cf5df7670dc740676e20602d0d817b4bc8f0b0afbe7e65eb", "structural_hash": "4afa84dff96a3fb03606633c117da95db87adbf9cd74042b0ac72fa42361891d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00839.rs", "upstream_id": "BenchmarkTest00839", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let (payload, _origin) = (comment_value.clone(), \"http\");\n let data = payload;\n let requested: u32 = data.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "337e9ff71e22baf89a87d52a29896facb7c9e2c9b2f8716ceea645a0a29675a3", "structural_hash": "eb130c44d9afd52ed8e6b6f63c00bdcb081409a982a72f68559c94af0fb6c532", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02629.php", "upstream_id": "BenchmarkTest02629", "language": "php", "code": "input('multipart_field', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return response()->json(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n $stored = '0e462097431906509019562988736854';\n if (hash_equals($stored, md5((string)$parsedBool))) { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-843"], "category": "typejuggling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39851ab56722cef4c9e9ab9574a2c58db4c7bdc2886a34b44d317c80e260994e", "structural_hash": "94df00d6f5d3f9f3f244562ef22fc6034dcf39c0795daca66b85996e8d0402c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03701.ts", "upstream_id": "BenchmarkTest03701", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = hdr || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n res.set(\"X-Custom\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f969cbb27aecaf479bc989b7b83a0ddcaea80704d395dcdf3e3d8959b31a4b3b", "structural_hash": "cffa9070b6e39c019ca18d87b33765adca2367092f3d113a564ef6db9b7f353f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00187.sh", "upstream_id": "BenchmarkTest00187", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d283975b5f4311a322bbebcce9fe983e6f636dfc8b5d006ab9a0907c62449e66", "structural_hash": "11f0a56f35cd81b5870ecf842dbe54fb2149f2ca12e0d3ce24eae929689f42f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_39775.js", "upstream_id": "BenchmarkTest39775", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const { publicKey: rsaPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 2048 });\n crypto.publicEncrypt({ key: rsaPubKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING }, Buffer.from(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "089b78d3e59663a485f09098e624ac7dbc0d1286bc90b384c4e7665f1af437c4", "structural_hash": "37ac5440fbbf4fde24e9cb8d3492b3f9ddfd5238c6fa132d41dfed5b4433d9ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20754.go", "upstream_id": "BenchmarkTest20754", "language": "go", "code": "package testcode\nimport (\n\t\"html\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tdata := xmlBody\n\tif _, after, ok := strings.Cut(xmlBody, \",\"); ok {\n\t\tdata = after\n\t}\n\tprocessed := html.EscapeString(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ecf380725529fdc80a57c89be75736a510beb88fb6d5423ae4cee6938bb9b00", "structural_hash": "95b08ae8fcadf1f8ab8ae0421a6977fbaf9e0c11c4e7feb3d197af8292bfa333", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12643.js", "upstream_id": "BenchmarkTest12643", "language": "javascript", "code": "const ldapjs = require(\"ldapjs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34313dd2699c6c6f5e296f7d9f1c2c8b6c92686f7f8f63725d99ea3ea9ada37e", "structural_hash": "91585bed3af7f3e804c6714836168c58e4ba25d97434f5c97b73b85e359b1994", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02339.sh", "upstream_id": "BenchmarkTest02339", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-313"], "category": "cleartext_in_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77784dc1186fbc0a8e2eba9b1c0aa5c8ed6131f4b2371435bfef9769d262244e", "structural_hash": "9a06b25e8134959a4f6ae051ab97efb107a14d15eb0cc81bec561543c8c15ed4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05719.ts", "upstream_id": "BenchmarkTest05719", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = cookieToken || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f9f23b1136a20b252293bc07b78be658a03852870644b9037a18be10e81fee5", "structural_hash": "12363e2fe1bcb184022d3bfe5f71174e47d02fd1d19eb721192d5767d6b55f68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03115.ts", "upstream_id": "BenchmarkTest03115", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = ua || \"\";\n const data: string = shared.passthrough(userInput);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n }\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8c05b441b5a78531471ba46d27b4f890eae2c3871c2529c5fac51fbddd65429", "structural_hash": "a45c85baac3ab3edf35b87e452ebb9c6f449f4680bd74a4350da42380bd9a487", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13121.c", "upstream_id": "BenchmarkTest13121", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n unsigned char _salted[288];\n snprintf((char *)_salted, sizeof(_salted), \"s4lt_%s\", data);\n unsigned char _digest[32];\n SHA256(_salted, strlen((const char *)_salted), _digest);\n}", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b8a2e1c00c2ae6147d0411e2fb33465822e4a1afd79b52cf45851743feaed4d", "structural_hash": "29f270d19e5f06857a919c221856202e645cbc5d64fe4ec170924a921dea351c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15136.sh", "upstream_id": "BenchmarkTest15136", "language": "bash", "code": "benchmark_case() {\n user_input=\"b5Vc8Kp2Mq9Lr4Wt7Jz\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae4d0c8647070dff30dc5ad66922d411f927830e8c7987b6475d6968098eea0e", "structural_hash": "32aa3c293889cb0a20d3321b4eae85f1e0e3e8d4a1b9d185f4c1041f307544b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27979.sh", "upstream_id": "BenchmarkTest27979", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=\"${user_input:-default}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "758db0e68f6f9b20464883187e839cfa6acbca3bbb360fe76e13d994ec8d86db", "structural_hash": "7669d161aa19a88a0d4ddfa7ce21f6960f6e569811f4b6d95c19bf9d5b2ee012", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02029.php", "upstream_id": "BenchmarkTest02029", "language": "php", "code": "headers->get('Authorization', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6fd2092dc10bfe31bd9cb1060158a8cf2cc6e14b8e8e79fc095c88492ef882f", "structural_hash": "eecfb9647911359a5d10c38e4f7739934b6aaefd1118043e34074c98dcf2fe15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26379.sh", "upstream_id": "BenchmarkTest26379", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ae229a024a003dbcdac28ce28b2d6f305523ab26fdff15f5b16d08e421a5a4c", "structural_hash": "a811c356b343ae5c441fbfe79123d3e67e36ddd89e28bcb0f0decfbc9298ff78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20184.sh", "upstream_id": "BenchmarkTest20184", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "614d07abc0a26f271121c43a728245d63afbb2cdeed3ab397f4d6ffee756cb1e", "structural_hash": "6fe7e33cec336e0a6f1b64091502b616df92d19c714d62821b86a75ab6f6e27a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04705.java", "upstream_id": "BenchmarkTest04705", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.Map.Entry pair = java.util.Map.entry(pathValue, \"json\");\n response.setHeader(\"X-Tuple-Context\", pair.getValue());\n String data = pair.getKey();\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b3ca9ef11a9f68b3bccb4b6afb15e6129e57e86ce977bb116e38bfa18a1b97c", "structural_hash": "0dfc8c5a02fc8c3b42290a43d8c8a1f4d69bc396043878d1b009052091deac90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32709.go", "upstream_id": "BenchmarkTest32709", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(jsonValue)\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"request processed\")\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c980960a9475610c6acc413debf9f7af08ec2fe7439cb88d66cf9279562222a", "structural_hash": "568f44e9ba530c243eb8ee1bb221f4f261ab57bc67d8c507c414a092b009b035", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02032.rb", "upstream_id": "BenchmarkTest02032", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = format('%s', user_input)\n _hashed = Digest::SHA256.hexdigest(data.to_s)\n File.write(\"/var/data/output\", _hashed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03d3c274d49e93c2e8e81c8303324de7922f85e517f90fca56195d5c700ce6b2", "structural_hash": "119f912a8490749d3605446e2b0062e5c8e9467bfc74955f479c66db75e2798c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09402.sh", "upstream_id": "BenchmarkTest09402", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n mysql -e \"SELECT * FROM users WHERE id = '$data'\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a649a64001bb8409f55cf0123d573d318b0c556782c1176c022aaeaafc2fe1a", "structural_hash": "17743a440f744bb915527e6f3a0b88eac41aa9f00a4c9176946596c6e82bd077", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05822.py", "upstream_id": "BenchmarkTest05822", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom starlette.responses import JSONResponse\nfrom starlette.responses import PlainTextResponse\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n def normalize(value):\n return value.strip()\n data = normalize(path_value)\n base_dir = '/var/app/data'\n full_path = os.path.realpath(os.path.join(base_dir, data))\n if not full_path.startswith(base_dir + os.sep):\n return JSONResponse({'error': 'forbidden'}, status_code=403)\n checked_path = full_path\n with open(checked_path, 'r') as fh:\n content = fh.read()\n return PlainTextResponse(content)", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "143e7a410311690b1c01984a0a4f46a51714c6eef53fa86d26df3f2f79c578da", "structural_hash": "1176b2bf9e07c96e4c77219d86733dcbf37f52b376d52d82c101bf64ec457c22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03112.java", "upstream_id": "BenchmarkTest03112", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(userId);\n response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4b54a29055018b9fb01d171166385c6251a80ed51a60ce08a7e0f8d9f8b726b", "structural_hash": "8730be7a8cbed99cd7fdfb7df6866397c636dab9e0425641e71a5b87556736bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05557.java", "upstream_id": "BenchmarkTest05557", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String prefix = multipartValue.length() > 0 ? multipartValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = multipartValue.toLowerCase(); break;\n case \"f\": data = multipartValue.toUpperCase(); break;\n default: data = multipartValue.strip(); break;\n }\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e46fed9734c2376479be1b2272dddbdc027a9808f9f73b9763339457c91206ee", "structural_hash": "873fa6cf9ac83fb65d083defaf69d914e361acb09aabb2dc102381ab028907da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02737.cpp", "upstream_id": "BenchmarkTest02737", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96deb3a445ef4786c0ceae7e3e059e8b47cf069aaf70bf6afbb5dcb4d44f4cb8", "structural_hash": "74ca21c776dd6e01d6303c50207b310af5b7774381d8b2a735b2253d8b074c25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03874.ts", "upstream_id": "BenchmarkTest03874", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "908350f54aafac81084359530b97c4e23b913a94495935781659c320dc50f0e2", "structural_hash": "c07c98546f82c89f39cb6826ebd34172fe41ae131b108c233574f3be70ed74aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00793.rs", "upstream_id": "BenchmarkTest00793", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n crate::shared::send_error(&format!(\"Error: {}\", auth_header));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cf85f2280857b04107b9bf3e9be9f7634ffc0cf31c9d891a7ffc3d9884094b6", "structural_hash": "1a6cbe675c945e57d93ebe5066bf3bef70dd708559bb494a70a99df12a828319", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01319.php", "upstream_id": "BenchmarkTest01319", "language": "php", "code": "text;\n $data = call_user_func('strval', $userInput);\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2e26c81ffe284254d038d7cff8e3be355a1110b74f99b633a4239e5d9f93fc6", "structural_hash": "bb2f790c1b3c40bcb5428315ce917cbd1331b1cadd93ee2fcb47e63b9f1efd18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06126.ts", "upstream_id": "BenchmarkTest06126", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "126acb4ad3ccb887f41be4581526df6f607ff833582022f56f3725b27f8caaba", "structural_hash": "6faa67328a9d82a894ec4bbe9bcaba0ab9046406a14e78a3ac7d3217f8652d54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03947.rb", "upstream_id": "BenchmarkTest03947", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n if Time.now.year >= 2020\n File.write(\"/var/uploads/\" + File.basename(data.to_s), \"data\")\n end\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1596de3251943e499106747902bc15855389a7a4ebf05d2a4d8e54e71e39ae0", "structural_hash": "3de3d4ba059b64c24322ae4de231ad02d626e54ebc52867e534346e526be9c76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39681.go", "upstream_id": "BenchmarkTest39681", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/sts\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(refererValue)\n\tcaller := data\n\tif caller != \"arn:aws:iam::123456789012:role/trusted-svc-a\" && caller != \"arn:aws:iam::123456789012:role/trusted-svc-b\" {\n\t\tc.String(http.StatusForbidden, \"caller identity not trusted\")\n\t\treturn\n\t}\n\tstsClient.AssumeRole(context.Background(), &sts.AssumeRoleInput{\n\t\tRoleArn: aws.String(\"arn:aws:iam::123456789012:role/app-readonly\"),\n\t\tRoleSessionName: aws.String(\"verified\"),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c59842e3e2df4c4aafaca37ff09d5d1a6b674d76fa3eb8e91e5326284461160b", "structural_hash": "6361f87324408a104fe59684d135de9a5fbf1c2b02e40a0dcaf607ab0496836a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03153.py", "upstream_id": "BenchmarkTest03153", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef benchmark_case(request, path_param):\n path_value = path_param\n data = '{}'.format(path_value)\n requests.get(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59f24beb97ceb5adb6871e9dab10a2b231180641ffab23b8625727ef14f46126", "structural_hash": "dff4c05acf068c7a0f2530de21d2a476d7ddfdc0b224e57dcd82659ddee73754", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06707.go", "upstream_id": "BenchmarkTest06707", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuaValue := c.GetHeader(\"User-Agent\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(uaValue)\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-359"], "category": "private_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39cf9ebb5a46272e7c5d9a81fb56963657ba065c78d2f4916e83cc08224a3796", "structural_hash": "1c00f05616efb8455360659b8f0e0fd648bdc21b1e2b0cf328db1c12d68b1b7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01274.ts", "upstream_id": "BenchmarkTest01274", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d453aa39b0fe671e1da89f34ed40f205183971f8aff1d20f6947af45fe53b96f", "structural_hash": "94810b5cda086fdb832ed19e80f70b0fa2c1b6bdd10e9cfa4aff127bcbb4db09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01491.cpp", "upstream_id": "BenchmarkTest01491", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + safe + \"\\\"}\", \"application/json\");\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b2e0ebe0ba7f074f56775c9c36f0b9bd20d341ea5c9ade04ae6c59d13432034", "structural_hash": "64cdb2622f545824b3b2434cfc32681fb9add00f974038e019073c816cda2948", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02736.rb", "upstream_id": "BenchmarkTest02736", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = format('%s', user_input)\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => data}).first\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c805318ea6f7c2b57c9a491f63fde5e49921576033b2de9e2ea791b612634273", "structural_hash": "1954998b1f4507ca6ce817add7f609559c76cc34d30ab55f9b24523675235eae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00914.cpp", "upstream_id": "BenchmarkTest00914", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data = std::string(\"value=\") + user_input;\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da61328f9f81499a0155659cf0ec90b6faaa2f56b49f298d57c0f438ab595c18", "structural_hash": "b0040c4bc2126e29ffc2ac9c6e03e2392245439cbcaf695acb7cb395e57baabb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01435.rs", "upstream_id": "BenchmarkTest01435", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let data = if env_value.len() <= 4096 { env_value.clone() } else { env_value.chars().take(4096).collect() };\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b17371d64a263cc216eae2069fb6d0f27fb1a8ed1f816b7c412b08f6d8bd447", "structural_hash": "6301655a9524a0c979a2c23e6d7da73fe9e2ad33640d0849c4fc0d2d1b271d22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01825.rs", "upstream_id": "BenchmarkTest01825", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (xml_value.clone(), \"http\");\n let data = payload;\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a73a9c14ebbfce525d27d334893597c744dd9c19183472b2bf94e3fe30b489e", "structural_hash": "6f07734c42df9ff02d73ada730f3719a6715ce9d1161011dcf2a7646d7fb8f58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_22339.go", "upstream_id": "BenchmarkTest22339", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tcapture := func() string { return graphqlVar }\n\tdata := capture()\n\tvar result *string\n\trow := DB.QueryRow(\"SELECT name FROM users WHERE id = $1\", data)\n\tvar name string\n\tif scanErr := row.Scan(&name); scanErr == nil {\n\t\tresult = &name\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"name\": *result})\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5834c4db09c074fafd107f6286a2645d716754cfa7c9b6fc7aab401b22877db", "structural_hash": "f2b1e4c1e4e2395b75d2b27cb19d1eb067c7c6de7d5eb68ec29ad37ba21ebf29", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00014.sh", "upstream_id": "BenchmarkTest00014", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n mysql -e \"SELECT * FROM users WHERE id = '$processed'\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df6a314f34187ca7507f8ccd6dcf83571fc0bd99d1c54b28aaac52e396809a4a", "structural_hash": "4b8949ae0ca7dc2245eb24a67a42129fa6c676fa7545015672071342c3a9fe93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22379.sh", "upstream_id": "BenchmarkTest22379", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18a4b1fe2d3255acea2ba9a77e808116b5b08ba6e36703da597502fb5d80d302", "structural_hash": "89ce6d8e0b00bae126e5c9f92390e19ac5304b02c026fe4848ba74f2484349e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03615.rs", "upstream_id": "BenchmarkTest03615", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(xml_value.clone());\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c07c5ce7d79465b3543dde89a30a81313d1c1c8207ca3a030ac45f91669c7865", "structural_hash": "bf1161ccc0d7cd5d82e1a7af1026f279f91081d01a2db8f24c6ae3f1923f7975", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05030.php", "upstream_id": "BenchmarkTest05030", "language": "php", "code": "name;\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "757ff32667a77c40e24e2a9c843a42b1e3856686a246a82c561f3b22f052b3c3", "structural_hash": "83e7b9051da2e961ed2e62e7b9d8a3e1a72e3207eedddcea79fc114252212025", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01651.php", "upstream_id": "BenchmarkTest01651", "language": "php", "code": "cookies->get('session_token', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5081aa933fa5c348f366f92cc64c53e136c17382262d3d72c8e21ec23952e15a", "structural_hash": "69bd343e801257d29f8d6b98cfead2073d52daac0e0d0644355fddade3744eb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28851.js", "upstream_id": "BenchmarkTest28851", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = userInput != null ? userInput : '';\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-332"], "category": "insufficient_prng_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d040747a3530938fc164e44372ad0ef1a34d95c16abadaf320a2bc717b4d80c3", "structural_hash": "86193ae0e14b7883639da3c6acb4bb153d7ce9441bb4f504783248f5ed02cf82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03349.ts", "upstream_id": "BenchmarkTest03349", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data: string = shared.passthrough(userInput);\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32c70e1936b24e393451568d0b498df5198be3ac70d78af6ab396adb509a8c1a", "structural_hash": "56a0a159cf4c43fcd7e973e565c3eb887130acb14e8c9c3c8eda0ec92a3f6d27", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10584.js", "upstream_id": "BenchmarkTest10584", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd8ce1060c466fe5b120007c0616884244284bfd9f7fe73788f2ad4a43c2a550", "structural_hash": "9b1f0160a5fc08802ec9ef31a835a569416dd687adfcb16f0645c5526ef441a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05070.py", "upstream_id": "BenchmarkTest05070", "language": "python", "code": "from cryptography.fernet import Fernet\nfrom flask import Flask, request, jsonify\nimport os\nfrom types import SimpleNamespace\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n ns = SimpleNamespace(payload=auth_header)\n data = getattr(ns, 'payload')\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdc4a019a3c81cb779e332428bad1d22e00248b7b80cfa1d5525dd9ad58572f4", "structural_hash": "44998f310762bea756f4123ba85e91367ba0c707d4fbca006ae0ffa1f5e76792", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01739.rs", "upstream_id": "BenchmarkTest01739", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = xml_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n HttpResponse::Found().append_header((\"Location\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0db8518461e12760f0a1c0792f88efeb4f7459cf1339cebc64a2536a9f9b0e81", "structural_hash": "1d2e4ec8ab7745c51f44768d117a0349b7eaa4534359439702281b2471a2cf5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02494.rs", "upstream_id": "BenchmarkTest02494", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (payload, _origin) = (origin_value.clone(), \"http\");\n let data = payload;\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f3f5fe58d1cbc7cd59c443d45aaf2826ea3c2253e3d7340803bbe6d8ba1c5c0", "structural_hash": "ca83aa238b5a3374ea468257d51012da2cb3726f20049c6292f2b5b86cef9abe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00157.sh", "upstream_id": "BenchmarkTest00157", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n data=$(printf \"%s\" \"$user_input\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"Content-Type: %s\\r\\n\\r\\n\" \"$processed\"\n printf \"{\\\"status\\\":\\\"ok\\\"}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be127915f6549ebd0da7f1042ff3bf736ec8c0fe485ee78c5e11d50ac8973e5a", "structural_hash": "a6f50236132a5152c8ebf2c07139e0bd86dad789480a8d196d33254749810fce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04463.sh", "upstream_id": "BenchmarkTest04463", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n eval \"curl -s \\\"$data\\\"\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fd27adbf146b0b774dce2cbb203372641e454245ba9fd2ced59a1823872a080", "structural_hash": "3a2cf4389a38c36014d45aca6dbfaf4856588a632c842e10e6c6c87791ccddb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12805.go", "upstream_id": "BenchmarkTest12805", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tlastRequestValue.Store(fieldValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"request processed\")\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4679d9477f9fead664d2cf26b8fa6b96cb73e69beb835d81e4071f59faae3ea2", "structural_hash": "10a4655d47b02939c17208cf3f35830032b91223951408fc41afc44a73464a2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04835.py", "upstream_id": "BenchmarkTest04835", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data, _sep, _rest = str(cookie_value).partition('\\x00')\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n with open('output.csv', 'a') as fh:\n fh.write(str(processed) + ',data\\n')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e59b01da90ce69375918feda0079d2d0b5bfb4eb2d2514315d2a40234a6c973e", "structural_hash": "900cf7057057bb9bed328f19ebe3d529dad316e3e207c3774973e44bcafc0f1f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01684.rb", "upstream_id": "BenchmarkTest01684", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n requested = data.to_i\n allocated = requested + 1\n render json: { allocated: allocated }\n end\nend", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "494138ac20a9ba81b76b855d18248629b427652af03f1ce0252dfcb987cc5431", "structural_hash": "4573376e5b54a7915168ca69ecc2ecf069aa2b80c59378e61fc78cb23b920802", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03564.rs", "upstream_id": "BenchmarkTest03564", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", db_value).ok();\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "544e18a188643466e4cdac33372272fe7d42f2ef828b4b408044543f95959c84", "structural_hash": "9dd65a96173375a79d432fd196cd36657ff7bec71e513f0bc5da6b6e4729f102", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04007.py", "upstream_id": "BenchmarkTest04007", "language": "python", "code": "import os\nfrom flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n env_value = os.environ.get('USER_INPUT', '')\n data = '%s' % str(env_value)\n os.system('echo ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e40ebb61b7603cf5016bf20c7d0d539f5c86939e589bdf62c0e5d216fd10f49", "structural_hash": "ac933897e75aa6c27be4ecfb6e5dd4a1f6236aa2469d92da3b706c6137cd205a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00450.java", "upstream_id": "BenchmarkTest00450", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Function tabNormalizer = s -> s.replaceAll(\"[ ]{2,}\", \" \");\n java.util.function.Function decorated = tabNormalizer.andThen(String::strip);\n String data = decorated.apply(cookieValue);\n if (data.length() > 2048) { return Response.status(400).entity(\"schema invalid\").build(); }\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n return Response.ok(\"{\\\"status\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab858088eae3760c0e0c679bd0273a21d1612d402bbe6b1c1c61548f63123005", "structural_hash": "4685d89c33d457662f11ac2062ba235fe50fc57e734fbb04be3b08b368ad74cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00073.php", "upstream_id": "BenchmarkTest00073", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { throw new HttpException(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n $conn->executeStatement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bceb82f5831ef761367d0ff0991c7ec611d74b043d11a88a4e4451631958addd", "structural_hash": "d2a033483d88de6aa9c0ebcae25373d57abd2d7afe896926bacbe1807b7f142c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17955.go", "upstream_id": "BenchmarkTest17955", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar _b strings.Builder\n\t_b.WriteString(rawBody)\n\tdata := _b.String()\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5aa9acbdbe2db8428ab0f4ca47c99dfaa6a3f7a64509daf6fe45d71a0b9477b4", "structural_hash": "2c82dd4db7481a1b7d4db9daeec38c201dbb65c8c529d34262a6e6b8671990b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04785.java", "upstream_id": "BenchmarkTest04785", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n FormData payload = new FormData(rawData);\n String data = payload.payload();\n java.security.MessageDigest md = java.security.MessageDigest.getInstance(\"SHA-256\");\n byte[] presentedHash = md.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n byte[] storedHash = java.util.Base64.getDecoder().decode(java.util.Optional.ofNullable((String) request.getSession().getAttribute(\"credHash\")).orElse(\"\"));\n if (!java.security.MessageDigest.isEqual(presentedHash, storedHash)) { return Response.status(401).build(); }\n return Response.ok(\"{\\\"auth\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ddb8bfbed3dff8a55f6ec794cea8888969d9926cd19a11f6758f533afa8ad8c2", "structural_hash": "5b43e9ab1cbc6af5d16010f515547626ec45f562a5827de090e21f5a75ca5ba6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05962.java", "upstream_id": "BenchmarkTest05962", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Function firstStage = s -> s.replaceAll(\"[ ]{2,}\", \" \");\n java.util.function.Function composed = firstStage.andThen(String::strip);\n String data = composed.apply(cookieValue);\n if (data.length() > 2048) { response.sendError(400, \"schema invalid\"); return; }\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47408f3ed06fd57c803178d9b90916b15060eafe65506dc0dc15b68b60f5ef4b", "structural_hash": "8da8740406d24e54853186ca6f40d49b4dcaf5df3c2a05d9c2f705d165d82803", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29846.sh", "upstream_id": "BenchmarkTest29846", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n tar -czf /tmp/archive.tgz $processed\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "712fd4af754bffe136c56c912a77de0073217d5a5ca2214c500d02af3fe81ee9", "structural_hash": "786cb8d0e06d37841bcaf4b9d26db02757fe4132a786825dababc70cd4ef2ce3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02221.ts", "upstream_id": "BenchmarkTest02221", "language": "typescript", "code": "import { Body, Controller, Post, Req, UsePipes, ValidationPipe, InternalServerErrorException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Req() req: Request): Promise {\n const userInput = dto.payload;\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n globalThis._loginAttempts = globalThis._loginAttempts || {};\n const _who = String(data).slice(0, 64);\n if ((globalThis._loginAttempts[_who] || 0) >= 5) { throw new InternalServerErrorException({error: \"too many attempts\"}); }\n globalThis._loginAttempts[_who] = (globalThis._loginAttempts[_who] || 0) + 1;\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { return { authenticated: true }; }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "982ff7acc42550913dc93758f549d4c7f5a6c57875092f2abd46f1535524790d", "structural_hash": "17e7e003d78afcdfbbf2f757934752f6ebb9482842eb9536b01318f2f273f583", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22639.js", "upstream_id": "BenchmarkTest22639", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = String(userInput).slice(0, 200);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7fd4ca5f73606410d201697a74f7b8f872e9faa0f8f3e88c0a829d6ecf4dbb4d", "structural_hash": "8eb7cfc33c6d33a1167bb105e06ca138e8f475e2efa1682a83fd6fb3e9e7bcb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_02596.js", "upstream_id": "BenchmarkTest02596", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "689db7eb74f9485a021cd4093f88171db4bb43268bdeb8b1fc3aa45bdaf06e5b", "structural_hash": "3fc5d97fda802fa635e6bd959de5d4c9ffc89747ebd28aee8e19b8ac8a1b31f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10989.go", "upstream_id": "BenchmarkTest10989", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- cookieValue\n\tclose(_jobs)\n\tdata := <-_out\n\tos.WriteFile(\"/var/data/secrets.txt\", []byte(data), 0644)\n}", "label": 1, "cwe": ["CWE-256"], "category": "unprotected_cred_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "811f1cea00d454ecfe3ded8afb2c54050eab7dbcf7e801b0134ff1cac33013fe", "structural_hash": "4a833814b3002a38e23e08e58e47a934706a5a3c3ceac3aaa61a9b7991aec823", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03824.rb", "upstream_id": "BenchmarkTest03824", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n requested = data.to_i\n allocated = requested + 1\n render json: { allocated: allocated }\n end\nend", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af7675f955dcb2ee9df8db6266130b67165c373e48646cf4111dca7f5feb6f70", "structural_hash": "33df68e55ede5b771c8bc36698e3649d28eee29c9abb8fea52cf833d4ee6841f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05884.c", "upstream_id": "BenchmarkTest05884", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n void *_h = dlopen(safe, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "736d6ec845b42b4cf2da2fac4a1207565f341efb93b3c1a65f448e9486f6fadb", "structural_hash": "414b40f7bf5d7b245c4f0054dadb36f7b6107ffdb42ead42b4b981eb2bcc2d0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00071.rs", "upstream_id": "BenchmarkTest00071", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse hex;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = String::from_utf8_lossy(&hex::decode(&cookie_value).unwrap_or_default()).to_string();\n HttpResponse::Found().append_header((\"Location\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b17c40f13f63f2d670ede4d827e0feadea3367dcba88ae47a7a3c83743c8f4ed", "structural_hash": "517c70ea60ccd4eb4c2e8e8a849b56aad8061ed32497cca9f0d11c32470160a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06792.sh", "upstream_id": "BenchmarkTest06792", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n echo \"$data\" | tr 'A-Za-z' 'N-ZA-Mn-za-m'\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c29d22c8991332d89fd109b235a3450743d66eaf9aa5bbdde3df08cb83d49ddc", "structural_hash": "877a553982fe6920e4e1ed4784329307e87d079f9b0ffe64679d36081119c90e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03690.cpp", "upstream_id": "BenchmarkTest03690", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = !user_input.empty() ? user_input : std::string();\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0bd809921c9f597a17f21ba307d0bfe10ec6f410631f5ba39643702dc8b8339a", "structural_hash": "c73a8a3d1b9408b3555216c0511d91c4858f7ad6a9d771787d9f135069acadad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02929.rs", "upstream_id": "BenchmarkTest02929", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n let data = serde_json::from_str::(&config_value)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44c99a2fea0eb005a2a1025186f43021d0dfcf42b7097e41025b3ccf4a3329d0", "structural_hash": "8f82a0a06a877f98be8c9908ce322d2e63145c2deb24b3b95ca67aa8b3f20107", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_31816.go", "upstream_id": "BenchmarkTest31816", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, commentText))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\tc.String(http.StatusForbidden, \"access denied\")\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\tc.String(http.StatusForbidden, \"access denied\")\n\t\treturn\n\t}\n\tcontent, err := os.ReadFile(\"/opt/app/plugins/report_renderer.so\")\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a265e73fd9b49f2c6eccf27d6ee5599274760d01a1b2606b2df213ce95bb74f5", "structural_hash": "aeca9df0b114863e0f7d4fade5ee0153d44fa04f29cf0eab5f32100512976469", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04345.rb", "upstream_id": "BenchmarkTest04345", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52db4e9cc6b1e04b75df0b66c49637c405b6eb9cf58de9c9bb5b949a535b2633", "structural_hash": "44b7fa68acb09774a671a00a48c3090d68e8357502948322656e657c9da67b32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_20471.go", "upstream_id": "BenchmarkTest20471", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tholder := InputCarrier{UserInput: originValue}\n\tdata := holder.UserInput\n\tw.Header().Set(\"X-Frame-Options\", \"DENY\")\n\tw.Header().Set(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\", \"view\": data})\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19360d9b1c548e8c2d6d68078baf292432b25acc8b6a54260bb4e11ffd28cc85", "structural_hash": "766560178d3d92028d92fc3f5ecff9c19d16723008f1e5cf09981fac0466c8b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00700.rs", "upstream_id": "BenchmarkTest00700", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let captured = upload_name.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16a4535c644c1ffc9f0eab52e028cdda75daaaf1f39ba822f3e166f935f160ca", "structural_hash": "d9d453c7907758662770e102a1f5c22a5a1b7bd852eb3f40148b22580bb18a5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14128.js", "upstream_id": "BenchmarkTest14128", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = `${userInput}`;\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c10f0ab699f45a4935b339187296cb47770d3f5671fd961f9fab42ae595bb5a5", "structural_hash": "5d5659213b12ad5350650d240c4db71d43a28b8bb781aac5bc98782404abd200", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03559.py", "upstream_id": "BenchmarkTest03559", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n parts = []\n for token in str(field_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return jsonify({'error': 'invalid integer'}), 400\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return jsonify({'allocated': allocated}), 200", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f9e2022fc12780b3dd45fe63fa76804fd1dd5d17894558c914b257e12d69c87", "structural_hash": "5287e6a39f5d8107f967caeb793da72d31d6935cf8d9b75dbfc884957ff59885", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01741.rs", "upstream_id": "BenchmarkTest01741", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = forwarded_ip.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95cb174587c569cfc61b1d2f6f20b58d6418414dbb658f6204ef349bce2bab79", "structural_hash": "8f428d4c5ff3d204343d3b7de56b03ac673e2313ae75d3a7fae67f0c6d505d38", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02875.java", "upstream_id": "BenchmarkTest02875", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(xmlValue);\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ddb10426a08c08560c64166dc019aa1eec636edd247c0ece335e64b0d9da3baa", "structural_hash": "ec5971102ee4d51ccea7a47734e409d121e18f419029c9fbf60c52f8f5fd9d73", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03494.rb", "upstream_id": "BenchmarkTest03494", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n return render json: { error: 'forbidden' }, status: 400 unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n session[:data] = processed.to_s\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "056e9d6bf2410af593dc5f714b0a3857f5eddff04c3ba2d5c68ef19e3e87090b", "structural_hash": "ba8486e5ad376e17178e6485c426d44d73bda466578029fd519044dab6abdc04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08048.go", "upstream_id": "BenchmarkTest08048", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := strings.Join(strings.Fields(authHeader), \" \")\n\tencrypted := encryptForStorage(data)\n\tos.WriteFile(\"/var/app/data/store.dat\", []byte(encrypted), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9619808a83d73741d3e206e983d770162386326ff153c03f4493c6c86ce9da04", "structural_hash": "3d96e9899bd2527e9dad0ca2081670b0745c911f6b4143538d9c30f9a82203b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00085.ts", "upstream_id": "BenchmarkTest00085", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = \"\" + userInput;\n if (!shared.authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8ab89e110d6b2e110afcf22f9f7a48535d0430cbca8bb189c6f69cba133d438", "structural_hash": "218d52af4269a1d18838728394cfa36a61b137750f409d8c6fcebec148a47d46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04778.py", "upstream_id": "BenchmarkTest04778", "language": "python", "code": "from flask import Flask, session\nfrom flask import request, jsonify\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = json_value if json_value else 'default'\n if session.get('user') is None:\n return jsonify({'error': 'unauthorized'}), 401\n session.clear()\n session['user'] = str(data)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c9aaf114f790e6fa424a36df04f3bfd9c8b27ab3aae41608c9661627e861623", "structural_hash": "3145c2bad6d3cf13fb997714a1771d531fcb050759113b9fa0c5397330a91628", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07433.sh", "upstream_id": "BenchmarkTest07433", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-337"], "category": "predictable_prng_seed", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ecc2b401e3a5e8011fc69cfb8d573947ccdd023f865a4e51322217656e404a2", "structural_hash": "17aaf7b573de95c57f67110c8f39e1ff9d0bd90e8540f9db0bc27ed58b5235f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00872.rb", "upstream_id": "BenchmarkTest00872", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n File.write(\"/var/data/output\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d52fd5807d399a284ce6a87a57f95a8e6af178cdcab2c82d4be251eea4de847b", "structural_hash": "7b46c37ded951fa6e7b17b417f3e21a539e2628763a8d481d6dc7ed758849c49", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03063.rb", "upstream_id": "BenchmarkTest03063", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"feature_flag_value\"\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n _secret = ENV.fetch(\"JWT_SECRET\", \"\")\n _token = OpenSSL::HMAC.hexdigest(\"SHA256\", _secret, \"header.payload\")\n _ = _token\n render json: { jwt: \"signed\" }\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b8c7aa4caa2db3c37aba171bbced0a39c2301d1fff875c235452332d9f18b14", "structural_hash": "bd17a019dcff441d6254f87c7e575ecf5ca30abf91a8d64ae20f4269a9afec23", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28164.go", "upstream_id": "BenchmarkTest28164", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"net/http\"\n\t\"strings\"\n\t\"text/template\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := strings.ReplaceAll(authHeader, \"\\x00\", \"\")\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\ttmpl, _ := template.New(\"unsafe\").Parse(processed)\n\tvar buf bytes.Buffer\n\ttmpl.Execute(&buf, nil)\n\tw.Write(buf.Bytes())\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ab8e635cd44a2fb609b01346de4f9b7240d4dfa6964ddcc93dc87144e74c318", "structural_hash": "8039fa5843d73bb801d6c384995fdfbbc51dae368af46c95fa8e642a5de82f19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30262.sh", "upstream_id": "BenchmarkTest30262", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _bypass_re='^[a-zA-Z0-9 _.,;:/=()|+@-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n echo \"$processed\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89cf6ba1502168c9a454174401be0264e3efe161729ce9832978010062c38212", "structural_hash": "134688fb9ccbfa2e9c26d1e474d7fe929cf49996244725df15c62a49c790f357", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00083.rs", "upstream_id": "BenchmarkTest00083", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = ua_value.to_string();\n if ![\"config.json\", \"index.html\", \"readme.md\"].contains(&data.as_str()) { return HttpResponse::Forbidden().finish(); }\n let checked_path = format!(\"/var/app/data/{}\", data);\n tokio::fs::remove_file(&checked_path).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ee7ddbfa928a335d2666b7a6685883fdccc36e6e19e0a2bc8a52b9744705f5c", "structural_hash": "83ffd180009ea0042a597b4f4eeddf87dddd260d5fbc4bc5d34f361eadb4e9a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00510.sh", "upstream_id": "BenchmarkTest00510", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n _fname=$(basename -- \"$data\")\n case \"$_fname\" in *.jpg|*.png|*.gif|*.pdf) entry_file=\"$_fname\";; *) echo \"invalid file type\"; exit 1;; esac\n echo \"uploaded\" > \"/var/uploads/$entry_file\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2dd074488f111f3a67ca919684c919f752a92d599bdf74b394e18cc2472be7ed", "structural_hash": "5e84529883afc4585bdbb3eda9a9220c26609be4f60e700c5556971de446c7d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04986.java", "upstream_id": "BenchmarkTest04986", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n String data = \"item_%s\".formatted(uploadName);\n try (com.mongodb.client.MongoClient mongoClient = com.mongodb.client.MongoClients.create(\"mongodb://localhost:27017\")) {\n com.mongodb.client.MongoCollection mongoUsers = mongoClient.getDatabase(\"benchmark\").getCollection(\"users\");\n org.bson.Document nosqlFilter = org.bson.Document.parse(\"{\\\"username\\\": \\\"\" + data + \"\\\"}\");\n org.bson.Document nosqlResult = mongoUsers.find(nosqlFilter).first();\n response.getWriter().print(nosqlResult != null ? nosqlResult.toJson() : \"{}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65b1525b9d14d7627ebba3d47a5fd7a45cb49d229629e0c5e80e0850b7353525", "structural_hash": "d58decec7fce7a0e10528930e30c494a20f4a9434aaeb1c3412b7a99c1f5edeb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03354.ts", "upstream_id": "BenchmarkTest03354", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n res.set(\"X-Custom\", processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f754a35de6087f4a3c52d72e320e5bcf677e3110f9166b1e5c3a997f32c9f39d", "structural_hash": "f17cfd0a25de25d67247f7caeea6dcc85305eb3af7757bf4f11ed31add6691fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02768.rs", "upstream_id": "BenchmarkTest02768", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let captured = cookie_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n #[cfg(unix)] { unsafe { libc::setuid(65534); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61913d415b3bcf82f86a8a24573523df91f40b6166718fb8e4543c878e862435", "structural_hash": "6850dd419a6d9e0a0cc00bd783699dc673bd61926e91bb763e4b9a13454742da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20178.c", "upstream_id": "BenchmarkTest20178", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"%s\", data);\n execl(\"/bin/sh\", \"sh\", \"-c\", _cmd, (char *)NULL);\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "036c51289f12286afed34ef2f44264f471dc3c0d02675f8fb1e9ffab580f0ec7", "structural_hash": "84af2f111369097c08e81a27217befa99a2cb24f6326273d479d74a98bd86ff5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03844.cpp", "upstream_id": "BenchmarkTest03844", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n std::string user_input = (argc > 1) ? std::string(argv[1]) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n std::string _out(_p);\n delete[] _p;\n std::cout << _out << std::endl;\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d31ec95b622b10619679e746f62bceedf40a38e9cf04357d030a731a97db305", "structural_hash": "8da31ba336cf28996d60da6dd4d48f6448bc0184ed93d6293a8f66a02fd74c35", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15393.sh", "upstream_id": "BenchmarkTest15393", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n printf -v data \"%s\" \"${user_input}\"\n case $data in\n a) echo alpha;;\n b) echo beta;;\n *) echo unknown;;\n esac\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a97e5fbcb0182eee001dc667c1c82440d62129ee302eb8b4a36cd8aa46a11301", "structural_hash": "d3c0831c24a33f4be0cf8e32e3bebde08be1bb797ba7048ce1ba370538e255ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03023.cpp", "upstream_id": "BenchmarkTest03023", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "981c517c4f29a58e070af0ad20c500cf341700632ab8d461fc50d2e94e7c18b5", "structural_hash": "e5bf1e5c7d88d6b55eb777d9435b589d489c5516bf5fe0d983752e6a690e2447", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05451.rb", "upstream_id": "BenchmarkTest05451", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n entries = Dir.entries(data.to_s) rescue []\n content_type :json\n JSON.generate({ listing: entries })\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d26bed6fb3b10355e5598ab854caea853b22b4d2aaa493835974fa298f26cfc", "structural_hash": "7a52e088891c6d70a7701ebb1ff2b28525e4ee8b047170f51d2adf3d335e6b8a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01909.ts", "upstream_id": "BenchmarkTest01909", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "104628f5b58e1868a3a921c282ee3b55445c950e9ae13a0d9fb1f48108cbac97", "structural_hash": "1014b60786f295479ab96e0b828c34f8a53532f8b9b53adcac04ae38081eeff0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03430.rb", "upstream_id": "BenchmarkTest03430", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"shellwords\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = format('%s', user_input)\n processed = Shellwords.escape(data)\n system(\"echo \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37e7c448faec0f657562046fd6d339d4ba692ced8e7781cc821905b5d720b800", "structural_hash": "efce56551efe54f60398839c9e2ddf4f2c2561ed966030792623b6d01401da79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01731.php", "upstream_id": "BenchmarkTest01731", "language": "php", "code": "header('Origin', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n return response(\\Illuminate\\Support\\Facades\\Blade::render($processed))->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e069218e7413d17ca2608c6776e5b9d6f33a470c3c585f2c461382f2f463c369", "structural_hash": "fb1c8f1dc889771f9871a1b8553bc5b53b1f547f8bda820e102b6b900b76d842", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02429.rs", "upstream_id": "BenchmarkTest02429", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(multipart_value.clone(), |s| s.trim().to_string());\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ecdb8150064944941b974254b51ad7194088c71d2ebffb931692743cd78dab81", "structural_hash": "7333013f1303d99c0f28c6ad07482a882752070460bdf775400ce7f6e5c70685", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02671.ts", "upstream_id": "BenchmarkTest02671", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as net from \"net\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n net.connect(80, data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6814e927f3f10f9561fea3aefd7baf1ae7d78902ff05819121cae8785dfca2c", "structural_hash": "7d2f17bbacce6e79225933d9f524f3a8e802e068dd92da1c9c5aca7355519ced", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02845.cpp", "upstream_id": "BenchmarkTest02845", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"http://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58ebfc605832736e1e5ba9aa1917f3f878487c235ccf577f0344511341d4cf44", "structural_hash": "2deb0ff8393dd7c64e54431a00a6893a6ace96fc45db276ed024e31b7e338001", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01166.rb", "upstream_id": "BenchmarkTest01166", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n data = Thread.new { user_input.to_s.strip }.value\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n response.set_header(\"X-Custom\", processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "890330ff44173006211a365b8d2664a57677f094c05da4b629d0de8754b37a93", "structural_hash": "1f91fe1de05a2c86cf630f57f6c64ae608d8f49dcdc34c8a68817e832496931e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00977.php", "upstream_id": "BenchmarkTest00977", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $actions = ['asc' => 'sort_asc', 'desc' => 'sort_desc', 'name' => 'by_name', 'created' => 'by_date'];\n $result = $actions[(string)$processed] ?? 'noop';\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7695f2ff8e431e32f3c7d63ece36d742d35cd8206f878ee496bfc0e66da1049a", "structural_hash": "ced0c81cec8cf87f0af9b599f1bb54d222c793e217882941642034306efca54c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03663.py", "upstream_id": "BenchmarkTest03663", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n pending = list(str(field_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JSONResponse({'error': 'CSRF token mismatch'}, status_code=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77ef7b63568e6f0228edc33d24cb8ed5b8c4efab3ef743243d93208ae462e324", "structural_hash": "92c0a96be2ca661a085ce115aaaaea04b3a77ebd322470792d614aea6b68aa39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05803.ts", "upstream_id": "BenchmarkTest05803", "language": "typescript", "code": "import { Controller, Headers, Post, Redirect, ForbiddenException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Redirect()\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { throw new ForbiddenException({error:\"host not allowed\"}); }\n if (!allowedHosts.includes(parsedHost)) { throw new ForbiddenException({error:\"host not allowed\"}); }\n const targetUrl = data;\n return { url: targetUrl };\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a0c688bd3749c713f8354bf3dca93aa11cc6359636762eb81cc28fe18d9e283", "structural_hash": "4c69380f34b21ee99b39e06258caabc3e74192eb36c2b76e65671d11c58a8e93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33115.js", "upstream_id": "BenchmarkTest33115", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6df04e63229b8bc108e62eb9fd48d587917862279c22e393086d97a5b1170dfc", "structural_hash": "d82a6ddd5f9b79f292dd82795f4b292c70af9d0bc22a074e8a5371cd6f0ff1f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03594.rs", "upstream_id": "BenchmarkTest03594", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match header_value.chars().next() { Some(_) => header_value.clone(), None => \"default\".to_string() };\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef2b7e68fe9a9430312465f8ee0a6e221e55c279f77b19f93f89f9182a7d4754", "structural_hash": "04937c1036a4b6c81da6fd007a4485367d016252c9703c924bbfbab6a04d4c90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03771.ts", "upstream_id": "BenchmarkTest03771", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { res.status(400).json({error: \"field not allowed\"}); return; }\n }\n const processed = JSON.stringify(_incoming);\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n}", "label": 0, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "677c51119d6cd15bdea9b139bd981897be288a07a614eb0c81f3946faa05e5b2", "structural_hash": "9cf155357f95035301bb0ab2db939fe95f90b876004a54121ccefeb67ccef2d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05437.java", "upstream_id": "BenchmarkTest05437", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference valueRef = new java.util.concurrent.atomic.AtomicReference<>();\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n valueRef.set(cookieValue);\n String data = valueRef.get();\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d6ab954d2f0ee27f4764961e2ba4d1a85dd63d77e7ecab618828a5651fa1a6b", "structural_hash": "36faab33c5f66ac7a9c8a49606640233110da5aca273146f14759317e14f59b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02351.rs", "upstream_id": "BenchmarkTest02351", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = path_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n crate::shared::db_query_bind(\"SELECT * FROM users WHERE id = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8f1b938f77892e634dd76688fcfd361c69f19887e6f84d74d1af83cd0a02147", "structural_hash": "005d3d81f6fb5d853fdd57a8718784e44c2f90fa5deadcb38e26b3569d6dde32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19637.js", "upstream_id": "BenchmarkTest19637", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) { ctx.status = 500; ctx.body = {error: \"privilege drop failed\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59e095049cffde86ada61c85ff9e7d26eaf2d4c33c7dbef8b083cf9fdff9c5ed", "structural_hash": "6283774cb9d1a96c7ad8b46176bf2b26d31feae2c2f19ddfeff47b5fe82c9c52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02316.php", "upstream_id": "BenchmarkTest02316", "language": "php", "code": "cookies->get('session_token', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->set('Access-Control-Allow-Origin', (string)$data);\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28d7feab97cb2a47cbf5776b5671bdd20a5f2ea91eb8415606f42840faaa0f67", "structural_hash": "22a59852c82fbea74f09d828967fed3a7086b8210a114d4abf2d3272e9ecbfba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_38716.go", "upstream_id": "BenchmarkTest38716", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdefer func() {\n\t\trecover()\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(dbValue)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 1, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "665ff02e25232af342521c953dcd56dde368e8feca0608649c46d2c46abd5f02", "structural_hash": "4f53167590ad79fa2e0e79ddcfbae8fcf8339e8b812eadbf7bc2b9bde053f867", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04176.rs", "upstream_id": "BenchmarkTest04176", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match auth_header.chars().next() { Some(_) => auth_header.clone(), None => \"default\".to_string() };\n let processed = [\"true\", \"false\", \"1\", \"0\"].contains(&data.to_lowercase().as_str()).to_string();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f5846131c0dbbc060c945638bb198668f51a376b18518f60b6df189b5724b28", "structural_hash": "55302d20d1e646a445682e95728a3e3f03e5c3c3a9cc266512943254d526c6a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01846.rb", "upstream_id": "BenchmarkTest01846", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n render json: { error: data }, status: 500\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aead4a13526202c8aefb8385d4558ae2f42395203ba808c9fc8829e2f930515a", "structural_hash": "e44d52b18e28cdd210922c02f11bdd529e045025137c6c0feddf9be8dcfedf15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05951.php", "upstream_id": "BenchmarkTest05951", "language": "php", "code": "header('Authorization', '');\n $data = str_replace(\"\\0\", '', $userInput);\n mt_srand(ctype_digit((string)$data) ? (int)$data : 42);\n $token = mt_rand();\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc5fd6de1751f7bc2ab1236b037562daa4d10ed4cf8f8ed8b154be133c68c9aa", "structural_hash": "8f03064f808a06b3be47a2a38292f0752ebccd9f4049292b1776149eae9ccde8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19174.sh", "upstream_id": "BenchmarkTest19174", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be079f7653b57c9b270c9aa6c9dbd9f55c4e771db10f91980d2664d4be231fcb", "structural_hash": "6508c585b90b18683e273e4251bb9f48d27cac4bdbe7f202b8b4b40005538a7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00022.java", "upstream_id": "BenchmarkTest00022", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { PUBLIC, INTERNAL, CONFIDENTIAL, RESTRICTED }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", hostValue);\n String data = sw.toString();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n response.getWriter().print(data + \",data\\n\");\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "706857289c770f9e26a180e7fe1c00e40c0eb161b6e9934a357e21e933f6b22b", "structural_hash": "2b6b3f316b887472dfc30bf63125982c25f9d9168806bea2528e60c11cea9f12", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_40572.js", "upstream_id": "BenchmarkTest40572", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const data = userInput != null ? userInput : '';\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n eval(processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1d5a23ec67f509097f69c78941d139a2544e6b9ef16fd49b7cf39f25d3c9d18", "structural_hash": "2cbf5ea3a7f895cc347f68c37bb22bd05b456d56c0117cd3d617b2eb1b929564", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04771.java", "upstream_id": "BenchmarkTest04771", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String prefix = hostValue.length() > 0 ? hostValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = hostValue.toLowerCase(); break;\n case \"f\": data = hostValue.toUpperCase(); break;\n default: data = hostValue.strip(); break;\n }\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { response.sendError(502); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b67e36503d9f656db8aa1fb86232a3c2722e4500c2f2797a7cd30842c236395a", "structural_hash": "320c18703211045780b975e90be5afd447e00f4b2b9b7e9a71db47458acf43a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01350.rb", "upstream_id": "BenchmarkTest01350", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = format('%s', user_input)\n render json: { error: \"Internal error\" }, status: 500\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3db440cd6b5f0a3e33bb352aeaf7af449be81c2af732f12c1673d2f1a4e28a55", "structural_hash": "0ef47f26c3b0801f8c248b470d6e1f02fc64a3a953c81024dcbba311d6743436", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04570.rs", "upstream_id": "BenchmarkTest04570", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data: String = user_id.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| user_id.clone());\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9814ec1626ce19b20f9b08418cf4ed47e99ac08d927d9625cbb30b3da3ffc0bf", "structural_hash": "eff8b9180d310aec1bf6ff7a1700aa12e2fb554636fa8ca4a0d08c59081aa7d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03084.py", "upstream_id": "BenchmarkTest03084", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = (lambda v: v.strip())(field_value)\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e024e57ecf07b19d960c32efa025d46c87745c22c0907ad5c81d0ee3c29c295", "structural_hash": "d05427631251e3d00415c4f11fee0f1a466c1ee77a9d5139b2513a385368149d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16199.c", "upstream_id": "BenchmarkTest16199", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6516ae7e99486f675a0400ce261be1b14d88039b243be075b14f0af19626f2d", "structural_hash": "cd86db8208264568a2b8536fc2dbae63a46921e860369f33fb7a3c83b2053ac6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12133.js", "upstream_id": "BenchmarkTest12133", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-922"], "category": "insecure_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9aed56decd6d7f6900c7d6ea5afcabb0e1b9c3afe7783d19e440698db4e59850", "structural_hash": "ec041ccc7ae55ee05ddb19eed866dee2d3b5eaa57089b77146b46e8463ad799f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02986.rs", "upstream_id": "BenchmarkTest02986", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = \"config_secret_test_abc123\".to_string();\n let mut pending: std::collections::VecDeque = secret_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let _ct = crate::shared::encrypt_with_key(&data, \"sensitive-data\");\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a16849883f441a4bb0206bb0a6dd2d3f780c942a18aa27cac3ea742cfca1eee9", "structural_hash": "d913d1b4e95a9341115d45c522bf68aa8d63fa92728f27a5da892509bdbe67a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05943.py", "upstream_id": "BenchmarkTest05943", "language": "python", "code": "from django.http import JsonResponse\nimport os\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n parts = str(raw_body).split(',')\n data = ','.join(parts)\n allowed_ext = ('.jpg', '.png', '.gif', '.pdf')\n if not data.lower().endswith(allowed_ext):\n return JsonResponse({'error': 'invalid file type'}, status=400)\n entry_file = os.path.basename(data)\n with open('/var/uploads/' + str(entry_file), 'wb') as fh:\n fh.write(b'data')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1361e89ae4ff58577fba0b69718ce9b79ccdbc7760eb7df97a180a4747044054", "structural_hash": "6397dd13b04f19b18d65825f69066057b7429ec378de8ef337aa053ff6776351", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00758.py", "upstream_id": "BenchmarkTest00758", "language": "python", "code": "from flask import Flask, jsonify\nfrom app_runtime import auth_check\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n secret_value = {'secret': 'p4ssw0rd_test_xyz'}['secret']\n data = RequestPayload(secret_value).value\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7d249e167ef10f2c398df248a3bcfd79624b8959c8c6307318484a03a9b4932", "structural_hash": "669881bd2d2afe12fd37905e4befc7ea13e778f094b0a96c165cf813e7102b81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02748.py", "upstream_id": "BenchmarkTest02748", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n data, _sep, _rest = str(origin_value).partition('\\x00')\n record = db.fetch_one('SELECT * FROM documents WHERE id = ?', (str(data),))\n return JsonResponse({'record': str(record)}, status=200)", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c0439c741d2e32270a84f376f1f078b16bacb84114c81e5a835d29b2987faba", "structural_hash": "dd07fa43d80cba43a0471dd5f552080b4a5679382b391725901bbdb7a5253739", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03643.ts", "upstream_id": "BenchmarkTest03643", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as isoDompurify from \"isomorphic-dompurify\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const processed = isoDompurify.sanitize(data);\n res.send(\"
    \" + processed + \"
    \");\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eaeceed08d0a676b90996848dc03ada85c85fc5de08686fcb61d2ab5731eabf3", "structural_hash": "ab19546312f220163acd41ed7fa478acd08e1333842cc0fec24faf5e285ce35b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13111.sh", "upstream_id": "BenchmarkTest13111", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT bio FROM profiles LIMIT 1')\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n echo \"data\" > \"/var/uploads/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2b5d307fc8b48516bc80bf4a6053666079dcd7a2001dc46bd9fb3a45c208bc7", "structural_hash": "97e10aa383e2c5bd9ca418647905435e3671742fa3a0c813800eccdd8e9f06e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05728.php", "upstream_id": "BenchmarkTest05728", "language": "php", "code": " 64 ? substr($data, 0, 64) : $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1efdcd3d7161f00c07e5e47aa90b71508514f85db26a05f078d7affa091fdb41", "structural_hash": "85d949382528a5b15e00d2e490ac7a7229d9b2122ea5f7648424d993e51484b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00461.py", "upstream_id": "BenchmarkTest00461", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n def normalize(value):\n return value.strip()\n data = normalize(ua_value)\n if not auth_check(str(data), session.get('token')):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd8e138ef42167d0d7d238f6313335be41cc18a50447d2c799384269bd63eb95", "structural_hash": "0433e3228fbe301262e362766c211877922fe31dfd28b720f10a3dd45f862133", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05839.java", "upstream_id": "BenchmarkTest05839", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.Properties property = new java.util.Properties();\n property.load(new java.io.StringReader(\"rawValue=\" + rawData.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", property.getProperty(\"format\", \"plain\"));\n String data = property.getProperty(\"rawValue\", \"\");\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bb521fa38f4d0e4e5041c2f70f8de294a91190ac7b0009f8b9157764e0ff229", "structural_hash": "166fa0c050013dc2bae8187deaa626b225a3bf1da586c17e6936aaba59d5baae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03919.go", "upstream_id": "BenchmarkTest03919", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tcapture := func() string { return pathValue }\n\tdata := capture()\n\tc.Set(\"data\", data)\n}", "label": 1, "cwe": ["CWE-501"], "category": "trustbound", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eec7ab4c8fb14d79d982c07d69a6db3b768f6a8af341c33276d80a5b065f9d4d", "structural_hash": "94461c1033a8d1e4588604a8a2e417ba5662b162685b944d04f68a125fb9eef8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02883.rs", "upstream_id": "BenchmarkTest02883", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: origin_value.clone() }.payload;\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a665e8bbe73173d84c54c5dbfaeda08bc6e8e27ad43e5605588c6d7640a4ea41", "structural_hash": "b0e483427c35dbf3c417a2eda3caefb3272fb53e2808903b7b6758152dd87d2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00936.rb", "upstream_id": "BenchmarkTest00936", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = JSON.parse(user_input)[\"value\"] rescue \"\"\n content_type :html\n ERB.new(data.to_s).result\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ecd720cf7be081db9f2a9f5ec0ec6983d393948e53efa1fcdd07dfecf2f80a7", "structural_hash": "a59728753a189110d1dadb106a3e332d051b87582a98e764f3275fff3e19a171", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02464.rb", "upstream_id": "BenchmarkTest02464", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = ''\n user_input.split(',').each { |token| data = token }\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n render json: { wrapped: wrapped }\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca971a184e1c51d23879de08f18087456b959d5450c883fa245c733e9be97d92", "structural_hash": "dbe1ad4956ddc7aae82c4fab3ee9cfee3a89d4f91646e4265c16722c33ed851c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00843.rb", "upstream_id": "BenchmarkTest00843", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n render json: { error: \"invalid type\" }, status: 400\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "833a5c1fe5217703eeadb08ac3cf54c940c5519da4c806f38e75f1c5cb5a0fcc", "structural_hash": "fa508eb0a9686c86eb448c20c83231751077689c66248c58e78cac7071c241e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05883.sh", "upstream_id": "BenchmarkTest05883", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n printf -v data \"%s\" \"${user_input}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-922"], "category": "insecure_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d577e4f1e3bfe45385e993d996049e783b6e5bf9a1c86960246f9412b1ac761d", "structural_hash": "1a33571d5870d9a8df8495900a130eb9995f65d90afe3ce8d3f61e85e9b81b7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01940.py", "upstream_id": "BenchmarkTest01940", "language": "python", "code": "from django.http import JsonResponse\nimport random\nimport os\ndef benchmark_case(request):\n env_value = os.environ.get('USER_INPUT', '')\n random.seed(int(env_value) if str(env_value).isdigit() else 42)\n token = str(random.random())\n return JsonResponse({'token': str(token)}, status=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a716995fd5c940d319e247b1dd208bc0dda4b4eda823f19d6224a1d86c22cca9", "structural_hash": "8f66205806c456b5261cbebc1af9d3198110483ffaeb1adff1d452b4a04372d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01053.sh", "upstream_id": "BenchmarkTest01053", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n exec 9>/tmp/app.lock\n flock 9\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b53eb6c9cac42591ce95e1ec674b3e35efa977d23d0f26bdad9fd9ce1b2f582f", "structural_hash": "235d665c13235db004fd35d1888404235318b41b86ce3a2f2fe87fa08ab1f4eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16941.js", "upstream_id": "BenchmarkTest16941", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9068d5ea1151c596e1c6cd1987f66e30fa30590d21cbafc739a137fe72f8fa11", "structural_hash": "c519d631b8dad3cf6a955bfd7a46d7b5d4c1382f1429c628b86a151be694f49d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02632.rb", "upstream_id": "BenchmarkTest02632", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = { secret: \"p4ssw0rd_test_xyz\" }[:secret]\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ea888f620b16e71faedd27eb0b7f7922fce2195e5f5056c5df04dca75fd4f94", "structural_hash": "d1da721c066603bd91549e2d918f5dc597efa95dbf4d2f2c5d09f9b1df4cad74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12124.go", "upstream_id": "BenchmarkTest12124", "language": "go", "code": "package testcode\nimport (\n\t\"html\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tdata := hostValue\n\tif _, after, ok := strings.Cut(hostValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tprocessed := html.EscapeString(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7f708d5ce6844b91e625145e570185729a40a11744d00c3e939c38d8d805520", "structural_hash": "6b3a2413abcaed6488108ab9437fdeecb2291932649d20287e38ded61133a6ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04669.rs", "upstream_id": "BenchmarkTest04669", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", forwarded_ip).ok();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9049c61cd13a45bdcd1b8aa1048ebcefb4d9cd33d1117f838c8b9cfe45d3ab99", "structural_hash": "925fc62fc44f01b8284a41e226e9af704c78ac5eee9f5bd8c9f4bcbe5fbd174a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01901.java", "upstream_id": "BenchmarkTest01901", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.Map.Entry tuple = java.util.Map.entry(originValue, \"cookie\");\n response.setHeader(\"X-Tuple-Context\", tuple.getValue());\n String data = tuple.getKey();\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a6ddd43bd0666de99dfa8ab5269bfe9568105c334064b3a1ff1d2b3f39999d8", "structural_hash": "99e7f452a1349286c81b8ad0566326ea76886d20d920937660c0e6d5021e84da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01579.rs", "upstream_id": "BenchmarkTest01579", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let stdin_value = { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().to_string() };\n let mut data = String::new();\n for token in stdin_value.split(',') { data = token.to_string(); }\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44c51905a499a6988a7b5e9f3cd8e687d8e82923a9798d2b6f61be97ff4da109", "structural_hash": "f9341f7a59c894af0d6c0606388c93bf6ea9327402d33270308762b939047007", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00526.rb", "upstream_id": "BenchmarkTest00526", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n ERB.new(processed.to_s).result\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4adbefd3d54e13fc55d9305306ca9a1b9f313bc118c04027987df9032b95198e", "structural_hash": "c6a4c83e681022df03964e950840d22a99b8d6a39e93d67a8cfc2015c0df7c6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03054.py", "upstream_id": "BenchmarkTest03054", "language": "python", "code": "from fastapi import FastAPI, Request\nimport yaml\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = (lambda v: v.strip())(cookie_value)\n yaml.load(data, Loader=yaml.UnsafeLoader)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb3b3effea18fc90dbc0d6515da32f3f0d02963bddcbac148a756ab837b6d02d", "structural_hash": "f2cf8a13a699159dd909774dd309bb30b92b56d3525e03832a0640398ee040f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00519.php", "upstream_id": "BenchmarkTest00519", "language": "php", "code": "header('Host', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n return response('
    ' . $data . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0733380ff950a83d3a4d04f2b58b13a2d26e58fb3add5d7a380cdccd2a7d4b4b", "structural_hash": "6597804d4aaa14f3bab6a8aa1f48fff1b3649c3d2c287d69295937edd095989e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01529.cpp", "upstream_id": "BenchmarkTest01529", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Referer\");\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n res.set_redirect(data, 302);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d1114d8651950502d2d6a71a605b05ee7f2ec6932bcadef3f86df536f73d213", "structural_hash": "7814cb37f5c3df9ba5af295504d57e4d5547aedc10e55604e9eea76b851bc741", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03151.rb", "upstream_id": "BenchmarkTest03151", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = format('%s', user_input)\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85a11dd6865b88b30cee06584b7a63d37fc8fa0cb7138307bd7e3e2b526dfa72", "structural_hash": "3090bad11c71fad50de7334d3f12800dc78f577dbae9a271bad322a904a0e70c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05537.py", "upstream_id": "BenchmarkTest05537", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n pending = list(str(host_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n allowed_ext = ('.jpg', '.png', '.gif', '.pdf')\n if not data.lower().endswith(allowed_ext):\n return jsonify({'error': 'invalid file type'}), 400\n entry_file = os.path.basename(data)\n with open('/var/uploads/' + str(entry_file), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "371a3304198a37cb46e77dbdbb066bff3ec0cabe804d9bc4b15e4a11a6e71769", "structural_hash": "ffe24f81239e5b6aabb79f6eecdd964656c4ac6cfbf69ec3ec0c68a9f03c3747", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22006.sh", "upstream_id": "BenchmarkTest22006", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5eba4e1f3fa2cc983db6082a8506dc6dd6a2a37a648a0a41031726e5973af166", "structural_hash": "366726c7e3eff2d9e88b6cf468e868107df3fcff4364e4a662f2dab0666c478e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03095.rs", "upstream_id": "BenchmarkTest03095", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let transform = |v: String| v.trim().to_string();\n let data = transform(multipart_value.clone());\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c58a4e7b8ce2affff05654e0949603e2b7854d6a0776e03ef961ea9b203907bb", "structural_hash": "d898861fff17c2c83a7db57f4c59a77a20bbdba801cd142cd49226267e510a37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03838.py", "upstream_id": "BenchmarkTest03838", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom fastapi import Form\nfrom starlette.responses import HTMLResponse\nfrom types import SimpleNamespace\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n ns = SimpleNamespace(payload=field_value)\n data = getattr(ns, 'payload')\n return HTMLResponse('

    ' + str(data) + '

    ')", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c94acbb4593e7b52f07e83a525a79044e4a6097b43784b0ba20bd68fa700caa6", "structural_hash": "d6ac3b74308c2eebbd4a70968fb9e6103b0090f248bfd304f0635452718416bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03800.py", "upstream_id": "BenchmarkTest03800", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n host_value = request.headers.get('host', '')\n def normalize(value):\n return value.strip()\n data = normalize(host_value)\n if len(str(data)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "495f63b8f4ef4d4f7e5f195930dd8cefc571f1d87b19ec9d2617efac39bf6ec4", "structural_hash": "13c1c82f7e10cafacbee2e6371765e004eaa65f23615492e330da7493fc2a9c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04275.rs", "upstream_id": "BenchmarkTest04275", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let (payload, _origin) = (cookie_value.clone(), \"http\");\n let data = payload;\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "367e94dcb3d385f5d8f20bc1fc1dc14d3417b4527e9072f9f61eb1b31049e72d", "structural_hash": "53c0f03b77ccf3ba3f8e2b3a84e1a940ce9be789678a2f2412053dd7a7b04bea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04555.php", "upstream_id": "BenchmarkTest04555", "language": "php", "code": "text;\n $data = trim((string)$userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc6102ad772dfa616fe7a91e25c82678baca5e12bb8c035f22b92a11ad513e60", "structural_hash": "c8ce574547dcac89dff7e55a1cf3d532113e93a8a1f2a24e9e745efb89a80121", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12668.js", "upstream_id": "BenchmarkTest12668", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-322"], "category": "key_exchange_no_entity_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d371a95e6a3bf96cd21341b4ebd50bf4733621b282cb09f907a8cbb5fbfd35e", "structural_hash": "9f6452ec7e66cd3590df65e3aaf780fecd55806fce199e6287d304a4552d80f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02595.java", "upstream_id": "BenchmarkTest02595", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { ACTIVE, PENDING, DELETED, ARCHIVED }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data = hostValue.isEmpty() ? \"default\" : hostValue;\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n try (com.mongodb.client.MongoClient mongoClient = com.mongodb.client.MongoClients.create(\"mongodb://localhost:27017\")) {\n com.mongodb.client.MongoCollection mongoUsers = mongoClient.getDatabase(\"benchmark\").getCollection(\"users\");\n org.bson.Document nosqlFilter = org.bson.Document.parse(\"{\\\"username\\\": \\\"\" + data + \"\\\"}\");\n org.bson.Document nosqlResult = mongoUsers.find(nosqlFilter).first();\n response.getWriter().print(nosqlResult != null ? nosqlResult.toJson() : \"{}\");\n }\n }\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "882171ac19a48e32ba4e1c9575cffe10a635adc2618e1d4ae1e6772e7fc56453", "structural_hash": "2fefe1f882044f143696559167a0e81386a8c54b1a494f11ff679a48c3339b15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_29022.js", "upstream_id": "BenchmarkTest29022", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n eval(processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-470"], "category": "unsafe_reflection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b801a48e9e398706fab108d0bf836497a0e3ef43d9d0c148b666a5f22f69f15", "structural_hash": "7553efe642dc572d4e3f9398f7f275c84c6c538bd3a9c49093e65654fa44546e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_37444.go", "upstream_id": "BenchmarkTest37444", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\t_prefix := \"\"\n\tif len(userID) > 0 {\n\t\t_prefix = strings.ToLower(userID[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = userID\n\tcase \"f\":\n\t\tdata = userID\n\tdefault:\n\t\tdata = userID\n\t}\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tlog.Printf(\"User action: %s\", processed)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "032c15c10b6006655103e0c7745fb2fbf76884167edd3c06e47b7dc19ce1e976", "structural_hash": "f1980f5b3580c08fe2dd0e4a112c5e6aa31edb5fb3a1f446e423af9da09b9d13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00068.c", "upstream_id": "BenchmarkTest00068", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15c1fdc6f44cff0c56c668b04b41a7f58907f088e3aef8ab38908f91e962b3cb", "structural_hash": "3e995fbdc031aca64cbf1e3e59325edf4f3f58902d6512045869bb5944dfc649", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02433.ts", "upstream_id": "BenchmarkTest02433", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91d9538d6c30a7e984171f85007c860a25eb75f407ea3f07fbd0b938fba7beb9", "structural_hash": "d79b6fb4ecc4bb4bedd8df183a712f32bf9eab7e5e23dcb2001d9bebb3b83a8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02765.py", "upstream_id": "BenchmarkTest02765", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\nfrom dataclasses import dataclass\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n form = FormData(payload=field_value)\n data = form.payload\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JSONResponse({'error': 'CSRF token mismatch'}, status_code=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c3b09695236339220cf2a6d010ddc2242e1dc754dbc52136bbb15244fb071c1", "structural_hash": "d2742bc736e2c77aff3791204225b39b8db620a7302c42dc28fbd2fa8cf23950", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13984.go", "upstream_id": "BenchmarkTest13984", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tdata := BenchSvcPassthrough(commentText)\n\tsharedCounter = data\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c825a988c4039efa51218cdafc48eaeea73061ade1b9fe93e668c893f263b61", "structural_hash": "6bab596dd3c8426e68f349a59511635cabefb6c30f00864a37ea90e283497eff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03662.rs", "upstream_id": "BenchmarkTest03662", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let (payload, _origin) = (field_value.clone(), \"http\");\n let data = payload;\n tokio::fs::write(format!(\"/var/app/data/{}\", data), \"data\").await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c91bbbec74adcab2ec0b85732218ca91e40fc03c4dbc2066ffdf3c75e6b220a", "structural_hash": "1616ac0495c130eecb998fe63f3dab82f374bac16efeacf740d1157f7aa22e07", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01851.rb", "upstream_id": "BenchmarkTest01851", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n data = format('%s', user_input)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9e49da1c24d8bcf8b530cf2b29d0faef0d14f8477c8b3b1c872f91059f1d9ad", "structural_hash": "354b1ad5aee776981e27c0000ca4cdc2748f24b796d88b84de6b12338fcf6211", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_22640.js", "upstream_id": "BenchmarkTest22640", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const data = userInput != null ? userInput : '';\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f8686e7a572e8b8364efcf8eb3c4ef60476445b29d5944fe445130ff6343d06", "structural_hash": "b6f341a6488be1701cda3f303c9bc9c4abcb40634269bafc220147b58822732c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03830.rs", "upstream_id": "BenchmarkTest03830", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = crate::shared::passthrough(auth_header.clone());\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62f7cb4073cfb256878932fd4d11e9fb848ff377664449eb8c2b12e3148bbb0e", "structural_hash": "e3f6b1dfafd3566c55b565d93a409eb56b19e24eeaaa1fdea6ae9dfc7635c681", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00371.sh", "upstream_id": "BenchmarkTest00371", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n normalized=$(echo \"$processed\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$processed\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2fe977e31f9dd566eae58b793bdd1525df948d936e89ab281ee841a95d4df31", "structural_hash": "4b58395d46292737ec28244412247ebcf355d723de2d9d32ebd1711c25fce1af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02140.c", "upstream_id": "BenchmarkTest02140", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8d21fa81aee3a91acf3f99594d9bb8c706f0fb271c77c8b2a1885b1254d5ed1", "structural_hash": "ad3d33e81f1d25b5b36f68a00264a9529d11cca3be7854a6c6db639bfab41b4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12159.c", "upstream_id": "BenchmarkTest12159", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "805c5c501def16b4c0991f74465ae3626a3683e4ae5dc1de8735be17b40bfc39", "structural_hash": "eef5db07c8c7181a27e4c5ca970e0ea40c84d93b5bc61473b2b700bb7c9b926a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04235.php", "upstream_id": "BenchmarkTest04235", "language": "php", "code": "headers->get('User-Agent', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "455ecf0f1e4bb9438f3a9f3f2501784bb2b0cd15a17f0f398a81aca0aa120db7", "structural_hash": "4cadcec2f32b1f558bee5ca38170e71620256028fa6247a0c99c38b2db858a83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_34441.js", "upstream_id": "BenchmarkTest34441", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n require(\"./shared\").sqs.sendMessage(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\", String(data));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "397c4c273eac4d1ab00dc0ef03b0f983426ea32a70649f2ab745ac323c1e84c1", "structural_hash": "d253c75e19301b8f70f674fd6358af2f9b102894933ce4ca81579838cd3bc890", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05146.rb", "upstream_id": "BenchmarkTest05146", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"ghp_EXAMPLEonly0123456789abcdefABCDEF0\"\n data = \"#{user_input}\"\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd1a3e4108fac3a60a4891d6171e357e05b09d9cf14f916fded9f2c11399a9f2", "structural_hash": "e8499ada80fc24799cc8d5323c750f4031f1eba8ce3e31f1537e561811bc9d74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04901.rs", "upstream_id": "BenchmarkTest04901", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let data = crate::shared::passthrough(path_value.clone());\n let processed = if data.chars().count() > 64 { data.chars().take(64).collect::() } else { data.clone() };\n let requested: u32 = processed.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ba839a2964f30f6a8750f270a1ff094ef8e6285db1615eda79eaeba97b9e72a", "structural_hash": "164c2584d7bce39784b56d74d8de5b1b9fc684cc39f80b4d12ab9abf3770cdc5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04444.java", "upstream_id": "BenchmarkTest04444", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(hostValue);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60425517855ab6163268c58ab12406fcd2b6a150292dfab02b33387d60c87dc1", "structural_hash": "3dd7e39f74644ee23dba9c86c51dc9b0847beb2e9bda90769e8234e8c2838c6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03928.php", "upstream_id": "BenchmarkTest03928", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $data = hex2bin($userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c8f2fb4c6a4ed85ff2418e15c4cdaae8c03dd529700df7afb84d05b41d93cf7", "structural_hash": "7446b8776dcf784f12cc44789fb10437217f666d07391fd9d484ab4bbdf924b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00937.php", "upstream_id": "BenchmarkTest00937", "language": "php", "code": "query('id', '');\n $data = '' . $userInput;\n $digest = md5((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61b59936d2cb7bdfc22eb29c2029e3c615885dbb2bd688188eb93d413fba0484", "structural_hash": "66598a7f5674ccad19c4187da772dce2f50267dc746f7068c3ced4ada53f3fa1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02368.c", "upstream_id": "BenchmarkTest02368", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char *const _argv[] = { \"/bin/echo\", (char *)data, NULL };\n execv(\"/bin/echo\", _argv);\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6fc28cf1ee710493697706a279bf40c39c68ee1d2521078d27dbc9bc254ac82", "structural_hash": "c25897e8a4cf28345c06d4511613ae3b8d70935c42341526a9d1b97adf99f8c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03543.rs", "upstream_id": "BenchmarkTest03543", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let result: Option = std::env::var(field_value.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3560d26d51544297649e412f53213bf7377a446dfe818688e71f5f7c295bfff", "structural_hash": "7b5d8e4b00632544f38ed37c998bb100555fab6730ef87a134c632598d43a52c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01469.rb", "upstream_id": "BenchmarkTest01469", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = { secret: \"p4ssw0rd_test_xyz\" }[:secret]\n data = ''\n user_input.split(',').each { |token| data = token }\n _token = OpenSSL::HMAC.hexdigest(\"SHA256\", data.to_s, \"header.payload\")\n _ = _token\n content_type :json\n JSON.generate({ jwt: \"signed\" })\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20898b5ab40aa4f450afd268fd7b766e2209732ef2f41ca5304b790415c5add2", "structural_hash": "df7e78d6444366d6a569bc80569e394079a0b8d0696691f93594c8f26871382e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00507.rs", "upstream_id": "BenchmarkTest00507", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = crate::shared::passthrough(user_id.clone());\n crate::shared::write_csv(&format!(\"{},data\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f67b221ddc8d2d03edb2ad8cca6e9a97c5f333ac42331f30bcaff73fa3346f28", "structural_hash": "b400ee3b53bbe4c50716a4bea435398145a938f60b436452773cd33310c81206", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00425.sh", "upstream_id": "BenchmarkTest00425", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n printf -v data \"%s\" \"${user_input}\"\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n logger \"Action: $parsed_bool\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d971262657c0dfc1d81845c93b7b9540b7dbbaeb8771c8e0ab0d958216e6b08d", "structural_hash": "d2706ea0f297b820e10a686c118ca688d60efcbbabe6c4ff8da2c34f380889f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04330.php", "upstream_id": "BenchmarkTest04330", "language": "php", "code": "json('variables.input', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $allowed = ['asc' => 'ORDER_ASC', 'desc' => 'ORDER_DESC', 'name' => 'BY_NAME', 'created' => 'BY_DATE'];\n $result = $allowed[(string)$processed] ?? 'noop';\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96e314bc9548b19fe64e18823f5c6a955db8aa1c0678fa3f5c2dc79bba6c220a", "structural_hash": "a8bd603016d3080cdc17fe92f494fb4fce0590453722029c5aa3e46db89e6286", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03648.rb", "upstream_id": "BenchmarkTest03648", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n tokens = user_input.split(',')\n data = tokens.join(',')\n render json: { error: \"Internal error\" }, status: 500\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d04a95deedef7471925187a29129a577a223604cbf98f67f0803cd7a35f390d0", "structural_hash": "bedf13b02aae942ec98c8c045ae26cc3603b87c61b1c27ed8da0befc6ea61253", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04256.ts", "upstream_id": "BenchmarkTest04256", "language": "typescript", "code": "import { Body, Controller, Post, Req, UsePipes, ValidationPipe, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Req() req: Request): Promise {\n const userInput = dto.payload;\n if (!shared.authCheck(userInput, req.session.token)) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8eeeb5dd7ce5a262498644802140d97209816e79e5a9e0dde517af5712be34c7", "structural_hash": "3195d45b7e79bab16b9ca2031fdd0f79989e22b5b472c433d2e8997062fa194c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03287.ts", "upstream_id": "BenchmarkTest03287", "language": "typescript", "code": "import { Controller, Post, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File): Promise {\n const userInput = file?.originalname || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n const _digest = crypto.createHash(\"sha256\").update(_content).digest(\"hex\");\n const _trusted = \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\";\n if (_digest === _trusted) { fs.writeFileSync(\"/var/app/active/pkg.bin\", _content); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70bfe535b1e65add312f073dc2e96ac41e1a2ab7564df52e7927aaddadea891a", "structural_hash": "03252abecffbddef754d37235b9e8d04c3559e900f283201bc55ca0bf3671524", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02605.rb", "upstream_id": "BenchmarkTest02605", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "602ed968337732da3c8d23f4a04a55ec41ec9bbbc8199407cabb5cb202997064", "structural_hash": "a6c74015d40fea1c5d6d0eb999a71e8cc32f2cb92d8b3cf7d08caa65d1edec7c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05648.php", "upstream_id": "BenchmarkTest05648", "language": "php", "code": "query->get('id', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "793008f39c5a4b7ee0d71c029684939c283f70fcebb754e76237d9536ba0ca81", "structural_hash": "b338277767eeef8829ed629b00ce88b85497db53ccb3dbd2052d5f032c42e118", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00233.go", "upstream_id": "BenchmarkTest00233", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/base64\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tdecodedBytes, _ := base64.StdEncoding.DecodeString(authHeader)\n\tdata := string(decodedBytes)\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tc.String(500, fmt.Sprint(r))\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83aa25bc6e01191105e83402cdc678f29d402b00e1778314bdfd7d6abc482613", "structural_hash": "2e4dd7ef6f4c31a1a18438335db03345136f733c4aff9e9d36f8e4c6e8ec9c39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25837.js", "upstream_id": "BenchmarkTest25837", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1df0a483ddc33808887276548f4013cdccf6999d872e204c79849f3ca97884c4", "structural_hash": "8a048d20b5592402eb13be1ee1abcd11fcabbcf3c79467803f9d6eee4222107e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04445.rs", "upstream_id": "BenchmarkTest04445", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = crate::shared::passthrough(host_value.clone());\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::write_csv(&format!(\"{},data\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "272e06ea0d277225b5f69bff75743f8ecc48acf8043739ce1466de755881d605", "structural_hash": "be57f8ff693d9cc1bcdf84654d52fd8a70f6a51ce1fe6e246bb233868ea962b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17921.go", "upstream_id": "BenchmarkTest17921", "language": "go", "code": "package testcode\nimport (\n\t\"strconv\"\n\t\"syscall\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(commentText)\n\tuid, _ := strconv.Atoi(data)\n\tsyscall.Setuid(uid)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22428449d55e3b08ce312def33ae188aa5403511820a7b1fea1de45541d10851", "structural_hash": "6d409c8c7976d5363fe91b15f76db3d329062f128951224fd2122baab4867c87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04215.rs", "upstream_id": "BenchmarkTest04215", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = header_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => header_value.to_lowercase(),\n \"f\" => header_value.to_uppercase(),\n _ => header_value.trim().to_string(),\n };\n HttpResponse::Ok().content_type(\"text/html\").body(format!(\"{}\", data))\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7840850b8aedf76bcd7e304014ba00ca1834a2cf5a76fdc3161c83dcfd8004f6", "structural_hash": "e5ef2dbebd9eb766027e25f6e254da86030e7f5abb869b5517fcd2b377785e20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12011.go", "upstream_id": "BenchmarkTest12011", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tsegments := strings.Split(multipartValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tsalt := make([]byte, 16)\n\trand.Read(salt)\n\tsum := sha256.Sum256(append(salt, []byte(data)...))\n\thashStr := fmt.Sprintf(\"%x:%x\", salt, sum)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16aeaa831d3720666fc12712411836bb9424b08a7a794a072367cd2c920255cd", "structural_hash": "265b15c3f6fdfbbaafb7b2bbbf5bfa8dcf14d6c82ce853d9e40bd9ea4c25af96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01672.rb", "upstream_id": "BenchmarkTest01672", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"feature_flag_value\"\n data = sprintf(\"%s\", user_input)\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "430fead1f23f8637f472baea38c520bcbc6d6717b3c9afa3be5b0d30ff3e91e4", "structural_hash": "ce0b2caaefe2d3ab42e11461c9b7362080e6a327081811964cca2b72379de39d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04613.rs", "upstream_id": "BenchmarkTest04613", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n struct FormData { payload: String }\n let data = FormData { payload: raw_body.clone() }.payload;\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1bc439e8783b1f0e41fca576477ae93ac3113bed4c20594d7f75996cd02ac0a0", "structural_hash": "5e0e69ce987ff098da624f840a2b64301bc454b92a50ab1dabb9d549c10bf4d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01499.ts", "upstream_id": "BenchmarkTest01499", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data = decodeURIComponent(userInput);\n const _salt = crypto.randomBytes(16);\n const _digest = crypto.pbkdf2Sync(String(data), _salt, 100000, 64, \"sha512\").toString(\"hex\");\n fs.writeFileSync(\"/var/data/secrets.txt\", _salt.toString(\"hex\") + \":\" + _digest);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a511f55b00f5efa30ed8ad752137ebcb889d641070f76925cec01867608ac67", "structural_hash": "87a70027b66816aecc32ba97ac888dc22728d49cd7334d8049cb592ede90968b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01727.cpp", "upstream_id": "BenchmarkTest01727", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data = std::string(\"prefix-\") + user_input;\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80fa33756db4304ce957c677ef6aa49922268e4a55333a40e2524510b064dc69", "structural_hash": "31d857ddf9d9f75ccaea09aa693a42014e583e5b30c1f27055b0b38a355df56c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31477.sh", "upstream_id": "BenchmarkTest31477", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "260f4e4059cfa31994bfd51c1cd717d2d6d85a5e3afa67aabbee6771664df5b8", "structural_hash": "678e070733868197ef36c6f3a996f21e24ea86012265ace9bf1f873d351313c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20170.js", "upstream_id": "BenchmarkTest20170", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n if (typeof process.setuid === \"function\") process.setuid(1000);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4da4facae79daa3bc73ce1b1a9183508aff2d88a61c8c32561ca80d946bdccf8", "structural_hash": "bf069cc11f80eb8769e75d24a9265e22121b4bed696d72c385eca991f3924cb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03870.py", "upstream_id": "BenchmarkTest03870", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = '%s' % (comment_value,)\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50a113dec9f5b561bdbbf89472da45b3ebdef9a6a33dc527a1ab510cb73ad9bd", "structural_hash": "8e9af1414521f08dd0d8376b9f04426dc49df13545cf5395865000d62c108362", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_31639.js", "upstream_id": "BenchmarkTest31639", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n res.set(\"X-Custom\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9349c40fddbf9ee696c0de198657eda7a4096a32727e50d58c98b81b37854802", "structural_hash": "f7ffae6ed23577062568e5edabcf2c97b9d1798b29824859f4617adc383e0e8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12199.sh", "upstream_id": "BenchmarkTest12199", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9009b8c00d28f71cbbb11cc4c3a2f37e98995702c333740b10ff603f90f0f89", "structural_hash": "4879c477d1ca8670d63d92bb34c7738678249ca4038c7a8c78b36b37b0cce14f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05698.php", "upstream_id": "BenchmarkTest05698", "language": "php", "code": "request->get('field', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n $conn->executeStatement('UPDATE users SET name = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d3fcff6ffbe7c5cca4b716492c1fb28e2a9a274f11f33dcba19461cd94aad60", "structural_hash": "a8eac7d358f202e056b9b066c32f690c1356c19fe956452aebe165f26dbb68ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03413.py", "upstream_id": "BenchmarkTest03413", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = {'secret': 'p4ssw0rd_test_xyz'}['secret']\n data = str(secret_value).replace('\\x00', '')\n Fernet(data.encode() if isinstance(data, str) else data).encrypt(b'data')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a5fa7fa83e4763ef2b180d5cfda579fc531494e2f4cc2adba09af757c82388b", "structural_hash": "290c9371a82486095c77a64d065485e67a4335eab024e3ac5ecdc8f0bfa79ce1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06717.go", "upstream_id": "BenchmarkTest06717", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tform := FormData{Payload: uploadName}\n\tdata := form.Payload\n\tdivisor, _ := strconv.Atoi(data)\n\tif divisor == 0 {\n\t\thttp.Error(w, \"zero division\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]int{\"quotient\": 100 / divisor})\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65e4ea3289ee4eed8c74a929a56c02b7d3a1e31cb48c48530458dd028787f479", "structural_hash": "283c5c428c6433b4197998a7fe06eeb945b1bd4916a912f5cafaacc303d3bddc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03101.rs", "upstream_id": "BenchmarkTest03101", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let tokens: Vec<&str> = header_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let _role = data.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8335505eecbe6c59fe1619fe5edc8fa6ff6ec11a56ddc803a62146f2e002a90", "structural_hash": "065b49d93b4115a4946aaddc7da906ffe2b47dd6ab3bdec266a339f3cc751a41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03376.ts", "upstream_id": "BenchmarkTest03376", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data = await Promise.resolve(userInput);\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "688f2b8f8783202a8d535f5553751d24d59a0e5e35a3a647d965333e79378b17", "structural_hash": "ee5e8be8e6fae77a02e2ad9ee70a7310bea16988e5aed91d37d80e4dba6bbb2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09909.sh", "upstream_id": "BenchmarkTest09909", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "154818d8de95e431df33bade9bfd9d00d0f28265d2f89c6fe0d22a3efe9b4877", "structural_hash": "09e971528e5fbdc0fda9bf9adb4dae2e7fcd5ea6a302c4889c1c42859bc6d850", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05058.java", "upstream_id": "BenchmarkTest05058", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.List tokens = java.util.Arrays.asList(multipartValue.split(\",\"));\n String data = String.join(\",\", tokens);\n response.sendError(500, data);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "483eae9fe1b21242223db3cdfb45210266db3b04593173b0918b18063a097ac6", "structural_hash": "f7c9713fe6b9fe57b08e353d36ea70e2f8663e2d9773914fee1e3dcfe37749d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09002.c", "upstream_id": "BenchmarkTest09002", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n unsigned char _digest[16];\n MD5((const unsigned char *)user_input, strlen(user_input), _digest);\n}", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa4196a01f3148d54e92b5729f34dd5e9d7eea62e8e5471a214d8599f0cce26a", "structural_hash": "b49f02a0a426f5481da6961d87ba1106d613ef46f805504edd7fe2b2a1ed8342", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02347.py", "upstream_id": "BenchmarkTest02347", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n reader = make_reader(referer_value)\n data = reader()\n allowed_ext = ('.jpg', '.png', '.gif', '.pdf')\n if not data.lower().endswith(allowed_ext):\n return jsonify({'error': 'invalid file type'}), 400\n entry_file = os.path.basename(data)\n with open('/var/uploads/' + str(entry_file), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acad68db76223fc56e40ea8a69b3cd58758d4c4cf7fefc19e0beeebf86826e31", "structural_hash": "1a7ee24c4211fedfdd7f98dfd403e579da9d48c925c168260576a16ea36e23bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05306.sh", "upstream_id": "BenchmarkTest05306", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n if [ \"$(date +%Y)\" -ge 2020 ]; then\n curl -s \"$data\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-941"], "category": "incorrect_comm_dest", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1d1bf697aeb8691346c7bd7f307b609471fd04f0c5f0e37e696537049d11e22", "structural_hash": "f76411a5da3c3a5d185e9f41442cfebc7ce577f075ff3b92a200e86c4289bf44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10441.sh", "upstream_id": "BenchmarkTest10441", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n printf -v data \"%s\" \"${user_input}\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf4348535bd58ef0afd6d39a857e138328a5e544afa2feb7a97e8e63bebc6c94", "structural_hash": "9eff731cdfaf199fd98ad578e04fcd559102df6ba43d64e45920d0f93f0a90b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17037.sh", "upstream_id": "BenchmarkTest17037", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_info_sent", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cfe35877f6784b3d300d862bfd1d6276eebd14ae9062a535576649db7e814dd", "structural_hash": "bed831be34de8a93ee21855cae9ed7c0e6ddb573423e9bc687a8f4ebd7eeb969", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24676.js", "upstream_id": "BenchmarkTest24676", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "606a0f17a37ac1a12c90c66c7a0bdf687ba005c2989d6aa33d01a552a51b14fa", "structural_hash": "ce1fb443bc7c4f1ca6af1852fe4348503c00ca7d46b040f9800f2598293781a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05168.py", "upstream_id": "BenchmarkTest05168", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport re\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n ctx = RequestContext(header_value, source='form')\n data = ctx.payload\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Access-Control-Allow-Origin': str(processed)})", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17895bab07b6881cc4a6eec998213dbb981fe3e69ba6edf8da5853f74b250879", "structural_hash": "b259e860136b18ebf0073c0976006290eb96876a2ec6a8da4cfbd8f20f9e370c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13950.sh", "upstream_id": "BenchmarkTest13950", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n curl -s \"https://api.lan.local/lookup?q=$user_input\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c3b93f963c4e3cca467722709a33455489ff76d6047a238741ae8df185d14b3", "structural_hash": "0613fff1cadfd1dc2f9a14527fe14ed9ed888522f08890d93b643e08a8332714", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01434.rb", "upstream_id": "BenchmarkTest01434", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Origin\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n eval(processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5b063de97c8f8df1f96555bbe1811e26ee40bbb43398e92426e2c1184dbd83b", "structural_hash": "bb5a4713831d6b1583f75562bce0118251154d3802a42e99cb10abcc0f128de5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02197.rb", "upstream_id": "BenchmarkTest02197", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = !user_input.empty? ? user_input : ''\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c42dd3a632bf503e17798eabd4b6e09bc0957c34ae3455311049b7f4642706a5", "structural_hash": "5b62ae8b38330af2e9ca586cfc76f4b8491f8347b1d56b2e915f290706c01b1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01795.c", "upstream_id": "BenchmarkTest01795", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n unsigned char _digest[16];\n MD5((const unsigned char *)user_input, strlen(user_input), _digest);\n}", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91e996c3cd28a2258aad65f1d8ac7a34c409918c94264d6d9abc2748ca268403", "structural_hash": "2555dd388b332ad96184dd9b45b200f6c9af1e45f99e5c83249b5ccabe992958", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04114.rb", "upstream_id": "BenchmarkTest04114", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = String(user_input).strip\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4059d6a582c5e5932409804b19477841c33bbe89eb8ae13392c1831ddf9b8ec", "structural_hash": "1219af9266e03b61a3295993d15b0862e07e6b3bc90c7b7df7a577da53b1f55d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10972.sh", "upstream_id": "BenchmarkTest10972", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n normalized=$(echo \"$processed\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$processed\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cae4b26c7a693373e8e42010d919e4385dfc3bbee4d8a1cb95188af4911ebb6", "structural_hash": "43302cc2c73bb2e0109cabd9f3d7fee52ea30c90cd65c11a9a746e807558717e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04934.php", "upstream_id": "BenchmarkTest04934", "language": "php", "code": "header('X-Custom-Header', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $entries = scandir((string)$data);\n return response()->json(['listing' => $entries], 200);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c6920d0d29adf4abf6322bf9d97043fe14a87b721d6cff3bc1ffeda92bc93ea", "structural_hash": "a96a7881b841aef0d1370d15e6502bcb13b851c64567080ac2e155679591911e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_33357.go", "upstream_id": "BenchmarkTest33357", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tdata := BenchSvcPassthrough(commentText)\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e5adfc25d606e659106735a798350bb2d94f62868db1144ad136d8372b9d927", "structural_hash": "1dd0b91c8a7441c15edd998abd1a8afdb1a3b9df8caa654034b82e8249eab51d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05406.rb", "upstream_id": "BenchmarkTest05406", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = ''\n user_input.split(',').each { |token| data = token }\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "768ed06621d41cb85d46dae8d1361ecc91e2bd0e7103aecd3bce7781f7ad2f26", "structural_hash": "812acc67324ff591b0338b251c21d7aa99c38c39bfa8bfc04bcd6d3a9fbff286", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02532.java", "upstream_id": "BenchmarkTest02532", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = normalize(multipartValue);\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4bb2ee4ffcefc741351480dbd7793447f8e73ce3ca9736df75e180f254373d05", "structural_hash": "41d41ade943a32975436c897914f6464a99b39d206f5262c29d7ebb5bc3ee02a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03714.py", "upstream_id": "BenchmarkTest03714", "language": "python", "code": "from django.http import JsonResponse\nrequest_state: dict[str, str] = {}\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n request_state['last_input'] = auth_header\n data = request_state['last_input']\n return JsonResponse({'status': 'ok'}, status=200, headers={'Access-Control-Allow-Origin': str(data)})", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "281053e346726ef221117373377380b483e5e8c46bc6027f8ea88edddfacab21", "structural_hash": "4ae91d3cdaac66b72eb918a9c15b22a1f15d315396ab3b77c0f62b5c14618431", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_35039.go", "upstream_id": "BenchmarkTest35039", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(pathValue)\n\t}()\n\tdata := <-resultCh\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tc.String(500, fmt.Sprint(r))\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0ac431ad69831a2897124a1c5d2bbe8e6a3f2ff0e07e13e330839c56809be24", "structural_hash": "6bc11d4a735598ffe6f0febf3be93d161fe3b07dbf0e311e6320a9251bd66ebc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_20171.go", "upstream_id": "BenchmarkTest20171", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tdata := BenchSvcPassthrough(forwardedIP)\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71bd5870e33974d8fd2f95ea4541de0b96c4c2bd27f503601e6bfdedc14a3224", "structural_hash": "c1330ee3f5cb650a78176af1965492a5dbd1e2d5222c9180fe2bf9a8285ebd13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04407.rb", "upstream_id": "BenchmarkTest04407", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = !user_input.empty? ? user_input : ''\n host = URI.parse(data).host rescue \"\"\n unless [\"api.intra.net\", \"cdn.railscdn.org\"].include?(host)\n halt 403, JSON.generate({ error: \"forbidden host\" })\n return\n end\n target_url = data\n redirect target_url\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ad9c2c79fb8dea4964e2bda06c28156e18532523c16f28bb5c41e406bcb1e53", "structural_hash": "d786d5dccacb6f7791f6c3fb1006f461836987a5d376da52dcb451d6d15a2943", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02565.py", "upstream_id": "BenchmarkTest02565", "language": "python", "code": "from django.http import JsonResponse\nimport logging\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n def normalize(value):\n return value.strip()\n data = normalize(user_id)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8377904862faf4d1fc83c83c34e16b34cac4cc6c7ea4fb8135304c292d0d224d", "structural_hash": "8564a1d754b2fc86941e87f92a9279c352425e4593307c3b87da98ffbbd95ce5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04524.rb", "upstream_id": "BenchmarkTest04524", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = user_input ? user_input : ''\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be4ba9cb3151c31311e4dec6c1f8f2e4bba33decb96c955d089fb88e8c513b5c", "structural_hash": "527c4d6354f4a06e6d06a4a3051136d2f9a3d6aa32f42fba95087b5d3c0570b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00431.java", "upstream_id": "BenchmarkTest00431", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.function.Function preprocessor = s -> s.replaceAll(\"\\\\t+\", \" \");\n java.util.function.Function fullPipeline = preprocessor.andThen(String::strip);\n String data = fullPipeline.apply(headerValue);\n if (data.length() > 2048) { return Response.status(400).entity(\"schema invalid\").build(); }\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ba4b01f5ed39f8223e8cec6c297854e64bf53d53b77faa66a480acc6feb33e9", "structural_hash": "3eb33542d93279f38ddeb8048db614c3ebec50588a0f27e7054e14aa0afcbc67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04211.py", "upstream_id": "BenchmarkTest04211", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n data = '{}'.format(origin_value)\n if str(data) in ('read', 'write', 'delete', 'admin'):\n return JsonResponse({'access': 'granted', 'role': 'admin'}, status=200)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7fdd08a42755341b30f4ccfc84ec656a3b941258cd98b2977323c5b726eb6961", "structural_hash": "27b5ec2c5aab24936e1b522f28e4ce905e474af414f336a4004716252f018315", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00041.php", "upstream_id": "BenchmarkTest00041", "language": "php", "code": "header('X-Custom-Header', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n if (!hash_equals((string) session('csrf_token', ''), (string)($request->header('X-CSRF-Token', '')))) { abort(403, 'csrf mismatch'); }\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d062e88e38178eb270ce8df1b23206bb3388c76bb54b003de6d4eef1687cd684", "structural_hash": "8f1269f6857c19d627b42c28b051e46f63e12f99e3c1bfd13ac8764c9abd16b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00962.py", "upstream_id": "BenchmarkTest00962", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\ndef benchmark_case(request, path_param):\n path_value = path_param\n ctx = RequestContext(path_value, source='form')\n data = ctx.payload\n eval(compile(\"subprocess.run('echo ' + str(data), shell=True)\", '', 'exec'))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e9c90ef0376e3ea7f03ebb789fe04d22fe99d27b59fc87db7eb6335fed4453b", "structural_hash": "8875cc295aa97b52406d1a6f7dda8a90779122b1c357a27991fa2b952e807684", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10503.js", "upstream_id": "BenchmarkTest10503", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = await Promise.resolve(userInput);\n await new Promise((resolve) => {\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n resolve();\n });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2de2afd9db948661eb05d07338d4e89c05c6df53c8f8be83ea3dc812a9d7270a", "structural_hash": "6fe422686f833ab3b125d959093d3cfb4b1bd14dbea2431a90a044381d50639e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10845.js", "upstream_id": "BenchmarkTest10845", "language": "javascript", "code": "const fs = require(\"fs\");\nconst jsYaml = require(\"js-yaml\");\nconst benchmark_case = async (ctx) => {\n const userInput = jsYaml.load(fs.readFileSync(\"/etc/app/config.yaml\", \"utf8\")).field;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n console.log(\"Action: \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88cb5b18df1019b4a1ae63f10298ba32755e99d5d0854eda76cef66366617bdf", "structural_hash": "47bdbeb076289d9dcc589360a007ee926780182314743e83d9dd942659c92da7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08854.js", "upstream_id": "BenchmarkTest08854", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.DOTENV_VAR || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n const storeCred = process.env.APP_SECRET || \"\";\n authCheck(String(data), storeCred);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "683cc7b2044c6411229dc8ccbb22d300a1e44558ab9e2712841bfefc702ee64e", "structural_hash": "2e648daf6eb756b0d5766f7f2a427946283a274d49e25c9833a1da419651d4bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02353.go", "upstream_id": "BenchmarkTest02353", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tdata := fmt.Sprintf(\"%s\", headerValue)\n\tDB.Exec(\"UPDATE users SET name = ?\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a801164fb3ea3cc624a5e5640ecc58923f1abf53d1ea344d12123aeafa54e8c8", "structural_hash": "8df7f8bf6022558205f513041c5dbd294022936d22b22301795b8c68a7c7052c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00445.ts", "upstream_id": "BenchmarkTest00445", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n const data = `${userInput}`;\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7012edf0cf44c3e0dc55524288ba9ce2e26786f56ee42bb70daa928c5da67c5f", "structural_hash": "d32872aca98f79049203542feb8754af37a91be892ddf9f335a2a9683a47745c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05912.py", "upstream_id": "BenchmarkTest05912", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom fastapi import Form\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n ctx = RequestContext(field_value, source='form')\n data = ctx.payload\n if len(str(data)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a0f3ce78b3ce460964f0e46bb522716273c3db0d356e5e6b448ad3097eb463b", "structural_hash": "0edca076d6e6a50a425d4dfcebfe9e99bfb773ba33f7ec88a37160aa13d29adf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37768.go", "upstream_id": "BenchmarkTest37768", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\t_prefix := \"\"\n\tif len(jsonValue) > 0 {\n\t\t_prefix = strings.ToLower(jsonValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = jsonValue\n\tcase \"f\":\n\t\tdata = jsonValue\n\tdefault:\n\t\tdata = jsonValue\n\t}\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\tpanic(fmt.Errorf(\"invalid numeric input: %w\", err))\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "271de240a6df0d7463b95facb981ef4bf7c7c9d303fc1c7382ba7e406db99819", "structural_hash": "cac843dd5a738bdd7437c808879b7236366effc507c1d0e615b41384722a5dec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07462.js", "upstream_id": "BenchmarkTest07462", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n fs.chmodSync(\"/var/app/data/resource.txt\", parseInt(data, 8) || 0o777);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8aed55ed615331e7c7a247e4b38c68411213aad3eac865f485a9289b86153e1", "structural_hash": "7cbc88f98b8e2afa66c495ebaf8e473b7ee82a2e8209aed1a37bb0c957378364", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00223.php", "upstream_id": "BenchmarkTest00223", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06e597579d7b83f9cf6125b0f037693e929915e28169f0cd8028a6fae6fd52b3", "structural_hash": "5a8b4dc0a3ffb86f9e6d9c2dc885dcc761351514e2c8537add9715b7a902ed86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11637.sh", "upstream_id": "BenchmarkTest11637", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n curl -sk \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78a0c33050e8b525950538273ca7e222612163d1360117ff34fd6d92ce33a16f", "structural_hash": "ab05d4c66c1eb9bf2345daadf03240065e05aa76674c279c89fbd6e593382c7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02862.py", "upstream_id": "BenchmarkTest02862", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n data = str(path_value).replace('\\x00', '')\n return HTMLResponse(Template(data).render())", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a33f6ae285a20e6672ba551dea1ef02545ba8a83f6a3fb19eb349ea543607f5c", "structural_hash": "1f20ab6b3eee75d07f7bf72cd2616ead806c46bcae8c36c851953f624d3427b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04100.java", "upstream_id": "BenchmarkTest04100", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.function.Function tabNormalizer = s -> s.replace(\"\\t\", \" \");\n java.util.function.Function decorated = tabNormalizer.andThen(String::strip);\n String data = decorated.apply(multipartValue);\n String processed = data.length() > 64 ? data.substring(0, 64) : data;\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(processed.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6471b5499b74cc5c6ef99f16aad11a800d2774297510ba3d7d6eb0996cd9434", "structural_hash": "cc07d7adc4f378aec9be1e31326538163068877ea3326ccbe6b12579682c0647", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_29096.go", "upstream_id": "BenchmarkTest29096", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(refererValue)\n\tpluginPath := filepath.Join(data, \"report_renderer.so\")\n\tcontent, err := os.ReadFile(pluginPath)\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17244a548d2e074d652769e3b3bc9e913034bd28e119030e53bc455525ef9538", "structural_hash": "2b9a50befb44d599c9ff8d50c7082017f7e48a93608459815c1388caf1efb989", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04098.java", "upstream_id": "BenchmarkTest04098", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> userId)\n .thenApply(v -> v.strip().toLowerCase());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"DES/ECB/PKCS5Padding\");\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(new byte[8], \"DES\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "832148591001aa755f67777314c0f89d77147edd3d91a06a4cc873a857ce7093", "structural_hash": "b53cc2cd6816922da5c22c507da6adb0d7a739cf614d9f5eee6237dd1c7b8f53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02646.rb", "upstream_id": "BenchmarkTest02646", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n _buf = \"x\" * 1024\n _ = _buf\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72e9d32978cdfd480efbddacfdf4b9018ca106db347a6dbe2950cd9dde56a103", "structural_hash": "70739b0ad15aa4f5da7fcfaf9fb8005d97fac544aeec9ced4b0dcb773afcd1e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03565.rs", "upstream_id": "BenchmarkTest03565", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(ua_value.clone(), |s| s.trim().to_string());\n if std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) > 0 {\n tokio::fs::write(format!(\"/var/uploads/{}\", data), b\"data\").await.ok();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e004c9254aa5ac725654b69fd2b75b0d61b214750ca3f482ee0e9f3af0a489d3", "structural_hash": "0234d9e0540296e43db5172677eadfa248bf05a7f3efcec36965c7da127b2cc3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06436.js", "upstream_id": "BenchmarkTest06436", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "891dd200f0741bf9ca5248ae465cffb0d047949ea3fa72d07726a21e428bd1bb", "structural_hash": "0a1fa2d9370f3547341b7da5f367bcd45ec1077ba12cabcbb35e1cf43d5827ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05516.ts", "upstream_id": "BenchmarkTest05516", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "060b17e0ab958232577c4f13c8fbb4a0955a65ece2328af28a770bcd259b3c33", "structural_hash": "3caa0e2bfde32bd495c0d29bcccdfbeeabeed6d8537e6e81e90d0e60d50f839a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15407.c", "upstream_id": "BenchmarkTest15407", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n }\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "105cb5afa572d2a55c75bd655e7012dd0eb01263bc828fa322f5bf3ddb7f6743", "structural_hash": "b0167b1b45f523a436b58b5b3039d7e7a8b6812a6cf84d97ed5b5382e3521c62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02007.cpp", "upstream_id": "BenchmarkTest02007", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + safe + \"\\\"}\", \"application/json\");\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c2049839806ab76430d2e3ad8ebe67c076c8cbed5c0d3cb6b0f9b108c719bc5", "structural_hash": "abd9078c921ec11b41d5ab3fe756e25fe752870b97bffe81dda49a81505cc376", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18006.js", "upstream_id": "BenchmarkTest18006", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst ldapjs = require(\"ldapjs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = await Promise.resolve(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19fa000fc7f34824bf27bb63f3028ddc3a2903e46a0e8432f883fac90e1432ed", "structural_hash": "69821fbf3f5fdf09af32df5d485872b07ee72fc1f7e0b47051350c2c70e2712f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04379.java", "upstream_id": "BenchmarkTest04379", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + cookieValue;\n String data = valueSupplier.get();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"DES/ECB/PKCS5Padding\");\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(new byte[8], \"DES\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b5937b68ae41e34173b5a69be208c3e9abb80cf6979d48e459c0a2fe088d476", "structural_hash": "07b7bf712f095e3cf4c5905c6fee08a1045aa21b5e076b25a84c96d61bfb4e84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03844.py", "upstream_id": "BenchmarkTest03844", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n kind = 'json' if str(header_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(header_value).strip()\n case _:\n data = str(header_value)\n request.session['user'] = str(data)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "855df991cf98be07d90ede344cde4fa5c91a98434b47e5f48a9cd5df94104016", "structural_hash": "3aff166498649a0112aa311dd4bf741e9a012e2231729c4f81c4ae0c31a2bc52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00221.c", "upstream_id": "BenchmarkTest00221", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n const char *safe = data;\n if (strncmp(data, \"https://api.internal.svc/\", 25) != 0 && strncmp(data, \"https://cdn.internal.svc/\", 25) != 0) safe = \"https://api.internal.svc/data\";\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, safe);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ce0560b81e15702c32c7711f275998967e4d12c20cb40b4a29e836341bb1165", "structural_hash": "5d29a3a72e8f68c0e5a1e7568f100b7e419f1badf86a3f6ee15d6a5b6e663743", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05519.ts", "upstream_id": "BenchmarkTest05519", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = String(userInput).slice(0, 200);\n res.send(nunjucks.renderString(data, {}));\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28ee730bf2fb8ad080c88fadb76e4550e5251a9099e5db3ac562123409a37d58", "structural_hash": "f9d808909c333aaa9e9b53694af2904e205102da4171fd0dd47a1b7f43d963c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17060.go", "upstream_id": "BenchmarkTest17060", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tcapture := func() string { return xmlBody }\n\tdata := capture()\n\tencCookie := encryptForStorage(data)\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: encCookie})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-784"], "category": "cookie_no_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43324a616ed47ce915f5b5ab074acad2d4f9e6be93ab4d4830c41c45a042f995", "structural_hash": "29dddcc092b2ef789f74b16084ae211827c3cbcc14cbb4ef928229b53dd1c5b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28447.js", "upstream_id": "BenchmarkTest28447", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5e823d02d73c63e4e721c57680a90fa7ce833102c33b8242d6e8c63abd93868", "structural_hash": "6305d15047d87ea8b2acbf9a2f1277a012fb97342af1cd0b495b55e9efb05640", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01770.rb", "upstream_id": "BenchmarkTest01770", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = ''\n user_input.split(',').each { |token| data = token }\n Nokogiri::XML(data) { |config| config.dtdload.noent.nonet }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e14a6d164fee2a74db24c0b579b283cf7a92fffb37a2ca9b64061e0df8238d88", "structural_hash": "763935bfdc16e8fbcec1a40818b01549d7bd74a2f95f50b43c402c2cf6aa89ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07658.sh", "upstream_id": "BenchmarkTest07658", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n curl -s \"https://api.lan.local/lookup?q=$processed\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8519a2cfaeb6ea404558e9f12a22fdfc9e24b52fa66329df4bf179d9c260101c", "structural_hash": "a58c40af88cc6a88c84ff2676de9fcdf112dcf783a43d6ea5fafbe92b16f3439", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04972.php", "upstream_id": "BenchmarkTest04972", "language": "php", "code": "getContent();\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $resp = new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n $resp->headers->set('X-Frame-Options', 'DENY');\n $resp->headers->set('Content-Security-Policy', \"frame-ancestors 'none'\");\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83a10cffd0ab5a617e1eeff4fb373ca28ebc57a841cebb97c849028e24126fe3", "structural_hash": "ba621155928640906e7338cdcc76e91e1903cba17fa81f98c27744492b542b3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05898.php", "upstream_id": "BenchmarkTest05898", "language": "php", "code": "headers->get('Referer', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65e8f93d02f39fcbe9d04a0accd41042488bdd8cbc44f4bb2a49bae7dc3cd5c3", "structural_hash": "1931645a906bdafdcd708a4b530696b4691f278728b1705cbce3e53d49ffb86a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04131.ts", "upstream_id": "BenchmarkTest04131", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83f1fa34aec8b8741e1bb77466fc215cb013736237ac5aea945eda0e3bd673ec", "structural_hash": "f4a23d4b3cd30c075f49ca565be807abf0bcfc332215636e43f651ba4c31b91f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01285.rb", "upstream_id": "BenchmarkTest01285", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1efaba513598013ea3bc7044da3ba8b9bde81fd66df79a15fd02c2555d0396cb", "structural_hash": "4fc4abadd26138488fdb477c1c9c5335b07e7ef854015eb3275bb602df7a72bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03462.cpp", "upstream_id": "BenchmarkTest03462", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string safe = std::filesystem::path(data).filename().string();\n std::remove(safe.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "724383222fcaa43b005cc4b2ebd2dc839b84fecb88a47611f134fb72e6cab31d", "structural_hash": "05917ab8083530bf07d99c66c310447d762b8be40548187296a24f081f7e7cf1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24398.sh", "upstream_id": "BenchmarkTest24398", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n checked_path=$(realpath -m \"/var/app/data/$user_input\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d13097846752931764eccd11373c62a1007746d49a5dfb34cc0af2fd03f8f859", "structural_hash": "d68663422c28135310c7e6b98e29f0454db995c5ea2bbba53eb76e2578b8e3a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01518.py", "upstream_id": "BenchmarkTest01518", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n parts = str(header_value).split(',')\n data = ','.join(parts)\n db.execute('SELECT * FROM users WHERE id = :id', {'id': data})\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e4484a8603490941d2f62e02aff48012add5e043c070047e745f9e71bf86912", "structural_hash": "89e95613f9b56e455b930ee3d3453cf2512a67d3ab5b34899f3333d5b2424c02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02240.php", "upstream_id": "BenchmarkTest02240", "language": "php", "code": "request->get('field', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (!hash_equals((string) $request->getSession()->get('csrf_token', ''), (string)($request->headers->get('X-CSRF-Token', '')))) { throw new HttpException(403, 'csrf mismatch'); }\n $conn->executeStatement('UPDATE users SET name = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5342379b3c6cc51eb82d7ffd5854fba576337c84f55ae39e639ff18d818dcbdb", "structural_hash": "2f0e48d7491a82bcdde61bad561055fd87d144fe63a67928ccbeee7672709141", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02830.ts", "upstream_id": "BenchmarkTest02830", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = ua || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n res.json({ status: 'ok' }); return;\n }\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3e2d82f10a6e051d96bd9a6daf9d6dc22aed6224b3d5a619b654055a6059e72", "structural_hash": "45ea576c1a1c3b5fe8c2c0defc4d899dd5cab97c81ead5639079e79fa09976a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03450.go", "upstream_id": "BenchmarkTest03450", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tlastRequestValue.Store(jsonValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b545e110f073f34991970354aab4a1fe56f4f8264097ffc3047b295614bb684", "structural_hash": "ff5677b385a2cb018a1cd5d3a086ae68fa8363bcf998f2af84babab2b77551fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01326.sh", "upstream_id": "BenchmarkTest01326", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n data=$(printf \"%s\" \"$user_input\")\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n parsed_id=\"$data\"\n mysql -e \"SELECT * FROM users WHERE id = $parsed_id\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35f9d0c53db0e4e419e710225bc8379fca43e61cea590542fa1115d67cd320a4", "structural_hash": "c6b13e774efaa4febb2869dc0c1eeababe254103453d9caff671114dd79db125", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03482.java", "upstream_id": "BenchmarkTest03482", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n String data = String.format(\"%s\", pathValue);\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { response.sendError(403); return; }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n response.sendRedirect(targetUrl);\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96dc16b76fd5f271cc7a95ee288d78349228c58a2377b22a816bc4d482f02a79", "structural_hash": "72b6de398a9c2233f43da9671f95d27074c742988e2aa5227d92cf8c24f4b384", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00050.java", "upstream_id": "BenchmarkTest00050", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = String.format(\"%s\", rawData);\n if (!(\"true\".equals(data) || \"false\".equals(data))) { response.sendError(400); return; }\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37b93a4667580a43dd6e3ae2ae82451e2727d956118aecae38787af16074f64d", "structural_hash": "5e839b3e568cec1660a4d6270f2d77a6d5c30ebc6bf25458a015e042a2c52f81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05553.py", "upstream_id": "BenchmarkTest05553", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\nimport re\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(raw_body)):\n return JsonResponse({'error': 'invalid input'}, status=400)\n processed = raw_body\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26719fc4e9f1583eab3146d1f857657df70280ae7c908f0626e24a8d2ac9f9ca", "structural_hash": "280a058c73f446c424d76c9224d5fc027822c058f29d9bd811a72597ff7698cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31212.go", "upstream_id": "BenchmarkTest31212", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tlastRequestValue.Store(graphqlVar)\n\tdata, _ := lastRequestValue.Load().(string)\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tdefer close(done)\n\t\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+data)\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Write(output)\n\t}()\n\t<-done\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57a5622abcc3cc98d702c639e6ea467a3303c65bb63ebb785ffb0dc396b9ce5c", "structural_hash": "a5b4ebdecf920ad8b35f9a7568b0f759e72dc6b402bf407990b6829cef925eff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03121.rb", "upstream_id": "BenchmarkTest03121", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Origin\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n if ENV.fetch(\"APP_ENV\", \"production\") != \"test\"\n File.write(\"/var/uploads/\" + File.basename(data.to_s), \"data\")\n end\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25da8de82ea492d3fcc6e1123ad89d5959932b13aa7a05cbbb66d1ca2111b23c", "structural_hash": "e44a82c6b2246f8396f9587055b7cd107f0605d1fd7004cbba9695eb5acb713b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03175.cpp", "upstream_id": "BenchmarkTest03175", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string safe = data.size() > 4 ? data.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n res.set_header(\"X-Trace-Id\", safe);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3120f039fd758ad3a0268253aaa3348001578ccaee2ff04c87700f35e3bec7c", "structural_hash": "2b36db7c064dcdfacd7f73befcd29fc2ab500a2dd1980cfa7c8d3f6b19a22851", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05515.rb", "upstream_id": "BenchmarkTest05515", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = \"\" + user_input\n Marshal.load(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "588765e4f4e346d760fafe2c73cc54368b0e9da955cd2c44a6ecc1de7a9f1665", "structural_hash": "5ad968740aeceb3e8529f773c3976d537359ce92b03e48369c0eab9f18f63ef5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02112.py", "upstream_id": "BenchmarkTest02112", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nimport json\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = json.loads(raw_body).get('value', '')\n digest = hashlib.md5(str(data).encode()).hexdigest()\n return JsonResponse({'digest': str(digest)}, status=200)", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88d01f1d259524d8397e672169b3153b303bef1186d329c2b87074604660e682", "structural_hash": "964abc4915f1422bf42221ed311fb8d157c3b034c6b33ca9af847d75658caa13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00223.rb", "upstream_id": "BenchmarkTest00223", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = format('%s', user_input)\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6dcfc054179eb14c3328e36ca32cd0fc782788584c7eda4c586d0ca4f6dda28b", "structural_hash": "9ab111dd941276a4f6ae6c6f8df6aecae87048699acc4fda9f885d1524ea7f80", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21123.sh", "upstream_id": "BenchmarkTest21123", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(printf \"%s\" \"$user_input\")\n echo \"$data\" | openssl enc -aes-128-cbc -nosalt -iv 00000000000000000000000000000000 -K \"$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e5bcfb227db2d28b4ae02a98738281ed53c9c46f57db5cc8802cf03ba59716e", "structural_hash": "34e40c16bc23632d6a5c55264534e5b464a0c4748889a8826031c2d76fd0bf29", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03065.java", "upstream_id": "BenchmarkTest03065", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n request.setAttribute(\"carrier\", authHeader);\n String data = String.valueOf(request.getAttribute(\"carrier\"));\n int boundedVal;\n try { boundedVal = Integer.parseInt(data); }\n catch (NumberFormatException e) { return Response.status(400).build(); }\n if (boundedVal < 0 || boundedVal > 1048576) { return Response.status(400).build(); }\n long requested = boundedVal;\n long allocSize = requested + 1;\n response.setHeader(\"X-Alloc-Size\", String.valueOf(allocSize));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "909e00b20cf94e5e1a4404e38580ed48d15aaeda26d50784b2b7948220f39e1f", "structural_hash": "ea6234aad2e9ab14b00952147310829f973816a9c8171c0ec8dbc33cbac52471", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03913.ts", "upstream_id": "BenchmarkTest03913", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n return fileContent;\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f4a7866e8f4c7475caf0a97cdb3f2f550f6559f8c45b1430265d91ab1bf23ef", "structural_hash": "055d2b98835d12ab84c740e5124f617728040623dcddc381d4818ae6bcd1cdb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04976.py", "upstream_id": "BenchmarkTest04976", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom pydantic import BaseModel\nimport base64\nimport pickle\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = '{}'.format(json_value)\n pickle.loads(base64.b64decode(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c34f3ab5fedb5c24ec74a230e509c65be592d84f96e0a4df892a29817fd360f", "structural_hash": "7773bf777bf62d8040854c0a3c7ac27fcee85177d85dd39d6757223b3158c7eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01622.rb", "upstream_id": "BenchmarkTest01622", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n unless session[:user]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n logger.info(\"error: \" + data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90c28a330333c45375801cc3f4ddd5dbc684eca67930928dfd530ad91753375d", "structural_hash": "da48dc3f2f70ee9e30f1de3bd1bb18f34b2bce84fa175be64b4f7b7da62eecb7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05341.rb", "upstream_id": "BenchmarkTest05341", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = sprintf(\"%s\", user_input)\n unless session[:user]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n logger.info(\"error: \" + data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf992bcfff31a57cac4f61fd639b67795ffd74dcc0e6b2b41b8f472a33be5047", "structural_hash": "f8bb063487f4634b019656eafa9165bf92a82d0426fa996d1e70439cc47914f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05846.php", "upstream_id": "BenchmarkTest05846", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64be57c83b28d7ffaab21cb9306b5ad0ec83dc550959b04d8494592e5f339875", "structural_hash": "f6fdd9a22545417ba2ec508162fd5546d9123623c5cc2fabaa59d81be4d66ef4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01599.js", "upstream_id": "BenchmarkTest01599", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-784"], "category": "cookie_no_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bab52b304e91cf7a6589de4547a8fb87244c5ec59e1747ffa9d87338bc57890", "structural_hash": "c725540813dd1eab7e37d20a23183063da30c8b963a3c6bf1c4e672e893fa11a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01362.rs", "upstream_id": "BenchmarkTest01362", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n struct FormData { payload: String }\n let data = FormData { payload: multipart_value.clone() }.payload;\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d704468a1a9458fb3fcecee9180412a6549829bbbf0a83eba559203ebd4d2efe", "structural_hash": "b6b898bbf81a37f6ec7940579634eeaf0835a492400e539230914f09b3c3e71b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19206.go", "upstream_id": "BenchmarkTest19206", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := strings.ReplaceAll(jsonValue, \"\\x00\", \"\")\n\tlog.Printf(\"User action: %s\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4698def4704328263b1b8ee745133d6d8546be3cbeb1cc588e690258081ed92c", "structural_hash": "46cc0962243e5e66b7e3fbb82461b3693f0071cc728e036b7e3638878c662711", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03612.rb", "upstream_id": "BenchmarkTest03612", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = Thread.new { user_input.to_s.strip }.value\n eval('redirect data')\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3061a69a111e5dbf76aad338e4a17ab059ec8a319dedf6ec17becdf12e5f3aa4", "structural_hash": "c7618acc1e5b136b6391e2bb910a13d6b4f4c3be2d9a7bb4b3ba62396f0a80a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05494.rs", "upstream_id": "BenchmarkTest05494", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n struct FormData { payload: String }\n let data = FormData { payload: upload_name.clone() }.payload;\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6f5d92bc283a733571763a4ccf99d8ad26b63c6d3e568293b02cc66e64925c8", "structural_hash": "3f347b8facc20873c0c44db15ab5bd892283a3ecf6200a4913b042e42d150312", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05755.php", "upstream_id": "BenchmarkTest05755", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $data = (!empty($userInput)) ? $userInput : '';\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b56804fbd442c029a124c40eae57bdb223b41e7dce8af8e9f855fa6db59d2d9a", "structural_hash": "75900fbc36162a52ba59835e9d0dd6d77d8e3cf5771555b35a0460a8c70ccaeb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02039.java", "upstream_id": "BenchmarkTest02039", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @POST\n @Path(\"/benchmark_case/graphql\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(GraphQLRequest req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n String data;\n if (graphqlVar.length() > 256) { data = graphqlVar.substring(0, 256); }\n else { data = graphqlVar; }\n if (!(\"true\".equals(data) || \"false\".equals(data))) { return Response.status(400).build(); }\n Object codeResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d8b9f2f95071a468b2393ac40a9abe4e11c08ad66b69fdc802b11e02c9a7fad", "structural_hash": "d59717edd3d575f0f010b5450a08bbbcb397285ed854f8b4d88bd738ed9107d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01621.java", "upstream_id": "BenchmarkTest01621", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static String stripWhitespace(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n String data = stripWhitespace(forwardedIp);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n return Response.ok(\"{\\\"status\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28d50f37ec2b7d2c715528f1e6d6af2a1feca5f992d5d62fa440d35bdaa3cd46", "structural_hash": "0a4d6d3a14fa61e017f3525651b551591ab3fddb2754081b63360ac730c179ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04747.py", "upstream_id": "BenchmarkTest04747", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = f'{raw_body!s}'\n return jsonify({'status': 'ok'}), 200, {'Content-Language': str(data)}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d07d2fef044d52c7208e36fb1946daa5cd1087ffce6600b2c391ca4e329a325", "structural_hash": "f43ae00711cea68c2dfa1893d5bf140fb90994e13b3cdd0742f90bb4f0d9c0f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03540.rb", "upstream_id": "BenchmarkTest03540", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"STDIN_DATA\"] || \"\"\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n File.write(\"/var/uploads/\" + data, \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a56316ab30832628ad6d0ce43c776f1eed98ba1390fb4c815d5563fcd062018c", "structural_hash": "a6a646883661a4ef6a9bc2403d53ac77f694326020763ae4656d2d24d299a16f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00649.rs", "upstream_id": "BenchmarkTest00649", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let queued = db_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92105d186c594ee48ddcfc6ff90867831bc5f99a840dc8ce2e353fb298f0cde6", "structural_hash": "d8266f8914841acc7f413af9fde4845a2de1f9f3d8e3d902e62f78c89abf58dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01811.rs", "upstream_id": "BenchmarkTest01811", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse rand::Rng;\nuse rand::rngs::OsRng;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data: String = host_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| host_value.clone());\n let _token: u64 = OsRng.gen();\n crate::shared::store_session(&format!(\"csrf_token:{}\", data), &_token.to_string());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b30065dd99da59ece3e80a20f0a4276595a846893028c15a81f7e6ebc7e80f8", "structural_hash": "d2c1e0b61afc0b26c97cf9248e6cbfd4ffd3e001eeaa8a442081c8ad240e9322", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01855.rb", "upstream_id": "BenchmarkTest01855", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n Digest::MD5.hexdigest(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6595ffb26a75a32e16630cfe9dc3f7dc536f2187013e38b2e00b0bf808f9352d", "structural_hash": "7d4d394da24d2d115a06eca2f43b1e97b5baf2adea3f5390b531b887c689fdc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01100.php", "upstream_id": "BenchmarkTest01100", "language": "php", "code": "name;\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n simplexml_load_string($data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b072fce2e1f25b5931f2080c1022d50812efd2759d6c13a5dcb095f28fe9f849", "structural_hash": "c18b785a36a0162a4e979c91ad31dbafd4c86cd2b8065c5237f6103b523113e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09866.go", "upstream_id": "BenchmarkTest09866", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tpending := strings.Split(originValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tos.Chmod(\"/var/app/data/\"+data, 0600)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23b862fd11bb231c8083ee5906c1b549e5dc60a65036a2219a35c648ff4d196f", "structural_hash": "2605de974f2f24a5aab2933b9a8eb630ffd4621833f74eae536aafc49e7e5f5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03703.cpp", "upstream_id": "BenchmarkTest03703", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n const char *_sess = std::getenv(\"SESSION_SECRET\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2577ea2441879baa4e0c3505a3ccb3352d5010a6c036550436a7f6f206e56b7", "structural_hash": "bde4019b26582b793ea5aead8a9387312d0e58a79000e427f454b2430c629e60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31535.sh", "upstream_id": "BenchmarkTest31535", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n case \"$user_input\" in\n https://app.shcdn.net|https://cdn.shcdn.net) allowed_origin=\"$user_input\";;\n *) echo \"forbidden origin\" >&2; exit 1;;\n esac\n printf '%s\\r\\n' \"Access-Control-Allow-Origin: $allowed_origin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6af4fabc7cf2490fa2547c4ee5dd244b3385eb489ed7f6a8f22166116aa92afd", "structural_hash": "6f0930d502904785d2cf57f51d38cba4033d325f0119df8c0799344f4fabe367", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32762.sh", "upstream_id": "BenchmarkTest32762", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n data=\"${user_input//$'\\x00'/}\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a14b95555d9a9bb31a195f50eb4a6c05d4dbc0b9be613be91525810f04399bff", "structural_hash": "2583604209dea51be7dbe7eef67bfc968bfe49760a7ca14119d6d137ad1cbe28", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03094.rb", "upstream_id": "BenchmarkTest03094", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da3c0cf7c864f59e3f7c846b03a1eb11af2d1551b4a32ece7595929ca3909110", "structural_hash": "832679a3fc3e545c7d2f9c578e5786ff6c6ffa6ce5b332961dd666e3b9a9f419", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02954.rs", "upstream_id": "BenchmarkTest02954", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(db_value.clone(), |s| s.trim().to_string());\n let _ = data.starts_with(\"true\") || data.starts_with(\"false\");\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c1a0b91b5beb2723b20a58dc6530d8e1538117888ba025ecad0ea1152abe06c", "structural_hash": "99a18e29bd3f1ebccfd0a4b80a604f43725b49e790bd3495e33131bc2b2e559a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04199.ts", "upstream_id": "BenchmarkTest04199", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n if (![\"ls\", \"cat\", \"date\", \"whoami\"].includes(data)) { res.status(403).json({error: 'forbidden'}); return; }\n const allowedBin = data;\n childProcess.execSync(\"echo \" + allowedBin);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63e9ec631e090894cf2970b00f5584640146160fd86a805d3796ed2311152cd2", "structural_hash": "7eb4d31c5ac8d410e99ff725f018b2886147b0addd777355e08f37880e07526a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05767.ts", "upstream_id": "BenchmarkTest05767", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed: string = data;\n const token = String(processed).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c52d786e8b042408a6473670ed6bafe1d109620f8c23a109801d31fed2a9f034", "structural_hash": "bf350ea325a2ab53d451db38a4d9265ec1155300d9a36c9dc7b87ed521393390", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16895.go", "upstream_id": "BenchmarkTest16895", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := strings.ReplaceAll(authHeader, \"\\x00\", \"\")\n\ttmpPath := filepath.Join(\"/tmp\", filepath.Base(data))\n\tos.WriteFile(tmpPath, []byte(\"data\"), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7ee3004684629570533018ca9d275c44f94b8eedb310a02a84532698f997230", "structural_hash": "a376b2567ef3483037865c66038a6bb44ca3cfeaf1c90a8411a3aa4367141245", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12678.sh", "upstream_id": "BenchmarkTest12678", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n cp /var/app/secure/template.cfg \"/var/app/data/$user_input\"\n chmod 644 \"/var/app/data/$user_input\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50acb55ae6400c9de0e11958d91773dc27f83a2f03d43b502ba04558d97e6917", "structural_hash": "69a9be8eb554dd44c13f04f5c023d78f299cceeffb5ffc4c5d3ecd8408bfdcfb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01313.py", "upstream_id": "BenchmarkTest01313", "language": "python", "code": "import logging\nimport re\nfrom dataclasses import dataclass\nfrom flask import Flask, jsonify\nfrom app_runtime import db\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n form = FormData(payload=comment_value)\n data = form.payload\n processed = re.sub(r'[A-Za-z0-9]{4,}', '****', str(data).replace('\\r', '').replace('\\n', ''))\n logging.info('User action: ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f24fecb05d6546037f85a1cd4bf100a5ce8abaf3349feb531aa81f50891e834", "structural_hash": "c2a5144ab26865cb88fe7568fffb2c63b38dde01c9196dc2b5001e1e4062d121", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_38875.go", "upstream_id": "BenchmarkTest38875", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/golang-jwt/jwt/v5\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tsecrets := map[string]string{\"key\": \"p4ssw0rd_test_dict_secret_key012\"}\n\tdictSecret := secrets[\"key\"]\n\tcapture := func() string { return dictSecret }\n\tdata := capture()\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{})\n\tsigned, _ := token.SignedString([]byte(data))\n\tc.JSON(http.StatusOK, map[string]string{\"jwt\": signed})\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c33969cf0d77b0837688a35013dbd35681da0eb0c88796707c73b84d7318c11f", "structural_hash": "df5d64fa1de5a26a7f3f53d9591a450dd77690b8c0434388b8152b15f99cc0b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03828.rs", "upstream_id": "BenchmarkTest03828", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let captured = multipart_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", data)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0472bd8d86d5c3ee440a8baf0b3e30c51bac0308768245ce6a141782a0f224fe", "structural_hash": "ab39e0e3519c1b3b8fb9c9718bf4275fe89bf4df498d226d55e15fd98d88a801", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03831.php", "upstream_id": "BenchmarkTest03831", "language": "php", "code": "header('Referer', '');\n $data = str_replace(\"\\0\", '', $userInput);\n return response()->json(['ok' => 1])->header('Access-Control-Allow-Origin', (string)$data);\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adb6f91ae9fecab2e30115670866cd610286fac80fc2e0706ac477a8eb2261f8", "structural_hash": "4507e26fcc2f9fd6c159e20567a6c3ceca31233b160e2961d6f2f06436b9d372", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02334.rs", "upstream_id": "BenchmarkTest02334", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = referer_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f57bc872d1079c97dee87f26f8f2ddcff0dbcf11a66c9f0a7a019f5f540d99e", "structural_hash": "921c7f0f742179b196148ad49af8b1d5987019761f01989943398ce3af28afe6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_31664.go", "upstream_id": "BenchmarkTest31664", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(graphqlVar)\n\tallocSize, _ := strconv.Atoi(data)\n\tif allocSize < 0 || allocSize > 1024 {\n\t\tallocSize = 1024\n\t}\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(data))\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f0847083d5153a07908be96f5eb8b3597b6a4e25fda11c90d89a7d5eff0afa6", "structural_hash": "5f16d10bcf5a6f20861be81fe640e67952ea8a1cd29a2fad0226ad77ecda64f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00478.py", "upstream_id": "BenchmarkTest00478", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n def normalize(value):\n return value.strip()\n data = normalize(field_value)\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JSONResponse({'error': 'CSRF token mismatch'}, status_code=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e66022e3322e930d66b8e28f134932661437c6a6bfc1f3df4bbd41e5386d534c", "structural_hash": "4e70b4cda7b368d97458f39860d19eb45f1b141be467b52709c4bee20c50b6be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03673.rs", "upstream_id": "BenchmarkTest03673", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", user_id).ok();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9870a90327e09bd096108aea7e629e2ffd7205af6ad13acc8eb528089a0569f2", "structural_hash": "a558b87f6f87cab0b472aedb103683d2e46e74ec1f85974caad6db7bc0489609", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24338.sh", "upstream_id": "BenchmarkTest24338", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n if grep -qF -- \"$user_input\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ab82d7fee34d9ed74cb9407b0c060c3002c7903a9b4e72ad5f4e62db378d662", "structural_hash": "43a33ca8f7dbd5278d6347e70d476aa91893f970788475d33ff93cfe63beac9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03081.java", "upstream_id": "BenchmarkTest03081", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { PLAIN, MARKDOWN, HTML, TEXT }\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + uploadName;\n String data = valueSupplier.get();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object evaluated = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.getWriter().print(\"
    \" + evaluated + \"
    \");\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "944d0847e608c01164b29945396d91a47e011d54816a67b85dee6b85b7186250", "structural_hash": "ba9ad0a0dcad0443d8ceb72ce43942fda0ac6292e9cd3699dae81c47f3467187", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01581.rb", "upstream_id": "BenchmarkTest01581", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n return render json: { error: 'forbidden' }, status: 400 unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n Rails.logger.info(\"Action: \" + processed)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cefdb569abb446eb97c62555a145156a68913f9c24409fa2debf8a0a1b5c2ce", "structural_hash": "323739ddcab6597af302edde18ed5aeab750d3b210252a629d798144579157d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02607.php", "upstream_id": "BenchmarkTest02607", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n return new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "001861764d5ab53aa37d7fc3827c1f9f4bdd8afee5cc487443bd5c54950f73b9", "structural_hash": "c7aa8b541f89b8deaa3f8d48040b5d35fa2a8831584e51989b30ef33a2274f61", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04396.py", "upstream_id": "BenchmarkTest04396", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\ndef benchmark_case(request):\n upload_name = request.FILES['upload'].name\n ctx = RequestContext(upload_name, source='form')\n data = ctx.payload\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "854d35ebd8f96d6eb632ba4b0a590cabcb66a76935d5683318d424a106e29ad6", "structural_hash": "94725fae65a370627b38172eeebf4435779681937b146ab7fd9d69a275da771d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05358.py", "upstream_id": "BenchmarkTest05358", "language": "python", "code": "from flask import Flask, request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n ctx = RequestContext(upload_name, source='form')\n data = ctx.payload\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return jsonify({'error': 'invalid integer'}), 400\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return jsonify({'allocated': allocated}), 200", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dc7c6792b4dc0a158b3e8e05bcf482f853ce91869809ab5f4d317ac60fc48ae", "structural_hash": "6e5a45afd2baf81cc7b879ba8988e5e33d5a6ab2e2109c2c07e34d93fcb6d480", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18937.sh", "upstream_id": "BenchmarkTest18937", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bcc8722532b74b5a9917ab71fc1d04df3e5db15bf4c729c92780fd63d2bed8d", "structural_hash": "b46d4bdca430ba0c41aa70317b2f112a681aa6b221baf45d7cac784a67ed307b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04780.ts", "upstream_id": "BenchmarkTest04780", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n JSON.parse(data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a7d9c8e32d7ebc2bb69dfa276093d81e6a52fa7e77526da849c86083abba5c5", "structural_hash": "fe3f59a68655c905f8bec6ee6c2ad38282e9eb0e7e55cb73e84824164b11aefb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09515.go", "upstream_id": "BenchmarkTest09515", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tvar _b strings.Builder\n\t_b.WriteString(headerValue)\n\tdata := _b.String()\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\tc.String(http.StatusBadRequest, \"invalid option\")\n\t\treturn\n\t}\n\tprocessed := data\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\tc.String(http.StatusInternalServerError, ldapErr.Error())\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+processed+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tc.Header(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a37aebc17a8c55dd7752760869330cc31bbf9deb39963d7eb088f00daec641c7", "structural_hash": "c18f565b2442acf3f8e942909eb2cf29028824ddf8d3139466765658df0b8e34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01027.py", "upstream_id": "BenchmarkTest01027", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = f'{json_value!s}'\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b980ea48532dc1d60da23adebb2a02f5022751dc3691371dcc3917e717b4453", "structural_hash": "735bbdf6302ff3ad316c0a30374826e8a20dd9c4908a9c51809bd328c6c0b8a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03002.ts", "upstream_id": "BenchmarkTest03002", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "485b004c6c8cf2bde684b7e3e62798331fe1d5f3cadb4a7f499291866d056335", "structural_hash": "0e59d0c3aa2d4e5a6be92b10f6b0f8a998005c7ee9f3cec79688646b3074fa9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03057.php", "upstream_id": "BenchmarkTest03057", "language": "php", "code": "header('Authorization', '');\n $data = call_user_func('strval', $userInput);\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05360c15b3e8f7e524a123675b518720f10707f44e49f71e8c218746c4ccf51d", "structural_hash": "3152cc00eb8465b1452c8d767ceee8c5c6f1ca89f9f9afa3d8844bebb193c11c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_06013.php", "upstream_id": "BenchmarkTest06013", "language": "php", "code": "cookie('session_token', '');\n $data = call_user_func('strval', $userInput);\n eval('$content = file_get_contents(\\'/var/app/data/\\' . (string)$data);');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d7d855bbe6cf87b9d5745a56c9f1a181404aeee0b2230433c8988956744aec0", "structural_hash": "4a13749c492705b3e67cfffefe29bcbdd1fa2c0b140b661da15c0acd8eb6f5d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06041.js", "upstream_id": "BenchmarkTest06041", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = Buffer.from(userInput, \"hex\").toString();\n console.log(\"Action: \" + data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa96221685cea46f8edae94ba1856b6e556c9508b3dfd245cdda06813c150c30", "structural_hash": "274519cc7f45e69ab2f1528331afdab798534bf5e0b1513abede4849cd90c296", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_30055.go", "upstream_id": "BenchmarkTest30055", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tcapture := func() string { return multipartValue }\n\tdata := capture()\n\tif data == \"S3cr3tToken\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-1390"], "category": "weak_auth_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07826974579b9665cc56829e681c7b8dd6af119516c5e307d05c8e01b4f2acb1", "structural_hash": "285d73a6b0967bc492325a1ec7658fb4de3df39db3d37b776ac3a9ed8e01e3a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04979.php", "upstream_id": "BenchmarkTest04979", "language": "php", "code": "headers->get('Host', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { throw new HttpException(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n $conn->executeStatement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e095fa6afd75a3764374c4b0004d88e549371b9dc57da721fcc66e91843d5981", "structural_hash": "1f6b4059231ac67d9dea8d7c0f848b69a9c7382bed4d1adfe9b30e83eb241c9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00862.java", "upstream_id": "BenchmarkTest00862", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = String.join(\" \", rawData.split(\"[ \\\\t]+\"));\n response.sendError(500, data);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9dd21bc5550f74742f98f2395833f527d484380c23aaff92678359ee6d0b409e", "structural_hash": "f17bd0902c995e9d9165d8a263538173e37b226cde5f6ea4dfef8e7c4383edcf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02345.java", "upstream_id": "BenchmarkTest02345", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"User-Agent\") String userAgent, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String data = normalize(uaValue);\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object evalResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "046b10e1a4cedbe8b4f7868dea82d84608ad4873a1f5aa2742a6427ae0ea57eb", "structural_hash": "85f5f4663c3adb40e7952c13ac33e43e7f5c0354c55fbeedc3da5f3114dd38df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05049.php", "upstream_id": "BenchmarkTest05049", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $processed . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd1f0b39fbd289e3ee6b3e15c7618b2dcfac37435db41a936e79ed28a3ad22ae", "structural_hash": "6eabf58402a07c70e01422266df528e80fb27a9df293d7898c5b1d77b7d816e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27341.go", "upstream_id": "BenchmarkTest27341", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvar data string\n\tif len(commentText) > 0 {\n\t\tdata = commentText\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tallowedBins := map[string]bool{\"ls\": true, \"cat\": true, \"date\": true, \"whoami\": true}\n\tif !allowedBins[data] {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tallowedBin := data\n\tcmd := exec.Command(\"/usr/bin/systemctl\", \"status\", allowedBin)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ac05a42a5067593f3a0cbc63246d03d291d8de2ba707c879bf30e42e2f78bbe", "structural_hash": "b3b94bb9b5de53ab1dac2d25105b20b55618692df6610b2a4309e07e498af55c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21826.c", "upstream_id": "BenchmarkTest21826", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", data); fclose(_cf); }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdfa99c505d18d65e5062a385b02bcd75d49887fda8e0163f2ffe37b761909b5", "structural_hash": "66022feafdc5b8e9345de5fc8151bfc576defd821a97d55fdd9393387129282f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04976.py", "upstream_id": "BenchmarkTest04976", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n parts = []\n for token in str(auth_header).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n if not auth_check(str(data), session.get('token')):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f93e1dc88aee183b59699f467a5717bcd3baa333cd4755c32ba2d5085d851320", "structural_hash": "8c9d33860264e149164a2935c4d26769998285d9dd848259356554b22e1fdba4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03756.rs", "upstream_id": "BenchmarkTest03756", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let (payload, _origin) = (db_value.clone(), \"http\");\n let data = payload;\n let processed = [\"true\", \"false\", \"1\", \"0\"].contains(&data.to_lowercase().as_str()).to_string();\n log::info!(\"User action: {}\", processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86c5abffaa49892689103696264bf90618152cc73c3effae64a185cbd36088df", "structural_hash": "5556207ed59fcdb6efaafd306c1afea24f6d0f4ddea28d4429e047b82650880a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03846.php", "upstream_id": "BenchmarkTest03846", "language": "php", "code": "headers->get('Authorization', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n $processed = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n return new Response('
    ' . $processed . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7afc1387af2cba9496098bac1b6a18d83fa7201aacf7b03c08e5a72f91a0c3f8", "structural_hash": "6910ceb3a5c35977ad6eb07221cd152ee0bcc26f3a7ac6f7ff05604a2540cac5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06098.ts", "upstream_id": "BenchmarkTest06098", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const data = `${userInput}`;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.send(nunjucks.renderString(processed, {}));\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d241ebcc3befe60eb53aec2bf0c71e9bd54a8410c41f47a4b360c465505bc9b", "structural_hash": "34b98c49572de0d8d29be42eee3e9d7231e8c700a9437c612cf1aa9adcc577dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_30226.go", "upstream_id": "BenchmarkTest30226", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tcapture := func() string { return refererValue }\n\tdata := capture()\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\thttp.Error(w, \"invalid option\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\t_resp, _err := http.Get(\"https://api.svc.cluster/lookup?q=\" + url.QueryEscape(processed))\n\tif _err == nil {\n\t\t_resp.Body.Close()\n\t}\n}", "label": 0, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0541600497bc2d25eeb83b1371f51b5f3b036476ab2f749fc50970c62d11bacc", "structural_hash": "bfe7ca8c271c984447bc762fa15b49dd5c9eb628ef710b25a5672977eb2d74c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11930.c", "upstream_id": "BenchmarkTest11930", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char *_found = strchr(data, '=');\n printf(\"%c\\n\", *_found);\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ae6114f9e74798b01b941ddbe8f772b87a4068ded1d1ab954166b8d068b9b02", "structural_hash": "1e9eb8ca9c40f2ce1ca1d31778790ae7d358d9700d613bbd3063668124665940", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04017.java", "upstream_id": "BenchmarkTest04017", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = normalize(refererValue);\n String escaped = \"\\\"\" + data.replace(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n return Response.ok(escaped + \",data\", \"text/csv\").build();\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47f0fc80f744949fb2feb8aed38bff4434cdccf4c873e7bc20d536906c1cabbf", "structural_hash": "884850c760b41849fc0b372efef5e074a380973e8bbbf43a7c0877d9cb969b99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03326.php", "upstream_id": "BenchmarkTest03326", "language": "php", "code": "getContent();\n $data = ($userInput !== null) ? $userInput : '';\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f12f29eb36bda045ff5bfb0b24bc35bf95926f98edffa8a3bef088e211b465d", "structural_hash": "99e6413496aa4bd112ea8c11fadf6b68bac91c9ba02aa526ec3ba6b877747653", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_06016.php", "upstream_id": "BenchmarkTest06016", "language": "php", "code": " 64 ? substr($data, 0, 64) : $data;\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$processed));\n return new JsonResponse(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18031862533fe001a0840bec427d98fff9e595e5f3db7b2e658ea5bf48d16f3c", "structural_hash": "935dbd878784a75e40c3d77902988d2a05992fe0dbe64e7f44f5876fdc7039b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28072.go", "upstream_id": "BenchmarkTest28072", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tsegments := strings.Split(dbValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tc.Header(\"X-Custom\", data)\n}", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "295ea2544e3b146d841961c4f6ac50bfe332ab5c662bd4da2736c6ebcafa2266", "structural_hash": "53a0874be73023e7e246967731536bda02c3dcfbc7c5ee5aa5074bc3b94383e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01652.cpp", "upstream_id": "BenchmarkTest01652", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DOTENV_VAR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5169bc02b39b1b8427953b78c1bdab4efa3f8eaeb572196fe265844a46a75cd", "structural_hash": "6f5276d71bba6424f46ae0406377e99a7c492cb4d8894e5e9ceca97ef0e2c7d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00418.c", "upstream_id": "BenchmarkTest00418", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_passthrough(user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n free(_p);\n}", "label": 0, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "708c0a1e4dfe5b31e98a96b2ac2a91577d6086828714b8159f37b0024d68631f", "structural_hash": "b6477c922d43c6e73d150d32599e547cbc0f3a0af65b5efb56d1d61a8e38d794", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15354.c", "upstream_id": "BenchmarkTest15354", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", safe);\n system(_cmd);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8f5110d7a80a9c4dd449a41b78796311e15ea0e610c22f4816f5b80de236798", "structural_hash": "04b4e4f203a6555c7fc6ee007778058a319dbc2c58cecf4a717ae69932ff9845", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02218.rb", "upstream_id": "BenchmarkTest02218", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n system(\"echo \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e990b1a589e7e624891fdb55b4c318fa621d1054c389a5a4be96f8d37335ebe", "structural_hash": "466dd451556c7a7596f60f2552422297a0fad3a6f92f7b8e20521b9532b0be2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05472.java", "upstream_id": "BenchmarkTest05472", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n request.setAttribute(\"bundle\", forwardedIp);\n String data = String.valueOf(request.getAttribute(\"bundle\"));\n String processed = data.length() > 64 ? data.substring(0, 64) : data;\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(processed).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97ed4ba502eaefdecda9f12ebbd1a4ac9247d7adbef6e3e01677fbc863e9b374", "structural_hash": "3e6aeffe5cf3b234ce583202128557ce38ec78fccd0d8f35581c98293b510bc5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_02436.js", "upstream_id": "BenchmarkTest02436", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9be84bbd9dd62815003ec7af6c91dfde9456dfb38127a835d9fd249a1107256", "structural_hash": "2a27ed1fc89af033187d4697fcfa161ce6f48be7ae873836eb10eff2b037583d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01822.py", "upstream_id": "BenchmarkTest01822", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nfrom starlette.responses import JSONResponse\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n data = multipart_value if multipart_value else 'default'\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "688db3b76b69dc6addc26ddad3936fbd3e69915b85ce4fc5ded87a56061ea62a", "structural_hash": "7c523ddfdc2b9bf39313639174578bd6c0f88bdfc9817f8662042de40d244a6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05247.ts", "upstream_id": "BenchmarkTest05247", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n const _host: string = new URL(data).hostname;\n if (!_host.endsWith(\".trustmesh.internal\") && !_host.endsWith(\".trustcdn.io\")) { res.status(403).json({error: \"forbidden host\"}); return; }\n const targetUrl: string = data;\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(targetUrl)));\n fs.writeFileSync(\"/var/app/active/pkg.bin\", _content);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d2764697e904fe6f18a907e126f94fef4698a70010a1fe235dbd6f74c3b201f", "structural_hash": "36213b146f490051335b223e24e34c5f589e6570ab9790f587a81fc6a428f22e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11756.c", "upstream_id": "BenchmarkTest11756", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n printf(\"%d\\n\", _arr[_idx]);\n}", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd8ff36b7b4fda3535b542811b803d18cfca6dbac2810be10dff7f12ec421c24", "structural_hash": "49dfdf99c3ada1c9b45c16d5499c54a60fa726703a5a10015bbb9b4735c6cd39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28187.sh", "upstream_id": "BenchmarkTest28187", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"request processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25c17c691c70865959079200c29653e846dd4c8f08ce5807e339dd90f680fbc2", "structural_hash": "afcc384c2632f9ccf655abe9a601ad0816edf98cb9e6af1dc2235d75a4ea3ff7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21463.c", "upstream_id": "BenchmarkTest21463", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n const char *safe = data;\n if (strncmp(data, \"https://api.internal.svc/\", 25) != 0 && strncmp(data, \"https://cdn.internal.svc/\", 25) != 0) safe = \"https://api.internal.svc/data\";\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, safe);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8751c3c6488126f46ed27a6ad3a04049b836cbfe99dea52da63d7d344b5db51", "structural_hash": "dc8608fe07312639e588862d0f58695de4aa7e4679352ccd4ea33dcfc25aa8e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04710.rb", "upstream_id": "BenchmarkTest04710", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless session[:user]\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n Rails.logger.info(\"error: \" + data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a32b420f32a15a66c80078c9697e75dc2a13d3cb9fbc0f3f88543d6ac899425", "structural_hash": "e5b59a707321df9224b11c4346bcf1d2ffbf9924dc1bfcc7406c197c032e9572", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04697.ts", "upstream_id": "BenchmarkTest04697", "language": "typescript", "code": "import { Controller, Post, Req, Res } from \"@nestjs/common\";\nimport { Request, Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = (req.body as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n res.set(\"X-Frame-Options\", \"DENY\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d88466b2d764a60c8f2011fbba5ee55a79baf9a8b95954c96f90221fa595062f", "structural_hash": "8fbedd5192650bebc988b26443b9acbb393e8e7e76333f1556b429980203fd7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02417.java", "upstream_id": "BenchmarkTest02417", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = xmlValue.isEmpty() ? \"default\" : xmlValue;\n new ProcessBuilder(\"echo\", data).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fd396c315cc7b6b2816eec534c4c98620e8d5112ed06e39e8be4b775e51295b", "structural_hash": "357592e9514215e53893aa8dc9239a5da97a6f07557f0c9a0e66386cae1e43e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01719.go", "upstream_id": "BenchmarkTest01719", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar profileBio string\n\tDB.QueryRow(\"SELECT bio FROM profiles LIMIT 1\").Scan(&profileBio)\n\tlastRequestValue.Store(profileBio)\n\tdata, _ := lastRequestValue.Load().(string)\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4de8751a8bce151ce64760e06099488c70a88826db122ee5cb2eee8983b42b48", "structural_hash": "6c40ff78425f5e8553c110829fba7bf61c8766ad1c796b984ea46284c5ca9e15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14751.go", "upstream_id": "BenchmarkTest14751", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"regexp\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tlastRequestValue.Store(refererValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tvalidPattern := regexp.MustCompile(`^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$`)\n\tif !validPattern.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"forbidden\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": processed})\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8bbdecdd7b878d4b16e54b113249a2b826d79e006e47ea347975c0d401659206", "structural_hash": "bebc443970a675b47049b8d2e6cb46555ffbc2a93ed28d322f882a0ba80f6520", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01093.cpp", "upstream_id": "BenchmarkTest01093", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n static const std::regex _re(\"[\\\\s\\\\S]*\");\n if (!std::regex_match(data, _re)) return;\n std::string safe = data;\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f994c0e18e1f01a09b298bfb32739d484bec1de528247e3c8b935c18059fdf9", "structural_hash": "5d2f104d8eea3889eb29e969f28cb46bef96098c041a1d0e0fe96fc2ac57ff32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02298.ts", "upstream_id": "BenchmarkTest02298", "language": "typescript", "code": "import { Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Res({ passthrough: true }) res: Response): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bfef7a67ce40f44a5472bca70a8282794e7b5f4af5667e98471e778ad52049f4", "structural_hash": "6367b5ffae5d63f10737859a6f2f7a296ce9e91fa02ee7c9f4edf798a036ee01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04096.java", "upstream_id": "BenchmarkTest04096", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n private enum AllowedValue { INFO, WARN, ERROR, DEBUG }\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{multipartValue});\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n LOG.info(\"Action: {}\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35e65471c0be3859a22ffae9259ea90c7dfa77aedcb404556eb61e35989a7bd6", "structural_hash": "1255dcead1da818dcf2c734131fe3732b3071281e8958f004276afc01308d4e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27146.sh", "upstream_id": "BenchmarkTest27146", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15f676e7a40945eed78af7c42e64fd1b9bba46c0da75676fdbaa608bdc22155e", "structural_hash": "871db13b38041e9fe765f54c1d9aad5399985343df6b89a4455b19e3cf0044bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01962.js", "upstream_id": "BenchmarkTest01962", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n const value = row.name;\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6ab09c2897d98b8bedb1ac63bbe022fe45325c99699d5297afa8b915d621fa2", "structural_hash": "7155e75dfc14cb9b2e668b13bf41e43340808d5d83e28e93dae958686e489a3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04499.php", "upstream_id": "BenchmarkTest04499", "language": "php", "code": "headers->get('Referer', '');\n $data = urldecode($userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c896b10616e9d823fb869f549e4fec2110ceec6bdfd167ee4ccbcf1f6391834", "structural_hash": "7d13c39f2e56318513a7fa1aacb548dbedab8279288f01ecf2eadc6df3e73d1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04855.php", "upstream_id": "BenchmarkTest04855", "language": "php", "code": "header('X-Custom-Header', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "963a7a6cb458a78489f5c3e5f2fb86e458c299ab292918c01d3a61975762d025", "structural_hash": "1316c2b825ec46eab297d6f1f423d9f38011ab1ab9159ed51268a2299384105e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00571.ts", "upstream_id": "BenchmarkTest00571", "language": "typescript", "code": "import { Controller, Headers, Post, ForbiddenException } from \"@nestjs/common\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const data = `${userInput}`;\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"metadata endpoint blocked\"}); }\n const _isMeta = _host.startsWith(\"169.254.\") || /^\\d+$/.test(_host) || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host === \"localhost\" || _host.startsWith(\"127.\");\n if (_isMeta) { throw new ForbiddenException({error:\"metadata endpoint blocked\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3eb86e849d3057ce5398bc4d5f4ec644ae679b637d369f32fa2f321df20f92f7", "structural_hash": "5cb96d1ed7ec2d3fd5cce020ff24b74f7ba7362534437b6dfe850ee85648b201", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13674.js", "upstream_id": "BenchmarkTest13674", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n authCheck(\"admin\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a58126051ddc7e41dfe6174bbc961c1270a2b18280058f7ac8a263e94cf1958f", "structural_hash": "16930195a16b33cb85cf9f3a6f9077927a62f7add6c3c7fd7b92774a3e49133a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05092.py", "upstream_id": "BenchmarkTest05092", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n with open('/etc/app/config.json', 'r') as fh:\n config_value = fh.read()\n pending = list(str(config_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n requests.post('http://api.prod.internal/data', data=str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d01f9ae25f922fe12390cc68734de9d4b526d25a76c1b26f64f88e18f84ab59b", "structural_hash": "97b2ee394013537343beec736bbd543dfa4c127e9bb3180d21c3410ff791bd46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02291.ts", "upstream_id": "BenchmarkTest02291", "language": "typescript", "code": "import { Controller, Header, Post, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@UploadedFile() file: Express.Multer.File): Promise {\n const userInput = file?.originalname || \"\";\n const data = \"\" + userInput;\n return \"
    \" + data + \"
    \";\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50511f43252ba588f754aaed8b3294072f5082d925931f32e254b2e8b39bc977", "structural_hash": "0c6d98c357129f5a906554e83e998c53ff86cf77c4fa84c86dc61e4fb3e24c9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02948.go", "upstream_id": "BenchmarkTest02948", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\t_prefix := \"\"\n\tif len(cookieValue) > 0 {\n\t\t_prefix = strings.ToLower(cookieValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = cookieValue\n\tcase \"f\":\n\t\tdata = cookieValue\n\tdefault:\n\t\tdata = cookieValue\n\t}\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6c2733a7ef226ba468da20be335ff7291534d5fa57420abf3181ad23c5281a0", "structural_hash": "9f0dbae303bdbe8a91ccf452ce3e72895c19f9c12428208fdfc226b4a0417bfd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02666.ts", "upstream_id": "BenchmarkTest02666", "language": "typescript", "code": "import { Controller, Post, Query, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string, @Req() req: Request): Promise {\n const userInput = id || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "154d4d84a56b00076ba1384e7d6ccb783661fe81fd393c7946b9c28d8bd835e0", "structural_hash": "9a8c96f41415dcb5c91a44bb60e0645786d24d8283ebe95275584d768ca89147", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03228.rb", "upstream_id": "BenchmarkTest03228", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = CGI.unescape(user_input)\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b9dd4d9fbdd9cf7c04115cf8ffc4ba6ae27e49ed1923a6ac9e612a0e6521eb2", "structural_hash": "da159e79d42a278fbc2c89175ee7deb9d6778eb65b5f48a30e7b61c7f6956ddf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01656.ts", "upstream_id": "BenchmarkTest01656", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n if (typeof process.setuid === \"function\") process.setuid(1000);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d5c666e318de50b08adde7ba4395998c79347f05eb7f51a3213d427413dcaa5", "structural_hash": "1e6145c6f6beacdb2c925e08e8a24bd32f1bbe062df64879eca8935f1853a17b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00428.rb", "upstream_id": "BenchmarkTest00428", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n data = !user_input.empty? ? user_input : ''\n processed = CGI.escapeHTML(data)\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11fa3f9a26d7c9769c61a95177c3d43dda318f58552dc1437748b59cb57edcc0", "structural_hash": "219cd645c71ef01c4043a80fb22521b62438787ecb48cdac76959cad0e5bbcaa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12065.sh", "upstream_id": "BenchmarkTest12065", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n curl -s http://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a91287c85945724196fc8570d11fc0b3b62c3ae7d75f51c8dbfbde09050ee55", "structural_hash": "bd7f616e7395a564c355a514ea373304ee79a1896a1c6628bd0d9f26ac8c5887", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05060.ts", "upstream_id": "BenchmarkTest05060", "language": "typescript", "code": "import { Controller, Post, Req, Res, BadRequestException } from \"@nestjs/common\";\nimport { Request, Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = (req.body as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n res.set(\"X-Custom\", processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39419a33f1df444b9aab744dbfe710d35cc6c68a25ab11b37a42fc89f174eccd", "structural_hash": "8728c5a997776d62ebbb9fdd62103d30048c5cf909f44c2d29934efda190374c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05704.php", "upstream_id": "BenchmarkTest05704", "language": "php", "code": "getContent();\n [$data] = [$userInput, 'http'];\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4e05e06eca9628556be86240d6352278ab59c703fcda6ad6fe094bf6531fff9", "structural_hash": "35860f0af89c978cac932dc7f5525bfcb4fa1b308c5a37937fea59aef31880f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01607.php", "upstream_id": "BenchmarkTest01607", "language": "php", "code": "query('id', '');\n $data = (!empty($userInput)) ? $userInput : '';\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2a8ecec5587a7ff448b285e39e01ef0871d098d39bebe9312f48a129d296e31", "structural_hash": "ef0e552112dccf85f257b4f96d14fdcfc4acf654e509a7288a76d2c2f2a765f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03791.java", "upstream_id": "BenchmarkTest03791", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{forwardedIp});\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n javax.crypto.KeyGenerator keyGen = javax.crypto.KeyGenerator.getInstance(\"AES\");\n keyGen.init(256);\n javax.crypto.SecretKey key = keyGen.generateKey();\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e5f450fa09882eb3ce6740aafb7c36b4b8ac5bd367f1663093b5ea016be7668", "structural_hash": "cf7494171c0de3e019046fbb65f589c06d6db31302db2913070536ec1fa62de2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00686.php", "upstream_id": "BenchmarkTest00686", "language": "php", "code": "getContent();\n $data = sprintf('%s', $userInput);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $processed . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "478ad680ccf3461044c53d973faa9d0c63b7c699117efe6897b564fd0d77ce35", "structural_hash": "d122f810ccc3f1f7087cf990fbb6b60937fa2aab36786e49d218039a3a3f38bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08925.js", "upstream_id": "BenchmarkTest08925", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = userInput != null ? userInput : '';\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc64838a6924c14559c0e1a6086d4a18241569d6bd48f8cf87b3bac5bb8c36f6", "structural_hash": "04aab9e9f8cfea70977c9287541c79c8cc17e83ece7c93f42126f8e423c37c9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19934.sh", "upstream_id": "BenchmarkTest19934", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "210a964ee94a2bf9ef54364cc60f8d1ee315a055a1e44be3c398a9bc2d19e81d", "structural_hash": "218011ad755a0bcae41bea08e0a4201adfbb5799b64b7ea823f11f33fcfb7160", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09209.js", "upstream_id": "BenchmarkTest09209", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n const processed = data.length > 64 ? data.slice(0, 64) : data;\n fs.writeFileSync(\"/var/uploads/\" + processed, \"data\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30bab3583be0733db3089b570ebf439b3aa413f5a212176831fa55937c8294e8", "structural_hash": "d127955364f5e9d239e27ed273d16ba5a68137e0224ed416f5731fff821d19b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06117.go", "upstream_id": "BenchmarkTest06117", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(xmlBody)\n\tif !strings.HasSuffix(strings.ToLower(data), \".jpg\") && !strings.HasSuffix(strings.ToLower(data), \".png\") {\n\t\thttp.Error(w, \"invalid file type\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tentryFile := data\n\tos.WriteFile(\"/var/uploads/\"+entryFile, []byte(\"data\"), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3452d3ee0a3234fbac432281883dda7485e5f51a7a5a26adf90a52bb0440215b", "structural_hash": "26c42a3d39c18392ae2290e5200d9ca21f588af31e22f96972e87b4df9b294f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04650.php", "upstream_id": "BenchmarkTest04650", "language": "php", "code": "cookie('session_token', '');\n $data = trim((string)$userInput);\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ade6c45e0d7ec603cca8e97bba8b28da89cf1b048e3ed9851c5996d35cbfcc6", "structural_hash": "dc31d0a52cb35eb4397a7a9b2d0cfef89ff078699cc83224762e1bb558d28a1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01945.rb", "upstream_id": "BenchmarkTest01945", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n data = user_input ? user_input : ''\n _resp = URI.open(data)\n _body = _resp.read\n _expected = ENV.fetch(\"FEED_SHA256\", \"\")\n raise \"integrity check failed\" unless Digest::SHA256.hexdigest(_body) == _expected\n ActiveRecord::Base.connection.exec_query(\"INSERT INTO feed (data) VALUES (?)\", \"SQL\", [[nil, _body]])\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11179ecbc2d798d33f4fd7cfe59757384a06a07ec4b87db1d364fa066ffc04a2", "structural_hash": "911d590467c9adf99df1b39bc1164e008f287e01eb671b4db9d9f56f9638825b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03578.go", "upstream_id": "BenchmarkTest03578", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(uaValue)\n\tDB.Exec(\"UPDATE users SET role = ? WHERE name = ?\", \"admin\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-286"], "category": "incorrect_user_mgmt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e16f52120bf1c1c2795631cf91e073062a12b4967b80c39830c20fa907bd7a0", "structural_hash": "e1f03e5454160f7937b60314976e2ec880ac19fc24383d44d103e76e37d39ec5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06218.go", "upstream_id": "BenchmarkTest06218", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(originValue)\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\tc.String(500, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "879ff5fc38cfaee86ad036e2a4ffef719ee2d053d3a81fe46e9d2845c26d909e", "structural_hash": "e4d77bdb5c4ce0ee6e9564952e11e73d8c8bb4231048e57ad7c1c95883f8dace", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02823.php", "upstream_id": "BenchmarkTest02823", "language": "php", "code": "input('field', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $processed . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa8c7c808638ad4d8cf1884000e2cd09d87a3d085d2f850033bc15c7efc499c9", "structural_hash": "40b669768919e8207b65d023b9d0e1042528b66157c5892253ee124cada7d0dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01001.sh", "upstream_id": "BenchmarkTest01001", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a095d03c3768b4f733630b8cd5037e46ee04f09ec2dbff18c647ef5eaa3909e0", "structural_hash": "f5a5824885726932572b19fae9a3da6ee763e12c7364ea145b478997eb58d63c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02382.java", "upstream_id": "BenchmarkTest02382", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(originValue);\n String data = normalizer.apply(originValue);\n if (!(\"true\".equals(data) || \"false\".equals(data))) {\n response.sendError(400, \"forbidden\"); return;\n }\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"DES/ECB/PKCS5Padding\");\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(new byte[8], \"DES\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1bab82c8e2d209f41b13434216d56975f8401818fa2ef0f7907fdab44e93b31", "structural_hash": "f612c89d9477bbb8a4e9432437190ea567adea6145fe09d4e6a7cf17fff86fe9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04292.ts", "upstream_id": "BenchmarkTest04292", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n req.session.id = String(data);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "271c87f1181712afbdd22be87e943ab26c37395592350c26fcc3670b7a0bb828", "structural_hash": "3cfc3d08903d7b7f7e01ad55f62ed1477c1b55d159dc515dd8b2d8b63ccdc8db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04028.java", "upstream_id": "BenchmarkTest04028", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\nimport org.yaml.snakeyaml.Yaml;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n Yaml yaml = new Yaml(new org.yaml.snakeyaml.constructor.SafeConstructor(new org.yaml.snakeyaml.LoaderOptions()));\n Object obj = yaml.load(multipartValue);\n response.setHeader(\"X-Deserialized-Class\", obj != null ? obj.getClass().getName() : \"null\");\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0f1a5ffb0b46f0cc042ff05ca8164841ea0cd82abeded5f302d1d2c298e8296", "structural_hash": "3267e32788990a839e66f4be710cc2061d1727e7d7f2a1bc7e63d6954d1d5354", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33739.js", "upstream_id": "BenchmarkTest33739", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(userInput, 10)); } } catch (e) { ctx.status = 500; ctx.body = {error: \"privilege drop failed\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d42b1ae0c6047d5df48e27a0eaf3fef33b8f9762f1404f2ca6037f6371288e9a", "structural_hash": "a4976a390493c3f5e938af44bd99669b37d2806d2d6faa8b94ac4c7707179670", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03541.java", "upstream_id": "BenchmarkTest03541", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> fieldValue)\n .thenApply(v -> java.text.Normalizer.normalize(v, java.text.Normalizer.Form.NFC).strip());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n java.util.Map records = java.util.Map.of(\n \"1001\", \"alice profile\", \"1002\", \"bob profile\", \"1003\", \"carol profile\");\n String record = records.get(data);\n if (record != null) {\n response.getWriter().print(\"{\\\"resource\\\":\\\"\" + record + \"\\\"}\");\n return;\n }\n response.sendError(404, \"not found\");\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:idor", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8a0da7dc6d81c2ac57f63b7ce8b71d9bcfb6efd4cf77e6e38032554f523be58", "structural_hash": "919219130080f69bfaf72a833dbbc36d92247b0b5bbbab82c797c61bc6505272", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04066.cpp", "upstream_id": "BenchmarkTest04066", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n const char *_sess = std::getenv(\"SESSION_SECRET\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d70144c4ccf13d7f38ec0e15a4b463f0a6a06558988770accee33eb95cce91c3", "structural_hash": "99bb4f745d60c193bfb52203414879ce69a75a8ce83fc9a75208435d8b4a0f2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02060.rs", "upstream_id": "BenchmarkTest02060", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = db_value.split_whitespace().collect::>().join(\" \");\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f35392af5fdf5116c8214071c93b6ba94302bb654efe4219631225002be60df2", "structural_hash": "78270a1b901ae31f9e553fef4791036cab39a516f333bc941ac10393da255daf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05112.rb", "upstream_id": "BenchmarkTest05112", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = \"#{user_input}\"\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b104fbbf71e1da016d0c5ad8887144a414062fe572acbac582679b7f95a04bf2", "structural_hash": "358b89754bbb20d5050783920fafe41cc2d4598377ec14407c840069efb57645", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03761.c", "upstream_id": "BenchmarkTest03761", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0927034ea65516af02c41a157b5cad23f2c68ef9081de4a0b4192b5a478a1459", "structural_hash": "3b55f781aa637f8b683a0d845e5e7197d67d9da2626261326451c362171c4e90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04223.ts", "upstream_id": "BenchmarkTest04223", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const token = crypto.randomBytes(16).toString(\"hex\");\n return { token };\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a640ac355ba9673e5a3e817deab299c7df1b37bc66addd50d29b5b03970bce2", "structural_hash": "508ad0946f18221e789cefb1c7c14eb2e6aa460df84a9dd8385eb6e9de8e1599", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07780.go", "upstream_id": "BenchmarkTest07780", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tvar data string\n\tif len(multipartValue) > 0 {\n\t\tdata = multipartValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tparsedInt, err := strconv.Atoi(data)\n\tif err != nil || parsedInt < 0 || parsedInt > 2147483647 {\n\t\tc.String(http.StatusBadRequest, \"invalid integer\")\n\t\treturn\n\t}\n\tboundedVal := strconv.Itoa(parsedInt)\n\trequested, _ := strconv.Atoi(boundedVal)\n\tallocated := requested + 1\n\tc.Header(\"X-Alloc-Size\", strconv.Itoa(allocated))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ab1356b2339cdb2670af854836df739306ee4b36dec2d04f1064306e2d1cc39", "structural_hash": "79992721c7b94df43e3df83dc5201a9696a942d461e6b883e3da70aa058a75c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26366.js", "upstream_id": "BenchmarkTest26366", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "136ac992f5033c60a788f1d19c002b255d0235711890f675835b7f4b1f659ea9", "structural_hash": "8723984eb8e5f1b3b23c4f3c3c4db69786c2fb26e21c167ae973a5f56995248d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05649.rb", "upstream_id": "BenchmarkTest05649", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n headers[\"X-Custom\"] = processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fad51f81c3daaf20733cbd0071ea2846c4742566d3ffa47f9f8c2b6b098c7b43", "structural_hash": "be48271ab7923a864df824dd9d223708a0e0ec66470fc6caf25bd5366992b8c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12476.c", "upstream_id": "BenchmarkTest12476", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n long _v = strtol(data, NULL, 10);\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 1, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fed3af58520e79db2881b095a9e1be56d4b728bbb10725da722a98e2314deeab", "structural_hash": "263936dd39ece28664b0db658e1376add97a470b0aa92b37260c54f0ee02a986", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09489.js", "upstream_id": "BenchmarkTest09489", "language": "javascript", "code": "const nodeSerialize = require(\"node-serialize\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n nodeSerialize.unserialize(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6e24304be44863901f64408173f6d44ea0d9430da65bd1dfcfeaa1a43d92c7c", "structural_hash": "fb837bd626be5c1804fd97d9bfeae8ee364e4e9b83770082de695125a849d20e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03437.sh", "upstream_id": "BenchmarkTest03437", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/app.properties)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d85e53002b85f55f34bb01e4e02ab7f4e2cf143f5d0a0606c95a87c54b5f2098", "structural_hash": "b210c2e94a74d489ad9c836f34f32cc946beb0e4f316124de290224ee9bbfc0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18264.js", "upstream_id": "BenchmarkTest18264", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0843bc1865db0d22c7dcb4216a1a13c74389cd1991c32d7bf74726fb7cdbbd2", "structural_hash": "f98f8872a4c9ca6c28cd84462e314caecdebdab880c07dda45cf51f76fc237af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01754.ts", "upstream_id": "BenchmarkTest01754", "language": "typescript", "code": "import { Controller, Header, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n return \"
    \" + data + \"
    \";\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "050ce0620311545768a8174d50e7d0a178d7373d77179a48e52912c8508d8122", "structural_hash": "81d029c855117c1ce43abd46ae2b259cc54061138996f8820de625c232896142", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07282.go", "upstream_id": "BenchmarkTest07282", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tdotenvValue := os.Getenv(\"DOTENV_VAR\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(dotenvValue)\n\t}()\n\tdata := <-resultCh\n\tos.WriteFile(\"/var/data/secrets.txt\", []byte(data), 0644)\n}", "label": 1, "cwe": ["CWE-313"], "category": "cleartext_in_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acb242fcf05eb61a7ff76356688f06476424d977d1240c6555c3b5b5ecca6b36", "structural_hash": "d615c2eb316038cf574b8cdeaea85c7151c8d13bc2743d9fa7c9c80a87f558c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01625.ts", "upstream_id": "BenchmarkTest01625", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed: string = data;\n if (typeof process.setuid === \"function\") process.setuid(parseInt(processed, 10) || 0);\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "562b541e983d6ac5b129a38fc6897b5961cc20bd50b5c4d866f2e81f45516d9e", "structural_hash": "007f3b3d8ca3f6922726da82cbdc692f91dc399c78557467585903d02572e804", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00245.rs", "upstream_id": "BenchmarkTest00245", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n data.push_str(&graphql_var);\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14f3cb3bb38ea3427cd81c38521fdbe69e7fb9be0363d0215f425c5190c28b4a", "structural_hash": "3d6d6e7fee2ab7e758a0c5d422e3248fe9c0e3c29131f14a2fdb1b206d296305", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02500.cpp", "upstream_id": "BenchmarkTest02500", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9a071e848b04bad235867104509ac044494f466d479efc103772bede0c1eac0", "structural_hash": "78022e05d317e55891b8e7242850f5c11b90faac6da3adc389bfc8bf39ce15db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35354.js", "upstream_id": "BenchmarkTest35354", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const data = `${userInput}`;\n JSON.parse(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e30854fae8ae0ae28b32bb47652e7c774fd2769194ffe3e89ba625600683c94c", "structural_hash": "535a93c31157ef521e92fa6305495d9c198995db05d266c5ab4736b05d76b40f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05314.ts", "upstream_id": "BenchmarkTest05314", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + data + \")\", scope: \"sub\" }, () => {});\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5366e3d80591ac624e8b371d119f1d74f765d59a86c72eb83255a50d5335278e", "structural_hash": "b526829017a981223045637cee5ff4aad9eb2169be5bda0e038de74f57495ba1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18237.sh", "upstream_id": "BenchmarkTest18237", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=\"${user_input//$'\\x00'/}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n curl -s \"https://api.lan.local/lookup?q=$processed\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6339070f285400f2b8efdd3bfd3770e1311f04dd69c2bde093759b1af79b841b", "structural_hash": "e25753bbd3e813a812cc8f8ea99af1f41c9967d01f051445d7df9f94df64bf31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08602.sh", "upstream_id": "BenchmarkTest08602", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n mongosh --eval \"db.users.find({name: '$data'})\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "576ef738906aeca22f6dac7a084981b29bfd9ae03392a59c7dc60f271a1f1e02", "structural_hash": "c25b544e12790a3e471ec7834d3cf26777aa6ca8936949a22efeb2731ff26506", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05648.ts", "upstream_id": "BenchmarkTest05648", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = \"config_secret_test_abc123\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n shared.authCheck(\"admin\", String(data));\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fa144ebbdd14e68677f25573e5f35bddfa84f8c4176542f682b131480fa0b32", "structural_hash": "ca9d3f13e91c8fa1260c24b13d65c7fa8bed519ceca65b50f99d73c710d53857", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01550.sh", "upstream_id": "BenchmarkTest01550", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bff80294d675357cd857806d9e4009be2b67f4ac79c1439b67eab02850defa45", "structural_hash": "b9bf3621f1d056688c6963690305186c97fc0d34207bbd234578137cc1c77297", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00935.ts", "upstream_id": "BenchmarkTest00935", "language": "typescript", "code": "import { Body, Controller, Header, Post, BadRequestException } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0536997173f92c5653ce9509e557ebfd8660523946846c780e515791dc410d2", "structural_hash": "6f10b881b7589ea401c441170b24bc8bf0cb2f07d60ba1868328c28fc5ab0eb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04062.php", "upstream_id": "BenchmarkTest04062", "language": "php", "code": "getContent();\n $data = mb_convert_encoding($userInput, 'UTF-8');\n simplexml_load_string($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad4846fd42142ac76861ef4f1a8e0fa0131d0fb16ca7a600f506bba962f2f616", "structural_hash": "1a954916209aaf0758c748eecb5d389ed1d4b99299707286071875aa6bfbcc94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02980.php", "upstream_id": "BenchmarkTest02980", "language": "php", "code": "text;\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc64b0a9b3ebc9ec41b77b72577754a4bb196369b96ca5755df05b77479533e3", "structural_hash": "6b39b5c893248d480c163aecfcb1971173d1cbddb0ab4dfce7a7abe853ffeda9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13620.js", "upstream_id": "BenchmarkTest13620", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d55a1a2bd2cb48765c540da5217d37fba012f04e3f9bf3ca6296126495c74a84", "structural_hash": "107f4a07657a94460a6e189b6ff97057aeba2bafeeb2d252b79557039215146a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02273.rs", "upstream_id": "BenchmarkTest02273", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = crate::shared::passthrough(cookie_value.clone());\n crate::shared::db_query_bind(\"SELECT * FROM users WHERE id = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b47c908d3ef2d46ed7427f7e8989c1016ed3588904141d571ffa82970422f91", "structural_hash": "9b300508095cc6a02f5585321967762dd21c1b7afce1fdcdaa7cfbafb0bdfd69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03049.php", "upstream_id": "BenchmarkTest03049", "language": "php", "code": "query('id', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (in_array($data, ['https://app.shopcdn.io'], true)) {\n return response()->json(['ok' => 1])->header('Access-Control-Allow-Origin', (string)$data);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4f44a55f35a58f1831d0faa2ae1bcfcd6d1002109e95e545c8bffa99b169157", "structural_hash": "35c55b7c22a858d833a0b8f3874d4908570964e4f6c040fd37ad081bd07c1437", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03774.py", "upstream_id": "BenchmarkTest03774", "language": "python", "code": "from fastapi import FastAPI, Request\nimport yaml\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = comment_value if comment_value else 'default'\n yaml.load(data, Loader=yaml.UnsafeLoader)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cb46d2df49022a89ed6b90e8621333bf6e1ba75af0f1919c414ade4c390c508", "structural_hash": "de8a1491f21eb3c3bfc19c92707e8afe7e6c1307fe85bfb1c3289144ef7b1ae6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24699.go", "upstream_id": "BenchmarkTest24699", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tdata := strings.ReplaceAll(headerValue, \"\\x00\", \"\")\n\tpanic(fmt.Sprintf(\"processing failed: %s\", data))\n}", "label": 1, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0da5d65b3ebe0d211dc3d6672b1f196c30999c0670503df1dd134b82266910dc", "structural_hash": "8dd6d3f3e8d4c8db7459dd0fa19b690b3878fc4ba9647568b2a74d30848a20c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18733.go", "upstream_id": "BenchmarkTest18733", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(cookieValue)\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d94efa1e62e75e2154476b2673b294a91323e690a347822c600c58c1f4c10078", "structural_hash": "8664be316e5ede53d1f071576c28d76ed29574ca8962e75ed9769536536ea6ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03958.java", "upstream_id": "BenchmarkTest03958", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> fieldValue)\n .thenApply(v -> v.replaceAll(\"[ ]{2,}\", \" \").strip());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n String dispatchMode = System.getProperty(\"dispatch.mode\", \"primary\");\n if (\"primary\".equals(dispatchMode)) {\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80e5362ffb0bdfae97aec93d66ba9de464e6f5853d65035e58ef214d3891fb08", "structural_hash": "3e3585a790a118cdee9d9838e4137b11de04f81657eaece0302f27e6e53fafce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01769.ts", "upstream_id": "BenchmarkTest01769", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data = userInput != null ? userInput : '';\n JSON.parse(data);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3973c5ec82b394bad3dadfe97830b0feeef70b8c493614bcce07118a96357fdb", "structural_hash": "452705fefbe9ad281a0a08ffa1e0c12df2edb25888d09fd4d72a92fc677f01e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03722.rb", "upstream_id": "BenchmarkTest03722", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n data = String(user_input).strip\n processed = data.to_s.delete(\"\\r\\n\").gsub(/[A-Za-z0-9]{4,}/, \"****\")\n Rails.logger.info(\"Action: \" + processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6352b791c94acfe5ad1d52dcdcce27f21996a10f9a40aaa00d40c245222825a0", "structural_hash": "3c02070baef8984513cd429f6065e122e3be207abb004672d10480f7b57c4969", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02579.py", "upstream_id": "BenchmarkTest02579", "language": "python", "code": "import boto3\nfrom flask import Flask, jsonify\nfrom app_runtime import db, auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = '{}'.format(db_value)\n sm = boto3.client('secretsmanager')\n store_cred = sm.get_secret_value(SecretId='app/secret')['SecretString']\n auth_check(str(data), store_cred)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69cf8d59f5ceb187bd0b18491c51236fce557a349db7d367f5c64c62510d5f7b", "structural_hash": "14c29cc666b242bd28fa22e4b65931658bd592dd06b74383bdd18486a181c877", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04301.py", "upstream_id": "BenchmarkTest04301", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nfrom app_runtime import db\ndef benchmark_case(request):\n profile_value = db.fetch_one('SELECT bio FROM profiles LIMIT 1')\n data = ' '.join(str(profile_value).split(' '))\n requests.post('https://api.prod.internal/data', data=str(data), verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0ce4ecb444045dcba9f816a400e35573c071b2ebf1a2eb400c8ce3c1b603347", "structural_hash": "2fd6fc540607c909b0815bc6a4710dd6fe7369a12651b3d8d374da962d206e6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_30504.go", "upstream_id": "BenchmarkTest30504", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"reflect\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\t_prefix := \"\"\n\tif len(uaValue) > 0 {\n\t\t_prefix = strings.ToLower(uaValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = uaValue\n\tcase \"f\":\n\t\tdata = uaValue\n\tdefault:\n\t\tdata = uaValue\n\t}\n\tmethodName := data\n\tinvoked := reflect.ValueOf(pluginActions{}).MethodByName(methodName)\n\tif invoked.IsValid() {\n\t\tinvoked.Call(nil)\n\t}\n}", "label": 1, "cwe": ["CWE-470"], "category": "unsafe_reflection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:unsafe_reflection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7824f523b9a7de64eb98123b47fb17cc1b5306e1f7e47c0b2b4c7b9bc51d320", "structural_hash": "a0610d5a293e1f86f4d5c5434b3ddbfff17cf0c1fe076e20b820da26edc3287d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00892.rb", "upstream_id": "BenchmarkTest00892", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c637e1b54983c0f1433485af2adace018074c0a91301699874a400c8b573fe48", "structural_hash": "14a9d963543e0fd05bff779a5193ccefb6313221746ada42a066452f1788e4c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02031.sh", "upstream_id": "BenchmarkTest02031", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(printf \"%b\" \"$user_input\")\n trusted_claim=\"$data\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9061badc6a117e63d20e170d64e0e4039098f9d8a8e6f034f742271a4ff569e", "structural_hash": "70db6658b5a748d0541804bd29377ef076af47a62ca456faeb257a44b1cdde51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03516.ts", "upstream_id": "BenchmarkTest03516", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n res.json({ listing: entries }); return;\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04ab6ab33fe7527fe11a5619d982cab04c75364214447f0e41e0432edcbe67dc", "structural_hash": "e0f3c763b5b769c0636a53d1b4efe3a918b07cadb464060207023882ce2dbc9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02054.go", "upstream_id": "BenchmarkTest02054", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/md5\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tdata := hostValue\n\tif _, after, ok := strings.Cut(hostValue, \",\"); ok {\n\t\tdata = after\n\t}\n\thash := md5.Sum([]byte(data))\n\thashStr := fmt.Sprintf(\"%x\", hash)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59c53b9ec6a11eb6cd7379fe7efbb7fdb4d8f41a2d7b3431104a5227a54c781a", "structural_hash": "6857dba0ee13292c708457951b9f308a5a456ba7954850d7436a9e70f690b9be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12401.c", "upstream_id": "BenchmarkTest12401", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5d254ac2aae1fa53ecd59c9d1f18306b2df34f8bd6ef125cf5b5c5e14a2f8a7", "structural_hash": "5e15765ea747d2d3629577c0db2137cdc3f4cc6f91bf9ffbe5e6470d0791af58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00391.js", "upstream_id": "BenchmarkTest00391", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n authCheck(\"admin\", String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-258"], "category": "empty_password_config", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "224d37d2b062a7282852094311da3a45a4a29950aec36908b629e714a5bd2ebc", "structural_hash": "65318bdb046d03d5ac67d0db24a2b441f4641154dad8ba58fafd056d66dc0e9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03119.cpp", "upstream_id": "BenchmarkTest03119", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string data = std::string(\"value=\") + user_input;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4553e10789454699cbcfc9b242fc4505439ba17c954a476fabedb371b70c00dc", "structural_hash": "e37ddfbae66f250e305284f8d68a1fbdcf31f7342f944794653d8eca6dcd8d5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01593.ts", "upstream_id": "BenchmarkTest01593", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as net from \"net\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT body FROM mq_messages WHERE queue = ? LIMIT 1\", [\"tasks\"])).rows[0].body;\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { res.status(403).json({error:\"host not allowed\"}); return; }\n if (!allowedHosts.includes(parsedHost)) { res.status(403).json({error:\"host not allowed\"}); return; }\n const targetUrl = data;\n net.connect(80, targetUrl);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb62edf8beb6a7250614d2710a95a7d98beb1f2847b8d79368c6e44bfac23c58", "structural_hash": "a08304989e153efbe0a5e9d8ff27cdcf86fd046eaa0a6dafc479c1caa668cdd7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03426.php", "upstream_id": "BenchmarkTest03426", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $field = 'data';\n $$field = $userInput;\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b8860743e5a54098a9af99a5dfd95a203384dfcd5fac98b6c85c76c10413a8c", "structural_hash": "9b5add1b7baa1f8d4eeaaa9968169ef2eb12ba60bd7cef70ab49ea495861745f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02224.cpp", "upstream_id": "BenchmarkTest02224", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef210a64af783649137bfe97f486ce6a9d0b126bbf387d5f4bcb21d559ea12b6", "structural_hash": "0123cb0789f70f8a6bdf802616875fedf59358d1d27b4b73fcf8df766d9a77d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01915.rb", "upstream_id": "BenchmarkTest01915", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n redirect_to data\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1988e8b0e4080eb8d2070be969b7315cc8c0b1ce6ac3b0952310addec983eee3", "structural_hash": "bd30ddb53aa9fbef3bb09a4c996909c65b50ff63b2b7ee51b3ca69f956335dec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00546.cpp", "upstream_id": "BenchmarkTest00546", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data = cpp_own(user_input);\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52020e4305ae9c28987f5bec26750d330a6b5de1d0c738e80849c160588bd881", "structural_hash": "3deb80c16c2e07473f5d104689996f898a77ad88e8960e37ce718e3b1d1b3ac6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37183.go", "upstream_id": "BenchmarkTest37183", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tvar data string\n\tif uaValue != \"\" {\n\t\tdata = uaValue\n\t}\n\tDB.Exec(\"UPDATE users SET role = ? WHERE id = 1\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "801cdf1c6bc606846b5c309a8d8dd7be07274fa2055cd5cd16d5a2553b4f1a64", "structural_hash": "5684bf00e5a3ee04511cd0adbbd2f2bd6701b729669ffef24321e90f8e9cbdba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04234.rs", "upstream_id": "BenchmarkTest04234", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", multipart_value).ok();\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb42e981baf1f32fb404d3b0fb2c26b4422024da5cbaa0fb36b54eb18e769e42", "structural_hash": "2084a7dd3d708f57c103d81ec996de2a2a57a5464cb21f55c93dd919ecf8e42c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01276.ts", "upstream_id": "BenchmarkTest01276", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6a4bc26a64d36250efbd38476c7f6d27e20436eeb3cc6b333b4c99950341d03", "structural_hash": "a05175fdbe3a1695b8432d6ffda765e3d9934ff983438d34868d903e5b5cbe22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04634.rb", "upstream_id": "BenchmarkTest04634", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = settings.app_value.to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n cred = Digest::SHA256.hexdigest(data.to_s)\n _ = cred\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6819f8a2ab85e1d0ea4db7db438787e673386cbbc09b1b2e0f8e151dca6830d1", "structural_hash": "19ea58d965dc26de5211bb465021684f93531932b8146699e32e2df71552868f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01829.c", "upstream_id": "BenchmarkTest01829", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0dde44e2ce64fbcf074f70b3031462f39fb32e2ce57122b2c1eabd132de4bc3", "structural_hash": "83e140fd724b0cc034f42084d223d9c1eeaa1494492f8aaeebd9cd2715eab99f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03886.rs", "upstream_id": "BenchmarkTest03886", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = crate::shared::passthrough(auth_header.clone());\n if std::env::var(\"APP_ENV\").unwrap_or_default() != \"test\" {\n crate::shared::render_html(&data);\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43e7c0ffbbd93d770f11517cbdeb5db9c77ee821fc92ff007826cb7e2282746b", "structural_hash": "9e84aee36ab580221fe04a73f1e291a544d6bcb98644df3f6947a45a90f40e52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02821.py", "upstream_id": "BenchmarkTest02821", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nimport boto3\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'default_setting_value'\n parts = []\n for token in str(secret_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n sm = boto3.client('secretsmanager')\n store_cred = sm.get_secret_value(SecretId='app/secret')['SecretString']\n requests.get('https://api.pycdn.io/v1/data', params={'q': str(data)}, headers={'Authorization': 'Bearer ' + str(store_cred)})\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4952539ff09aba25b169ef8c175ce20f20d5f9e3bec42a78762956b3715b2a89", "structural_hash": "5142c9ed43c40131fd645b4b3bf4bc947f70f673ea5933ef72cca6a65cb5be0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05280.py", "upstream_id": "BenchmarkTest05280", "language": "python", "code": "from flask import Flask, request, jsonify\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n multipart_value = request.form.get('multipart_field', '')\n data = RequestPayload(multipart_value).value\n size = min(int(data) if str(data).isdigit() else 0, 1024)\n buffer = bytearray(size)\n return jsonify({'allocated': len(buffer)}), 200", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ac4c6fed36b57c622685ede6ef4310abca7d16cea3da57da84d86404acfec3b", "structural_hash": "4cced29d9662058731bebd906c6be97451edcb1ba12b84ceb5aa277ba9ba7411", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05012.ts", "upstream_id": "BenchmarkTest05012", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n if (process.env.NODE_ENV !== \"test\") {\n eval(data);\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ac1f71345f650369af24ec1f9fb3e586042830065478eb6fd987bf30d014491", "structural_hash": "a38889ee5b419580fa83060222ffbf8cfd8d2de5f1e2e65d89aa16347f3fb765", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05313.ts", "upstream_id": "BenchmarkTest05313", "language": "typescript", "code": "import { Controller, Post, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File): Promise {\n const userInput = file?.originalname || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n shared.authCheck(String(data), \"admin\");\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a73222181c6fb612d064f1b411e17b1a0dc58fc4af244fc05cd61cf2bde760f1", "structural_hash": "4a76dd33cd499b0c32e08a41b2e1d62fc27b5488f832909bf4c7b2a06aeb1b87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02456.js", "upstream_id": "BenchmarkTest02456", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n await new Promise((resolve) => {\n eval(data);\n resolve();\n });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-470"], "category": "unsafe_reflection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0fc8011951602dae7f45d49d3037b8937ad5db59b16ba2f232fe4d6d137911e", "structural_hash": "6d9e68ab5d358cb4e3a3f2e27e604242a818ed6038a3c01114eae3c929ba14f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00397.sh", "upstream_id": "BenchmarkTest00397", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n curl -sk \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5017beca4b2db17cd42ffe45fc2460f3a3c3e4a7955bf5bd591910325a14c308", "structural_hash": "7e8cd3dd13c52816db7325711931c633b757cdbdebda2d0d94cd5b9f94795b0a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39776.go", "upstream_id": "BenchmarkTest39776", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tholder := InputCarrier{UserInput: pathValue}\n\tdata := holder.UserInput\n\tcrlfStripped := crlfPat.ReplaceAllString(data, \"\")\n\tprocessed := redactPat.ReplaceAllString(crlfStripped, \"****\")\n\tlog.Printf(\"User action: %s\", processed)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58d2aa4c8babf6293aa21c7bf2e43178476f6b71e3cca35ed95504125d6dfcbc", "structural_hash": "2a54b255e0dd48a830451c99cb784a4e9b2239555591eb5048a16a5b570db78f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01852.cpp", "upstream_id": "BenchmarkTest01852", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed6ae5fa8ab4f0f9eb4388247dfc177612eef8d4a5eb26ad88085a396790d948", "structural_hash": "d8f75463970210727ffe087b76ded6fd65f34f498408cc244d049a9e51195872", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26189.sh", "upstream_id": "BenchmarkTest26189", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cad21f5e6639711ed64cc20b60f24c97a7e6784f362b306a0c44a86b4588973", "structural_hash": "87ad0ce46d27f3a8a71a210e4f492a8a3d707be822ec251b8025bab3facfd824", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02209.cpp", "upstream_id": "BenchmarkTest02209", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _cmd = std::string(\"grep \") + data + \" /var/log/app.log\";\n FILE *_p = popen(_cmd.c_str(), \"r\");\n if (_p) pclose(_p);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e99f59feaedcdad281cac35567ef71a703a8576dde1c61036898ea8fbc4c988", "structural_hash": "1f19a5c4233df1106905b0b52a0cc937f4fca61baa3d29a08275fd42de98f46b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04046.rs", "upstream_id": "BenchmarkTest04046", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = ua_value.replace(\"\\t\", \" \");\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f3f5c44ef8fa5c0a245a1e39840307882fe854e31a52859877ec0e9197b4d3f", "structural_hash": "e4895c386252b4b9c94558e67bb9b48a62bdf0ed3dc65584d3eb8751753a3289", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00603.rs", "upstream_id": "BenchmarkTest00603", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let tokens: Vec<&str> = ua_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6147c17031140b3155d646837d73bdd8a7c3fe6ede58b34cae4e791e9fee28dc", "structural_hash": "8213368170b8af0a52e95bcdf1bee769a17914980d9b335e63e6dbc3402c3f17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05695.php", "upstream_id": "BenchmarkTest05695", "language": "php", "code": "header('Authorization', '');\n $data = hex2bin($userInput);\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b490074f484f094348ab4e426ea1535e357ea33c77820ec025379dc677b89337", "structural_hash": "991940623f0cad6588eb7c911bf30986926431a59f4091ec7d273a628127b07e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04612.php", "upstream_id": "BenchmarkTest04612", "language": "php", "code": "header('Referer', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "092ec949fe6361162ece961060ae1018ce83d4508042867fbabe283d888c6b6c", "structural_hash": "a4faa4f9133ae1e544809865cc820c981c59291751f1c2f748d7e158f5b020d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07792.go", "upstream_id": "BenchmarkTest07792", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tdata := strings.Join(strings.Fields(uaValue), \" \")\n\tRespondJSON(w, 200, map[string]string{\"echo\": data})\n}", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef67fdd4ba9549d1c4d90e902cb649cec7e79de7b18970c531938ba25c406cd4", "structural_hash": "5f1237d04b84fc8af14dbd038298d6e4f612cd1ecd32db7b05c2768d2f717d78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04238.php", "upstream_id": "BenchmarkTest04238", "language": "php", "code": "header('Host', '');\n $data = ($userInput !== null) ? $userInput : '';\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f1a3471ab48a2af1f34ac0c5e31954bcdd9fe53e8d80e295b15be2533e40ead", "structural_hash": "41fa242ffdc9b224ecf44649539622496ace1fd07dac6bc8e9ee163afbd0bc4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05033.rs", "upstream_id": "BenchmarkTest05033", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = multipart_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::ldap_search(&format!(\"uid={}\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe1c0ff6a3bd008a812e5953e3d90a815a425366e91b317377ee56130e6712e2", "structural_hash": "038cf8c427650e20c3c63b76eff1a812836bbac473d5476acae428929af3b0a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03279.rs", "upstream_id": "BenchmarkTest03279", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data: String = xml_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| xml_value.clone());\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3242d01fcdcaf5afb0f6b447f7929ce3c9f2998797c609bd1b741d1276907a0", "structural_hash": "113592dc317ad5b01484c2816afc737ef19fdff20045e8f431eda0f3fc725c39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12078.js", "upstream_id": "BenchmarkTest12078", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n eval(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-749"], "category": "exposed_dangerous_fn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99efa52ad055eb9b614b8bb885f47d4ca55e63ae72fe0b9371a878dcd11eb032", "structural_hash": "e4b5280de6be4fdc8e27ead44e7de3d82b5cd7b13a4e670e12272b2cd9b145e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16836.js", "upstream_id": "BenchmarkTest16836", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n ctx.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1022"], "category": "window_opener_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2745664656a425b3e3168bb8fc3eda8a44dd5d64a2c553750e9f818df385a68b", "structural_hash": "1db7e6de5a26dfc5bfd6dbb3b47ffa2059a85b240ba942573573c090afe563de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04971.ts", "upstream_id": "BenchmarkTest04971", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = await Promise.resolve(userInput);\n await new Promise((resolve) => {\n fs.unlinkSync(\"/var/app/data/\" + data);\n resolve();\n });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "868674d27b8bf428ebcac4d2c14704b4d294569d2f43474c5299e48304fff7b2", "structural_hash": "7d252ff1ee1184e602742ba7764444831b1c39423db6c8e35b605000615dcd5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17858.c", "upstream_id": "BenchmarkTest17858", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n int _vals[8] = { 0 };\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 0, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5cc61242f57901ccc93240966260acfee69ab16861abbcf14401bfc03e4d29b", "structural_hash": "5d0e7c3c0406c33fa49b3b15d903ca50bfd0660dfc2b0f1bf308968b1b053cc9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03772.rb", "upstream_id": "BenchmarkTest03772", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = user_input.split.join(\" \")\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n response.set_header(\"X-Custom\", parsed_bool)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a08b31e38738bf07c3f6bb2b78b6a96b403c5bc142f5e15ffe4de335f09d4588", "structural_hash": "9b9ecdb6888a1b8b81a8291de3a15eed25a0a30b1563d3de041f1c7009824eae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38221.js", "upstream_id": "BenchmarkTest38221", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c6a3778de00be4f1e2757097c164e94096cf4f6af182ff205693d9bdd9683ba", "structural_hash": "7c47758f61ef3d08117426f4750e98f6dae1992870d47f18d3413a678f7d41c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10125.sh", "upstream_id": "BenchmarkTest10125", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=$(echo \"$user_input\" | jq -r '.value // empty' 2>/dev/null || echo \"\")\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n rm -f \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a609dba738a55487b0907b55957c0cf1863154c7f5063ee8c8e29c4ca951aa34", "structural_hash": "49769dd2eeedc4e96f16af1aa7d135d2998a93b3d6b0f4a33da3d2a99c604259", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21557.sh", "upstream_id": "BenchmarkTest21557", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n case \"$data\" in *DROP*|*DELETE*) echo \"invalid schema\" >&2; exit 1;; esac\n processed=\"$data\"\n curl -s \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acdc336eaab8669be019a0abfeb07e32e6c0d274086f046fa8ba199dd77ab2f3", "structural_hash": "91bdd1b8924836dedcf37a8d2a9ae3e9ea697d078fd88183081a0dc2602def06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06169.js", "upstream_id": "BenchmarkTest06169", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f7478a7a8b93f8c73bdc1d82077b5647e9387c5bcb1c927750bc1ffb00eedb1", "structural_hash": "e7169dbb757fcff1ee98d0ebcf1611ed646c4fe47b7c5918151de3ca082ce9bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04481.rs", "upstream_id": "BenchmarkTest04481", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = match field_value.chars().next() { Some(_) => field_value.clone(), None => \"default\".to_string() };\n reqwest::Client::new().post(\"http://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22fef0abab9bd0efe956457538bdb8bf5a53084af9bcea6591855eb8523f9d00", "structural_hash": "77177aafe16e06f347c5a56de92c89ccc3407d72202a9ba18d319c5e3027c51c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18922.c", "upstream_id": "BenchmarkTest18922", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", user_input);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66b263230a9eb09c20509d4dfc9c96fe52a1a5d68136b753988b23e5abc52835", "structural_hash": "8375bd6921b88debc2a0308eedb6425d2f036c982b9a1fc9b31b5e1e27250234", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04562.ts", "upstream_id": "BenchmarkTest04562", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n JSON.parse(data);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "232cd4987f8e588ce3da021654b6a74202225a1b499d3288b95573e23371f356", "structural_hash": "abb16158fe25ebb6ba32112fa31c37e66b94e8e6df1e57711a5fca226d04d5ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23619.sh", "upstream_id": "BenchmarkTest23619", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n echo \"uploaded\" > \"/var/uploads/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67b0ae888e21fbd9220b34640d5802a41e113af2bce666e7c800cff1afce3eb6", "structural_hash": "b70f66fd74c13257421d3078993deb673f7e1b966a3d88129a927c8165cd9f72", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12433.js", "upstream_id": "BenchmarkTest12433", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const data = userInput != null ? userInput : '';\n res.send(\"
    \" + data + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "015699859505b27494cd1221010aaf492c0a68c5354584ebf065598e671bedce", "structural_hash": "071b82437a10f39fdfe7ee45a7c3c5b1c4b2f54135a1850ed8e46995116c8f59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04797.rs", "upstream_id": "BenchmarkTest04797", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse rand::Rng;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let data = if comment_value.len() <= 4096 { comment_value.clone() } else { comment_value.chars().take(4096).collect() };\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0d15742c9d1ae619268226ed3808127bcdf6cd436a46642ed939efc5eec461d", "structural_hash": "faa27f8caf469030c9c0d21f1d5026b2da0ff3bdd6c38f19e9e7d4c4f3435baa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04499.py", "upstream_id": "BenchmarkTest04499", "language": "python", "code": "from flask import Flask, session\nfrom flask import request, jsonify\ndef default_blank(value):\n return value if value is not None else ''\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = default_blank(cookie_value)\n if session.get('user') is None:\n return jsonify({'error': 'unauthorized'}), 401\n session.clear()\n session['user'] = str(data)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96944c62585c7a52993590e00f754207d1ab484de22b0176d90d8d8505fcf0ef", "structural_hash": "0658f93a71981ae2ffb4c65f3c0fe0168ed9e3ced6e762d3b89a45d15e992540", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06663.go", "upstream_id": "BenchmarkTest06663", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tholder := InputCarrier{UserInput: refererValue}\n\tdata := holder.UserInput\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-323"], "category": "reusing_nonce_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82495501a87d5b11c352a028b3bdae5077df78929477e3baa4d4ff4d398a5db1", "structural_hash": "e241142f80fd16697d8457840242e38c1696426b0efa3469bca3c6599950f665", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01478.ts", "upstream_id": "BenchmarkTest01478", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const data = userInput != null ? userInput : '';\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b234c447e3d50119e00437702cfe5f87c4732d6114e8cbfafcfb43adc6d7470", "structural_hash": "ead15894d8cd1491723a41ab1471bbb23e00656c340936d82c284b2a183a551a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00990.js", "upstream_id": "BenchmarkTest00990", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send(\"
    \" + processed + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d344a7740acd219cc2623f385c1306cf64d4c28168e195ad91435d3f7a4f6c2", "structural_hash": "8aa46624c530a9d1b67c355e1346a08044393ebd318b575f2a7a844bb21fdf6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00610.java", "upstream_id": "BenchmarkTest00610", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", authHeader);\n String data = sw.toString();\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n javax.crypto.KeyGenerator keyGen = javax.crypto.KeyGenerator.getInstance(\"AES\");\n keyGen.init(256);\n javax.crypto.SecretKey key = keyGen.generateKey();\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0ba76c5ba1e6035d4af350039081f29b9f02cf8164c9341fde20b6db53edb44", "structural_hash": "79b687a6d5d61bf535a0c1a0521a95dceaacab530b52230e54b73232c91b3e55", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02343.ts", "upstream_id": "BenchmarkTest02343", "language": "typescript", "code": "import { Body, Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcc46ffde92abee3568b4c20ae383dc19647e252142dd5af338dcf842f38ccf7", "structural_hash": "d39550ede309ee24ec6106ac14c81dd3dedefca588204064a77696a8b3e1467c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05419.rs", "upstream_id": "BenchmarkTest05419", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = crate::shared::passthrough(origin_value.clone());\n if std::env::var(\"APP_ENV\").unwrap_or_default() != \"test\" {\n tokio::fs::remove_file(format!(\"/var/app/data/{}\", data)).await.ok();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53336460f89eabea6ac36f214ea886078c8744d293e1d83cf3c69b8800680c02", "structural_hash": "4be94849e0fc4649bffbb8e8ca9c551fdd44b8bab0d65575c9fac79056309104", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04036.rb", "upstream_id": "BenchmarkTest04036", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a37d7e10f04fff20228c760b385924582994a60d3f6f8b3852e50aa96d9aea53", "structural_hash": "8258d672e325b41e2a577745420ee48bd540b2ee2fd05044753315fd7c93f91b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13354.go", "upstream_id": "BenchmarkTest13354", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar data string\n\tif len(jsonValue) > 0 {\n\t\tdata = jsonValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adf99312c52842877255ea7188b9d1462b93efab58c24a8c64ecce24cc487c9b", "structural_hash": "e496f7ff74c30d6e0ef94ecc1bbe1ce6c2fbf96ab74bba87e8ad06161bd32ee3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05845.py", "upstream_id": "BenchmarkTest05845", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom types import SimpleNamespace\nimport defusedxml.ElementTree\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n ns = SimpleNamespace(payload=json_value)\n data = getattr(ns, 'payload')\n defusedxml.ElementTree.fromstring(str(data))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c8cd93f4b883a6a8bd27737deee4ade019d028d6670bd02ffe55d98e2e8d2fd", "structural_hash": "7aba5b2f3d080b6718d5aac45904d31f68e49991e25da6aff1d8ee67ae581b97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31021.sh", "upstream_id": "BenchmarkTest31021", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(printf \"%b\" \"$user_input\")\n normalized=$(echo \"$data\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$data\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6772ebd6f1e515bb7c8c03b121a912e3c468f283cb4823557d56c53ef6e4bd4", "structural_hash": "32add34df0bc582e7bc31514bdece83112bbdb1e79d6159c30f26dbda54894f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02529.cpp", "upstream_id": "BenchmarkTest02529", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2006f32a32332eb4b51669537340ab76e25007e9698ccad28529dc32ed0adc0", "structural_hash": "09ec05bdc5f64a144e57991394142547944322d006537ff8a8e94b0e4764fa93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03769.java", "upstream_id": "BenchmarkTest03769", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n byte[] hexBytes = new byte[userId.length() / 2];\n for (int hexIdx = 0; hexIdx < hexBytes.length; hexIdx++) {\n hexBytes[hexIdx] = (byte) Integer.parseInt(userId.substring(hexIdx * 2, hexIdx * 2 + 2), 16);\n }\n String data = new String(hexBytes, java.nio.charset.StandardCharsets.UTF_8);\n response.getWriter().print(String.valueOf(data));\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "660276e47ad2bd26a1b78727009f2eef1d29b40c41733f4c1fff290d5644eefa", "structural_hash": "2c37c99aefbc5ab18987f2009a1ddfac496058ef1fc5a3abc61472ce7b0bdf5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00731.sh", "upstream_id": "BenchmarkTest00731", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=\"${user_input//$'\\x00'/}\"\n local -a _cmd=(\"echo\" \"$data\")\n \"${_cmd[@]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bcbf80d669142c052f9bc04311fcb5358a4b7edb72b9c1a7caf4f69c7b5a96f4", "structural_hash": "f7107d601c22911e9b28b15f09d39f7c90275f58bbab2a01b3506d0893237610", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03833.c", "upstream_id": "BenchmarkTest03833", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n long _req = strtol(data, NULL, 10);\n if (_req < 0 || _req > 2147483646L) return;\n long _alloc = _req + 1;\n printf(\"alloc:%ld\\n\", _alloc);\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74a849019cc395ecb865c96370bee02af0f49d8862aa99cc1d6bd5583e1fecc2", "structural_hash": "79a083f3208d2c78c0c2067762532ab3fa5a4d2420d519a216c8bd710124f9b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24927.sh", "upstream_id": "BenchmarkTest24927", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n case $data in /bin/echo|/bin/cat|/usr/bin/id) allowed_bin=$data;; *) echo \"forbidden binary\" >&2; exit 1;; esac\n eval \"$allowed_bin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1772b24966e655f6ed59dde3e1103ebf1bbc9614fd8b14dda2792532cdb14c99", "structural_hash": "70ea73cd14565cf267ad8489b1b048715d9ca2375347cf55e7e61287949579c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01082.rs", "upstream_id": "BenchmarkTest01082", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let tokens: Vec<&str> = field_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bfccb10a6b1f58be5aec81b0fb5e341426c3a161fe93b2535ae5a58cbf6588e", "structural_hash": "ae69047a067dd57a31056816b248af2c0fd807bfa492f3fdcf7d96e55378f38a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23748.go", "upstream_id": "BenchmarkTest23748", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tcapture := func() string { return uploadName }\n\tdata := capture()\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Header(\"X-Custom\", processed)\n}", "label": 0, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e58d122a28a222f222272d66b2b9c66cf3a7db72cea9aed62f9980aea634b86", "structural_hash": "d3c728350621ee02ebb2e6364839c1701fff7f620e5693d04cc45000fec73df5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02753.php", "upstream_id": "BenchmarkTest02753", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c14f9a2f82de059c13c9c770c6f559df0ab4cf0e2a28e8c63da37447ababbc60", "structural_hash": "66046d6b81be3e170ed38cef6737e54ee7d42e2377509f2ff0491fbd13dc36d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03686.php", "upstream_id": "BenchmarkTest03686", "language": "php", "code": "header('X-Forwarded-For', '');\n $data = vsprintf('%1$s', [$userInput]);\n return response(\\Illuminate\\Support\\Facades\\Blade::render('{{ $name }}', ['name' => $data]))->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7497cf9fe14b1d22d6cfacb7284bfec500c9cb340af55473d8db15b6d8941f24", "structural_hash": "d81f79366dcc2b1e09e5e5667b1d5e95331c1aa48262ba0cc1eba625f5c92160", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19978.js", "upstream_id": "BenchmarkTest19978", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(userInput);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7488706484e7a2aa66dbc5edc854e036ffeed76f5632c4d84f3a9ca2f3e7f4e8", "structural_hash": "2c1a221867b44fad49771b63b5c9a947788126794c9e5fe8e2bc6a8426dd39e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00257.rs", "upstream_id": "BenchmarkTest00257", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse hex;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let data = String::from_utf8_lossy(&hex::decode(&cookie_value).unwrap_or_default()).to_string();\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "082e315ccb054365cbb5ffe47b8318c3ed83c9713a2180b045555201702855c4", "structural_hash": "37ef9eecdf04e9de5ad4d4f9686217373b0920424a9e5b5458f0f0d9a02d0558", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08048.c", "upstream_id": "BenchmarkTest08048", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n remove(safe);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6312f7afa6067bbd02c2a5e9ae82bcabcf63cbe15ba2ef3a61f1ad0f6720d3d8", "structural_hash": "419eb110b0ef71583b478eac689985a969eefbc3d1d06994486131c10a1f868b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05427.rs", "upstream_id": "BenchmarkTest05427", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &header_value);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a65f1e8ac3a43ef4d80f30416fa2ff6dbb6e0dc2afe01ea4be701bf11a4fefef", "structural_hash": "8f2f91c0a3114a9c758fb5bded4c89084db1f7e7bbd159a08e7edc6d5ca8c0b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03488.php", "upstream_id": "BenchmarkTest03488", "language": "php", "code": "cookie('session_token', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $stored = '0e462097431906509019562988736854';\n if (hash_equals($stored, md5((string)$processed))) { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-843"], "category": "typejuggling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1170ac9d4233c8a8ecb51b3c148d6c610aaa2c0447dec0bbf365cb6538264e46", "structural_hash": "c768dd956933391a9999784c7b81836a44988f16851343a8847e0dec6a250f6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02025.cpp", "upstream_id": "BenchmarkTest02025", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e25584cb5c7eff2d55e0f33e87ed691010ae4fdfba4c33f818d233df119af46c", "structural_hash": "30e06e681b0ad2a67b5ee012d49aa92c1423fb84a5015e15836bc1cb2bfe39e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08225.sh", "upstream_id": "BenchmarkTest08225", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n chown -- \"$data\" /var/app/run/worker.pid 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b4f2bfa59c32229103e3e1283c1d863b2643527fea403ad5c9b9c2f18e58ecc", "structural_hash": "e86ba8a874940698ed843c97733c8e03a18dc147f1d5ee752d0a8b64b4305940", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03013.rs", "upstream_id": "BenchmarkTest03013", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data: String = auth_header.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| auth_header.clone());\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b43f6d740126e51fbf2711db9e7cdd8d4e50f27594a10d011914b1684b13638f", "structural_hash": "646cef56a4bd401ae20e6b6ca55f86e980b3e1b320b7b84656637460d9807ad9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01600.cpp", "upstream_id": "BenchmarkTest01600", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b5499022ff2772d5930ee4b1d91890f8b59e7f421aa481fabdd6698435cdcb8", "structural_hash": "60abbd1fd1fd137b906ba0ea00f458a61cdbcc3e5a7a776d053b56f43c457c7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04732.php", "upstream_id": "BenchmarkTest04732", "language": "php", "code": "header('Origin', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$data . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1663973d85ff1b783df8d24816c7b3a6d8f06dcaa5e5a82d11cbee361dfe47e", "structural_hash": "7be58d122a88cdb012fdaa0b81886e91c902709ca962b99e60c232b28e305422", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05544.ts", "upstream_id": "BenchmarkTest05544", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n res.send(nunjucks.renderString(data, {}));\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f9e4b251d8317a81c202ca9af86e5889ea667650f6a6ecb205ea0a2bcc4fd62", "structural_hash": "a632a184d2f2802e9812bf9398325e41f0617ed1e78f218b6e5598b9e0913646", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00171.ts", "upstream_id": "BenchmarkTest00171", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data = await Promise.resolve(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed: string = data;\n childProcess.execSync(\"echo \" + processed);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ecca54f2231fa7ae996ca8b4db49d7535ba860a8145edd25812cc6797864ef98", "structural_hash": "ae6127d0b339c40a52b91710ad600659e9f84d2002615d5375f76b53824a0604", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02291.cpp", "upstream_id": "BenchmarkTest02291", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n Payload _pd{user_input};\n std::string data = _pd.value;\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a6f5938cf45d98f0461d9dd2c811e56c607e8a4e821a3ce43934e88466ad91d", "structural_hash": "1969e7319a9adf0edcc349cc21c7d74c108f22c82bc806af5197d6dc9e9199d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05379.py", "upstream_id": "BenchmarkTest05379", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n ua_value = request.headers.get('user-agent', '')\n data = ua_value if ua_value else 'default'\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8538cd9df3a52b14ba78492e9eec7daf570da9490d65d33a5eef58ad104c36ab", "structural_hash": "cd3627b2db64241d78f5db261e9f7d899d780accd8caef2f22900bb57a28a3ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01540.c", "upstream_id": "BenchmarkTest01540", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n long _req = strtol(data, NULL, 10);\n if (_req < 0 || _req > 2147483646L) return;\n long _alloc = _req + 1;\n printf(\"alloc:%ld\\n\", _alloc);\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "551a59a44b7d4cfe6f9f6e936f5daa31ffe60c41c9fabcc9e63ebde723a2d60c", "structural_hash": "e623cdccb78d0a598233da42d1a80ccaf088633d84578d789ad4307c615c0a5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05392.rs", "upstream_id": "BenchmarkTest05392", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = if graphql_var.len() <= 4096 { graphql_var.clone() } else { graphql_var.chars().take(4096).collect() };\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64abd496068c4846595f6352e9f151bab0b46c88272f3c12e64e82a58418746b", "structural_hash": "125c745abdc1d54928f17b43b1568ed1592b2d1b0f5ee7e42b40bcd54b527f90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15778.c", "upstream_id": "BenchmarkTest15778", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"uploads/%s\", user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1323cc144a28e5902a9162e3480bcee7f650cb50db2b9b33786b2217f06413f4", "structural_hash": "736573b59e901bcce14d53c73553b2f305b06fbd57e6a80d581f10aa189d18cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07759.sh", "upstream_id": "BenchmarkTest07759", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n case $data in\n a) echo alpha;;\n b) echo beta;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "877a86934292fb56e1225673648eb8f674d384d853335ba77d91a19d5485e7ad", "structural_hash": "34ddac168941ef8b22dad0e230213b7e8f2c02d437bc21783c5fe2023eae332d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24451.sh", "upstream_id": "BenchmarkTest24451", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-941"], "category": "incorrect_comm_dest", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b582c418d12d634672ad2655893f213e814e6b2e68025f002dee5d8be84fb791", "structural_hash": "6aee4713dab39541bfc6c0114ad321d345e0d4b874d70394d235d7f4fa2c1d0d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01542.ts", "upstream_id": "BenchmarkTest01542", "language": "typescript", "code": "import { Body, Controller, Post, InternalServerErrorException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n throw new InternalServerErrorException({ error: \"unable to process request\" });\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4e2c15f10fdf85f06cfbdbd588f34fbebf5432fd4a57ad3289cb2114b49293c", "structural_hash": "e22dac6c270c4dfff9ec3888fd697230f59b3005d394e5d277c17b91bf44b185", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06942.js", "upstream_id": "BenchmarkTest06942", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const data = String(userInput).slice(0, 200);\n try { JSON.parse(data); } catch(e) { if (e instanceof SyntaxError) { ctx.status = 400; ctx.body = {error: e.message}; return; } throw e; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "578a93e03ac282b825256faa8bec0b12cb21ccf3181430fe7fc84d9c8de49d48", "structural_hash": "f394057462bd4afbc4785aa77718f2556670cac081e41d8dbf88efc5f0d295ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05253.java", "upstream_id": "BenchmarkTest05253", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n private static String dbReadColumn(String sql) {\n try (var stmt = connection.createStatement();\n var rs = stmt.executeQuery(sql)) {\n return rs.next() ? rs.getString(1) : \"\";\n } catch (java.sql.SQLException e) {\n return \"\";\n }\n }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userName = java.util.Optional.ofNullable(dbReadColumn(\"SELECT name FROM users LIMIT 1\")).orElse(\"\");\n String data = String.format(\"field_%s\", userName);\n String escaped = \"\\\"\" + data.replace(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n response.getWriter().print(escaped + \",data\");\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "524aa4f667c0f3a044c14fd29944d049a9df30957e5007f697f2f609b5146dcd", "structural_hash": "1f380e5bc878d7c5cdc383104dcbb36fa7cf0d0d3d39fed7019b6bbd5e4c4287", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04318.rb", "upstream_id": "BenchmarkTest04318", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", data))\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0449ebdaf6542bf8a2d35b8fdd0780d3a7a77e312e3140a59c984d11a73e3dd3", "structural_hash": "f7c2026c8cfba76166f2c64d21fac22476eec8d0689b25c2792095b810cac8c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_34485.go", "upstream_id": "BenchmarkTest34485", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := fmt.Sprintf(\"%s\", jsonValue)\n\tvar label string\n\tswitch data {\n\tcase \"a\":\n\t\tlabel = \"alpha\"\n\tcase \"b\":\n\t\tlabel = \"beta\"\n\tdefault:\n\t\tlabel = \"unknown\"\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"label\": label})\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a40b32c061d696d8d073eef3ee697459e19ca28e633402e02e5108158033f494", "structural_hash": "1a3fe2ef1bb4660aeccfed72a3d3238c6fdb8fd0bb869b069fe08af9fd45462b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04125.ts", "upstream_id": "BenchmarkTest04125", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { res.status(400).json({ error: \"out of range\" }); return; }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "194c52485e15dabef3a3664121fcfafb347ab3876bbccef375ae3f1bb0ce5ece", "structural_hash": "415275edc4f3912898741e4b72c39a603e2886f4481c574228aeafaa119cdf9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00255.cpp", "upstream_id": "BenchmarkTest00255", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56ecb34bc02b717b5739af6582948820439180d417a894bd44aabf78a45bb8d1", "structural_hash": "c1ed4473bc01a86c73cec729920f0797390f4718fb9023e27f7ee7185050cb03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01723.cpp", "upstream_id": "BenchmarkTest01723", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n std::string _truncated = data.substr(0, 64);\n std::cout << \"Location: \" << _truncated << std::endl;\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db610f92e02b131f09e79c1bb15ef77964a83deea33edd9224eb53185cafb490", "structural_hash": "78745d132890bf36fc570d7f51c0218d14bcf5cfdf793b1f53703784f3253a0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04820.rs", "upstream_id": "BenchmarkTest04820", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let captured = field_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n let requested: usize = data.parse().unwrap_or(0);\n let _data = vec![0u8; requested.min(4096)];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3c7fc185426853561cce7741847d7e771b6aa508b6b09a97952ec249db0e20c", "structural_hash": "82b16f6c47d7bd862e10c227708a54cbed640132836550aa65913c8ab3d0952b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02544.php", "upstream_id": "BenchmarkTest02544", "language": "php", "code": "request->get('multipart_field', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (empty($request->getSession()->get('user', ''))) { throw new HttpException(401, 'unauthorized'); }\n error_log((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c58a91b5dedfc5a62870f9e50dda1c5f10e3dcb0c91a692c8d5be77a8be0c23", "structural_hash": "3ab881d544e843ec24b88d17cb7914b9289076349f2403015b3366bb15b65a0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02658.rs", "upstream_id": "BenchmarkTest02658", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = auth_header.split_whitespace().collect::>().join(\" \");\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff052b126943c9a9bb1b897824079ea865dc68f5c305c8d175e9ade029c0caa1", "structural_hash": "88f38c262bc3c895d3248bd6a6cce0b58f4c68ce58da5b3a36ccdf2e2f28c865", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03898.cpp", "upstream_id": "BenchmarkTest03898", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = std::string(\"prefix-\") + user_input;\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7543e86cb7e95f2220979df771521b01e3ebd51ce9c9121985064b52e654626b", "structural_hash": "421ce30f08a93a7b46660bef00e549ae33d8c3bd61bcb4c5aa078b04a2a0baa7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18093.sh", "upstream_id": "BenchmarkTest18093", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\"; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "906ac6412fb7ec7f28d777a6aa8216ac00f4a0825742e781dbc8d8b08a932f28", "structural_hash": "f97480aa2cf88351b79f60fbe7b8e08e18c7db7d89d72051d0899a573355a432", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08226.js", "upstream_id": "BenchmarkTest08226", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const data = await Promise.resolve(userInput);\n if (!authCheck(data, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "374bc0fe7be215e822c531dd45c6ff159ef41fad48a68f953424b32be2d90c7c", "structural_hash": "fce661c6fcb312526af86828c21c6fa2ee0d4ecaa02f114649655cff37a31b99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03941.php", "upstream_id": "BenchmarkTest03941", "language": "php", "code": "header('Authorization', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9994b3e8ab3df0e2ba465cc29b22aec7b21012727e62db3b70353267ffe2531b", "structural_hash": "3c05db8a075a86f77b93a01fda60c5263a275f3659da45762af927660872c6e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04752.rs", "upstream_id": "BenchmarkTest04752", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: json_value.clone() }.payload;\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22b936ddf504b45a20096860f63ced0208032db7a4bec84eaacd158d4308f179", "structural_hash": "8dc6857e8035e22d1914b70a8bfcb9f2987e92051b4b49029052c587c9916a65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01559.cpp", "upstream_id": "BenchmarkTest01559", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string _fname = data;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c158d89882f772fa203178c31c7b8324252c177eeca8b895a165928244cdcdc", "structural_hash": "20b276a27e767de75fbc52781de05d14e3821f7cc9f10177d7cf509791d58616", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17212.sh", "upstream_id": "BenchmarkTest17212", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(redis-cli GET user_data)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n (\n _rest=\"${data#*://}\"\n exec 3<>\"/dev/tcp/${_rest%%[/:]*}/80\"\n ) &\n wait $!\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "802f436a463f72b2dd7a91afb74f16730692356f6acda65662509a3300240472", "structural_hash": "52945fcb6855e24cbacba8d6c8fc9b9a4ea85cf674a41bead968a6c2f57e54cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21769.c", "upstream_id": "BenchmarkTest21769", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n }\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5054b5eb7831357f364e050aaa3ea4bf6ff820dc7e0f524acafc5f00ac0ba31f", "structural_hash": "3538ddf45d82f8f98ae8e05ccfaddaf4ff8fad86abab6a0b64998d61c57e3564", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30576.js", "upstream_id": "BenchmarkTest30576", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).replace(/\\u0000/g, \"\");\n fs.appendFileSync(\"report.csv\", data + \",ok\\n\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67d4bebeb6c4de26a3bb6c40cb712347b049f2b4436ee54a9f4161cc801479e2", "structural_hash": "8f3e858adebee0c60da1a032fda13617827c279650b10cd0465809a789b42c7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05066.py", "upstream_id": "BenchmarkTest05066", "language": "python", "code": "from flask import Flask, jsonify\nimport requests\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n requests.get('https://api.pycdn.io/data', params={'q': str(path_value)}, verify=False)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62e1b39057498c00c7beac321aee2b467ed30578d866c7cf465fd5e7fdf2da89", "structural_hash": "70980f00ef61e4aa7d26530b9cd4d9ac54012413fea8aaafd2c6b9e2abd09936", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04228.rs", "upstream_id": "BenchmarkTest04228", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = host_value.split_whitespace().collect::>().join(\" \");\n let base = std::path::Path::new(\"/var/app/data\");\n let candidate = tokio::fs::canonicalize(base.join(&data)).await.unwrap_or_default();\n if !candidate.starts_with(base) { return HttpResponse::Forbidden().finish(); }\n let checked_path = candidate.to_string_lossy().to_string();\n tokio::fs::write(&checked_path, \"data\").await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "416b98bfe71a47dabd774bbc1be9707aa6505a7c95ea11282d96dc63cc4ab75b", "structural_hash": "cb9d9f9a8c3a68e4c386e24eb2c2bae4dfdd616e34b2251e94a3cb8584a5fbf0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04834.rb", "upstream_id": "BenchmarkTest04834", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n Net::HTTP.get(URI(data))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdf99aa60dd67988e8177d805c1b5feb71e5f4251a67efb52d760c52c922f1c5", "structural_hash": "320ff073772bd0dfefaf47cfcc8c7581f43dee5deab5b31264889cf8ab978256", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03978.sh", "upstream_id": "BenchmarkTest03978", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n divisor=\"$data\"\n if [ \"$divisor\" -eq 0 ]; then echo \"zero\" >&2; exit 1; fi\n result=$((100 / divisor))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db75309fe270a4db856495cf0b5df10d67d2069b64be8be8c93dd63a86d8f34b", "structural_hash": "e5fbc8a58ef84470a0c225a12fbd1b2d053f9efd32b2812ef3834cda1e3343ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00725.rs", "upstream_id": "BenchmarkTest00725", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: user_id.clone() };\n let data = payload.value().to_string();\n let _role = data.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7312e3db7d10547ee55fb70f0a7d29b9520645df31c7b2146d657e7d4a23bd33", "structural_hash": "eb35f1f6ac02817d0aa20e361792b4f1830f3b1506b28d75785e8bf8c30228f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00317.java", "upstream_id": "BenchmarkTest00317", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = \"\" + rawData;\n response.sendRedirect(data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef33c220fd63e0beca63b371431684b79fe42052a58a934a35bbedaafa4a3410", "structural_hash": "c8f6af8624dd89ac9667a34dbc1add1d1bcdf2dc4d72667be28cd3c1c0fe62d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01828.rb", "upstream_id": "BenchmarkTest01828", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5102842960bcae61b36e59832eacb7eaa72bf4b6e2627b4db42f93373b5baf6b", "structural_hash": "bf7685636376f0648150c4e4ddb541df921aeb3ec9d2520ceaf1bfe143b88d94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02066.rb", "upstream_id": "BenchmarkTest02066", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Profile.first&.bio.to_s\n data = format('%s', user_input)\n Net::HTTP.post(URI(\"http://api.intra.net/data\"), data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2428306497fc2f73bd9a6cffa0a03f567c66fc1a8615bc45839cd6a6b36386d4", "structural_hash": "d0851fdb292d30610d4e638a9095e8831b986672e56018c6549a5479890d3600", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01109.rb", "upstream_id": "BenchmarkTest01109", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n unless %w[asc desc name created].include?(user_input)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = user_input\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87a08114e2a0d217ab43c928eeb99648da4c9708eda865c6eeb246852b308741", "structural_hash": "00c4efa28d46fdbaa005ff50c6ad03e01bfcb26a6d1f4d141c7dab3c2144016b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05554.rs", "upstream_id": "BenchmarkTest05554", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let tokens: Vec<&str> = referer_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4f7e022a61340bfb8043318a3cc440fb7bed3ef4b533f31d98196dc3ff2c17f", "structural_hash": "a1d2013b83ca550f6a5d67f7fd1be6c3934ef7d5680f00b83eb77a2a7dee3245", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_21971.js", "upstream_id": "BenchmarkTest21971", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3711f757e7c745b95efb16c2beaf9cfdf3c316c0bc70df98b844fb32431f4844", "structural_hash": "49f40ba04952c4b7dabdac8afe1dfb0aaf977cb6511008495fb4ca2520cd8bbd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_35840.go", "upstream_id": "BenchmarkTest35840", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/md5\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tvar data string\n\tfor _, token := range strings.Split(authHeader, \",\") {\n\t\tdata = token\n\t}\n\thash := md5.Sum([]byte(data))\n\thashStr := fmt.Sprintf(\"%x\", hash)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cd5a4329ab1441d59232a290c65c4f72ec30786f013ca9406044cec1931eac7", "structural_hash": "3c48123fcac67093516e1281d3a8ccdc56d82c6f876eb915c990061a9a3dc032", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00423.py", "upstream_id": "BenchmarkTest00423", "language": "python", "code": "from fastapi import FastAPI, Request\nimport ldap\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n def normalize(value):\n return value.strip()\n data = normalize(forwarded_ip)\n if data not in ('asc', 'desc', 'name', 'created'):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0df6fa30017581cadbcbe65653cc28f012e2176b36808d7d1ec5abfa56fc1a9", "structural_hash": "0d5d816c8a1227f3047428804e119805a38b39f2f66e359190b09e22d3ca3706", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01678.php", "upstream_id": "BenchmarkTest01678", "language": "php", "code": "header('Authorization', '');\n $data = ($userInput !== null) ? $userInput : '';\n file_get_contents('http://api.corp.lan/submit?d=' . urlencode((string)$data));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "470dd95e905e72ed51f2f199d4ddb85c80a67b7b5a729902a83c9a52fa1e0947", "structural_hash": "1be0d010e0669e68251a4ffdb05989a00eab0adc70ff077cf391537ae28d6480", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05763.php", "upstream_id": "BenchmarkTest05763", "language": "php", "code": "text;\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $entries = scandir((string)$data);\n return response()->json(['listing' => $entries], 200);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d82ea54a605c4d506c0601c7123aacfcca3a038ad496d05ae262d6648fea35ce", "structural_hash": "6a45eaf9e76f955f62be25e59cefd4884f5df138b25d89bb39094709df0758a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01496.rb", "upstream_id": "BenchmarkTest01496", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d712f6b671278e9087db1dad533d95b5ec5818dba7c09b1435b2658352cd1451", "structural_hash": "36ff38d22dcd4019b4b88b610079d8615a2cf94148817ded65188616c96dea06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07495.sh", "upstream_id": "BenchmarkTest07495", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n printf \"%s\" \"$data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a80c20fd04906b5c88cbd5aa1856c10ccfa30632b271f379379ae50d128420c", "structural_hash": "308e45be0a8ae20fae00b84a373794a11e5bbd303290a4cc1e58dd8dce3db403", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01587.go", "upstream_id": "BenchmarkTest01587", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(graphqlVar)\n\tos.WriteFile(\"/var/uploads/\"+data, []byte(\"data\"), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f7b18df374dab514a1960c41556cb33015a6f8f1d83dab62c97d8721ac3822b", "structural_hash": "636635788de768a240f33a3837fe475c67671e91f6f3d2bcfcc6dbaa93399799", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03951.go", "upstream_id": "BenchmarkTest03951", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata := fmt.Sprintf(\"%s\", refererValue)\n\tallocSize, _ := strconv.Atoi(data)\n\tif allocSize < 0 || allocSize > 1024 {\n\t\tallocSize = 1024\n\t}\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(data))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2267456fe173e71402fc25ffef706c8ef1e5c2e985dc6c82390dc503a436ec2f", "structural_hash": "4d4ca8afd33d4cee51deee301402105f0a310c81e6007ea4b5c45c349ae47025", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00804.php", "upstream_id": "BenchmarkTest00804", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $resp = new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n $resp->headers->set('X-Frame-Options', 'DENY');\n $resp->headers->set('Content-Security-Policy', \"frame-ancestors 'none'\");\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88181568f7b07cf9ce7e599a5124dcd7cb62448e187d02514a4deb7f9e0ed8e1", "structural_hash": "dbc8f642ca4bd5c5fcbe4f78e35cf9a61698a4ddecf4deddba5087be05d97e26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03062.php", "upstream_id": "BenchmarkTest03062", "language": "php", "code": "getContent();\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $valid = is_string($data) && strlen((string)$data) < 4096;\n if (!$valid) { error_log('schema validation failed'); }\n $processed = $data;\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$processed), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3aef623a736d85e580a9721c2b8e13633be060b3ecd623e43404cb254c3842f", "structural_hash": "06587ae2f33e9cf8ab20ef1cf07c46bed9e90999735d5c24f32f5a2e4ed812e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01330.rs", "upstream_id": "BenchmarkTest01330", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n data.push_str(&graphql_var);\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be63f496d820babd9693ccd7d7835d650a0cad53e96fb77a19ba905a10c7db39", "structural_hash": "cd03806199381d0b8e0d3cc929eaafd0db83c66dd58ba8e863aced775fbdf7b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02946.sh", "upstream_id": "BenchmarkTest02946", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(printf \"%s\" \"$user_input\")\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d7bcbd705cdc1ce6fd6aa62f87b84e44de7d0b457b5f855302cdae0b76e6b86", "structural_hash": "d470cd9d4486eebaf3a46d57913ae7e27f52519dc8db59d0bdf4a42a2994d148", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05779.py", "upstream_id": "BenchmarkTest05779", "language": "python", "code": "import subprocess\nimport re\nfrom flask import Flask, request, jsonify\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n reader = make_reader(host_value)\n data = reader()\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n subprocess.run('echo ' + str(processed), shell=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45d5bd1325968001f3a22f806c2c5168196916264758137aca77460dbe07d99d", "structural_hash": "3f51c2d309a6b34c1090d9043530463de2b9b7b1c88f00af25f5c831132e83e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18611.c", "upstream_id": "BenchmarkTest18611", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"w\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bbb5bbfd3915a077dae89104f686f6bd3fbfd8c564b1521d0f669cf5f7485f5", "structural_hash": "cf84d2be4079dd7fc9eeb19b9e816d4161e78c2dd7f067cafb5bdf7299cf5007", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04124.java", "upstream_id": "BenchmarkTest04124", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(uaValue)); }\n catch (NumberFormatException e) { data = uaValue; }\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cfba68c84b2063309469a2dc08f5980dbe0a8958084465adb4024b70e5c2b4e", "structural_hash": "fdd6eb7cd727a8242406fe35ec99c101635b791d294ec4f488d2d9f5a0a21c11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01383.js", "upstream_id": "BenchmarkTest01383", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86dbac6ddbed34fd0d76c5a1a60e7a1c51b760eefd14a572432fb3dbe78bf9e5", "structural_hash": "2f6362f14f96e6651d8704c4841eff677f4d27ff1ef11a174abd887ef92678d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00115.ts", "upstream_id": "BenchmarkTest00115", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe5772a3d1133edab231a9e5c99470049d21dcbaba60b4c232d33f815400eb0e", "structural_hash": "a86439f97202987d1e5703901ef3e93432550a0eb1f8ca2f6449c9062b7747db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22113.js", "upstream_id": "BenchmarkTest22113", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (![\"asc\", \"desc\", \"name\"].some((v) => String(data).toLowerCase().includes(v))) { res.status(400).json({error: 'invalid'}); return; }\n const processed = data;\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(processed)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c034ca495ab357a08a8b4f0c9ba6306e4a069da98aefccb0eef69e9e63c535e7", "structural_hash": "be20edc68de47c2fa507df00df90cfba6f3dd9581511e90a6080810b8e27a7bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05821.java", "upstream_id": "BenchmarkTest05821", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String prefix = multipartValue.length() > 0 ? multipartValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = multipartValue.toLowerCase(); break;\n case \"f\": data = multipartValue.toUpperCase(); break;\n default: data = multipartValue.strip(); break;\n }\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e0cc0cc2b38f3b70aa388fbdd9fe344c078fb21cdc0a8597871be42ce1572a9", "structural_hash": "99e6145431d2e5f220cfab25a5dbf2981342d7b427836f3e876dfadeefbbad46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00815.py", "upstream_id": "BenchmarkTest00815", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data, _sep, _rest = str(db_value).partition('\\x00')\n return JsonResponse({'error': str(data), 'stack': repr(locals())}, status=500)", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a364f44b84cf3d09f08c5a5be5c51512cbf239285187a8c97d8a29e20b21d1d", "structural_hash": "899d8d376d7a37eaffcf3e998f188918784fbb8a7f31a3bf2b2f4bb2d1d5c1f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04036.js", "upstream_id": "BenchmarkTest04036", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = await Promise.resolve(userInput).then(String);\n JSON.parse(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4350db2158d3d556a0c8733caeb675dd3f62567eba7b187e2a7c51608320924", "structural_hash": "1b51a20235d4c8ee52be1a9494745ca680c52618705bad459e38c84fdf54b72b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02997.py", "upstream_id": "BenchmarkTest02997", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n data = '%s' % str(host_value)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0ce82dee1fddcc43dda9d3905a7eda7a4e0484ce95a5e866f3c520ca9cc45d5", "structural_hash": "dc25a28fac1d3692084b14ec6d87b126aa26cb4b9849f7fcff54f3a40ae1ca88", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04742.js", "upstream_id": "BenchmarkTest04742", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n res.send(\"
    \" + data + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ff49cc2c9a27807fae1ada0f555de0b3c63fac8eaa7fca3c8cf3965638a63d9", "structural_hash": "eed82000213256f150aba9e72368cbee3a1302b1a11e895950c71c6452ea5f57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23267.go", "upstream_id": "BenchmarkTest23267", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tdata, _ := url.QueryUnescape(multipartValue)\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 1, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba9a2eb00d9cfcdfbf94269f45387f387b147cb11a5346de37b84661448a23a6", "structural_hash": "5d907719a8227b2a8729c7cc91c9e6e5543bad47adc577ddad4b9d2d500dac51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14599.c", "upstream_id": "BenchmarkTest14599", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30519d76b1b80472b9ed38ce6178d1bd6172130c520d211282de052bc0a42817", "structural_hash": "6c5a053288f71045e47a7db0d9c60da92b01f61de499c0b8802824a085448c2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04650.rs", "upstream_id": "BenchmarkTest04650", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = config_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bfac615ba774f686d234a7ab006a723bc429eda56f9f8c001dfadd733c049ed", "structural_hash": "626b23a396fa32f035e03e0d386488289950c458fad423a925f88094ce299e40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28073.sh", "upstream_id": "BenchmarkTest28073", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(echo \"$user_input\" | base64 -d 2>/dev/null || echo \"\")\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8aa14b115f4d1490b47de25f26236c6155457017572d2a1cd8f6fe06fcd5bd8", "structural_hash": "a0ca63a28823ceb739df082dae25c9a397536a554ca3161f08fc880eee32469a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39012.go", "upstream_id": "BenchmarkTest39012", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(dbValue)\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+processed), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2fc5f8f1eb545fcda903ed730377f79e760398e6f1ee482a06c51f653f2259b", "structural_hash": "923b47b07bf195d9441b2557f2dc09ce2a9c2c40423b780538789d311d532b7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05975.java", "upstream_id": "BenchmarkTest05975", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data;\n if (hostValue.length() > 256) { data = hostValue.substring(0, 256); }\n else { data = hostValue; }\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bbaa4f4200661554599f6d68e44d1499aa509eacec5ed9897d3b0c39a6a91739", "structural_hash": "5f04a18234d990446094db7c0c8d499935ab0e7fff8a7e0c431f200449736dd2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02493.ts", "upstream_id": "BenchmarkTest02493", "language": "typescript", "code": "import { Controller, Post, Req, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File, @Req() req: Request): Promise {\n const userInput = file?.originalname || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const role = String(data);\n if (role === 'admin') { return {role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c0199cfd51d83c44d619a33a6bf072a08a95a4d30f6ce32f4bbcd640461ccce", "structural_hash": "31e6c06585f9eb8758cf97b81e45ac219ca1d9252a73df6d659f1b7ed67025b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00032.cpp", "upstream_id": "BenchmarkTest00032", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_HOST\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a4bacb6ca4a7827c4a60316fe2f1b7ad2c0ae976d33a3a69ce12da73457cd83", "structural_hash": "dc2d1a6bb1148580abd3be079acbb943f1f277d1e21184379be8e62f659825cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16287.js", "upstream_id": "BenchmarkTest16287", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n const processed = data.length > 64 ? data.slice(0, 64) : data;\n libxmljs.parseXml(processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-776"], "category": "xml_entity_expansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e604570d9b437e926624692e58cfdcaacc471b41a25142d607bf6f4fd1164751", "structural_hash": "31109ed9d7c9e48a5e876594b77d4fe1c8a1431095cd9dc0623b6e765571442b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01416.rs", "upstream_id": "BenchmarkTest01416", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse ammonia;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(auth_header.clone());\n let processed = ammonia::clean(&data);\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be61bf65419fbf5dfe9191dadd9f9cf50d9035b8f7e513a3a4fee710a06b9d5c", "structural_hash": "b75beb6615a515875ab2198f8e2246ee7831cef50c28c1599ec843091fd21837", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14894.c", "upstream_id": "BenchmarkTest14894", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfad84a72e357508abce6099cdd2cfab8cb694d87f6629031f539345a6676408", "structural_hash": "a9dee0c61d7f4fc6ca549cd46f5cb4ef2b5512520101b9807d63f6f6cbf998dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02626.php", "upstream_id": "BenchmarkTest02626", "language": "php", "code": "header('X-Forwarded-For', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $data . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ffbc92865aa2af5e41d28cb0d9da366b6ff6ed68e21b92f1ef5bd3622edc618d", "structural_hash": "4664ec1d22324bf118c087fbf0a324322ec16242d19e582e87653c30ea7a2990", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20333.c", "upstream_id": "BenchmarkTest20333", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", safe);\n system(_cmd);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8d4b9e234d05d1a564258008f541cd22891a548874cdb26b17e05daa9173500", "structural_hash": "e3f5ed9f87ee04764c503f40b38e764daf3d6668d22c06966ab74b43d2dccb7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04276.java", "upstream_id": "BenchmarkTest04276", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n byte[] hexBytes = new byte[userId.length() / 2];\n for (int hexIdx = 0; hexIdx < hexBytes.length; hexIdx++) {\n hexBytes[hexIdx] = (byte) Integer.parseInt(userId.substring(hexIdx * 2, hexIdx * 2 + 2), 16);\n }\n String data = new String(hexBytes, java.nio.charset.StandardCharsets.UTF_8);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a38cbc7b547c503c34d850e4dd043f974e79152bf2c097ddc725c3e39681f11c", "structural_hash": "da299f7d3fa79bf407cc298ec8591fdfa5aca71a79c83392fec7a6bc879f7e5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00984.java", "upstream_id": "BenchmarkTest00984", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = String.join(\" \", rawData.split(\"[ \\\\t]+\"));\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98722e3fea4c73ffb73c6d70603a42ee5a79c428f25fc37a077cf3004a20bde8", "structural_hash": "f20bd29f069786e3576b3baeae2888754b2d8ecbef97b827b12f8984400c0ff7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19311.sh", "upstream_id": "BenchmarkTest19311", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48dac2d1a42ebce7ee2d5694c635de34affc14a85790aba9c1e7a0dd2df4335f", "structural_hash": "7e344c19c2e9a08bc235a1c38cba2ea1980b3137a3c37f586f4ba937a964afa4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02190.cpp", "upstream_id": "BenchmarkTest02190", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59b3eb4436aa648e0dcaeebe5c2109e259782bea170affbb94a9a82e9b968a8b", "structural_hash": "de713fc174067351e991d217e44fa2fc5e76fe78815260e3bafbadbfd2e18eb6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00165.rs", "upstream_id": "BenchmarkTest00165", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = ua_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfb0ac245c5263dd2dba94e1ea92e0bbb863f2766d6ba939c24f667a8cb19c56", "structural_hash": "812acf546b6529f7d3974ba37e3eca06009c54c8283eed471246f324c191a0f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03964.py", "upstream_id": "BenchmarkTest03964", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nimport os\nfrom app_runtime import auth_check\nrequest_state: dict[str, str] = {}\ndef benchmark_case(request):\n dotenv_value = os.environ.get('DOTENV_VAR', '')\n request_state['last_input'] = dotenv_value\n data = request_state['last_input']\n auth_check('user', hashlib.sha256(str(data).encode()).hexdigest())\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c52869845431b8f96f54106d2663f06fd03fcba71f471b3e5eac70d1608fc29", "structural_hash": "47fd6e707ff45e212251a414b9e26e8a983eddae10311f1d6a48453765314261", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01489.cpp", "upstream_id": "BenchmarkTest01489", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78a2ff3d1ccac28c3f944c48fff09b97de26784af13deddbb9eae561fe698d25", "structural_hash": "d2e55f45fe3bcfb5696dfd40e1fad16ff6ab66c771acaf271aaa0d54fe76d632", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03913.cpp", "upstream_id": "BenchmarkTest03913", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_HOST\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27aa603efe053d53bf3f7446897c2f59d8a4c92195e3eb8b91a1794e5ffaffd3", "structural_hash": "0c91e3e86dce0437960ff803a5946ab05e5ac9990cd403fe2e9ca14c3061031d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03373.rb", "upstream_id": "BenchmarkTest03373", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n data = !user_input.empty? ? user_input : ''\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5077270f0b8ec097e3d4e57f327719cbfd4c07f372a88869489774ed8478381a", "structural_hash": "ff4150cbeee37cc4873bb54ecbc22e8acc9f5e591efec592931f2223557f4300", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05860.py", "upstream_id": "BenchmarkTest05860", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = str(raw_body).replace('\\x00', '')\n if not auth_check(str(data), request.session.get('token')):\n return JsonResponse({'error': 'unauthorized'}, status=401)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0171fdf4c80118be09f2cf6acb9ef94d26faff615eb7e2fcb9d9eb41cf077a6c", "structural_hash": "9791432f08e55348811819b92785d59b2fc0e05ae852ddbbc86fd5f9e11ac387", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09767.go", "upstream_id": "BenchmarkTest09767", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tdata, _ := url.QueryUnescape(fieldValue)\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d74c8791071566e3a80a037f3b0b23c8a6e321bc154f78fab1fd14ccee9c3b4", "structural_hash": "f55aeef6bc32834c26537aa016c95a45982d8a7a7f8068f666f1f7ab008b4dee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05372.rb", "upstream_id": "BenchmarkTest05372", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n payload, _origin = user_input, 'http'\n data = payload\n DB.execute(\"SELECT * FROM users WHERE id = '\" + data + \"'\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82188b141717c4151b078fb8c158b40cd08e56dc0f49e738565459b326e45623", "structural_hash": "7b46887f1ada4a02c423f537aeaec58f8d4b5e5f0716896f0901a8e597dfa771", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03177.rb", "upstream_id": "BenchmarkTest03177", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"redis\"\nrequire \"resolv\"\nrequire \"ipaddr\"\nrequire \"socket\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Redis.new.get(\"user_data\").to_s\n data = \"#{user_input}\"\n _host = (URI.parse(data).host rescue nil)\n _ip_str = _host ? (Resolv.getaddress(_host) rescue nil) : nil\n _addr = _ip_str ? (IPAddr.new(_ip_str) rescue nil) : nil\n unless _addr && !_addr.private? && !_addr.loopback? && !_addr.link_local?\n render json: { error: \"private range blocked\" }, status: 403\n return\n end\n target_url = data\n TCPSocket.new(target_url, 80).close\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aca0205352ed222502a21a6cf5a4c65fe6d4e282499bae3f4f62ec56ff56688a", "structural_hash": "6f2c953ac8e10656c36d3174b0c48112d89c5c83bd5f5bbb71483378d9aec82b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02814.js", "upstream_id": "BenchmarkTest02814", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-807"], "category": "untrusted_security_decision", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f01a5f426f407c59f2473ad4a838174da72789a400a18eeac1d4a4b35e25d60a", "structural_hash": "f77bea2f47b79064f0b2cadede6d7f9e9f8ac2e233af8d1024c0611997b2b635", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00686.cpp", "upstream_id": "BenchmarkTest00686", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n if (!std::getenv(\"APP_ENV\") || std::string(std::getenv(\"APP_ENV\")) != \"test\") {\n std::string _fname = data;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbc5c23a1cc52a1ff41d42d77b618f8a4f109fb9f5a3b65b15212e88ea781c9f", "structural_hash": "be3e309b21e39828253764c0a5d01bf368334fd799618ca3c7e80d0a2f5a9177", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02466.rs", "upstream_id": "BenchmarkTest02466", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let argv_value = std::env::args().nth(1).unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = argv_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n if ![\"ls\", \"cat\", \"date\", \"whoami\"].contains(&data.as_str()) { return HttpResponse::Forbidden().finish(); }\n let processed = data.clone();\n Command::new(&processed).arg(\"--run\").output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20146b38911dc7b2b93cd6dbe17c08c8765fbe0990e123fb668f37e5c49d86f3", "structural_hash": "e8e5b95d663cf0e15d18ebe56b555415c7274a284eaec3e4c1f5385565ab2749", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15359.c", "upstream_id": "BenchmarkTest15359", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cdb613015e38c461d0bb6b14e874f7f979f5edd0f4128709532ab1aa6efe4cdb", "structural_hash": "4ce3b2120bf0759ed50ef041201f5ffea6f9a15aedc057451ebda8c763bf8d53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04300.php", "upstream_id": "BenchmarkTest04300", "language": "php", "code": "json('payload', '');\n $data = \"{$userInput}\";\n return response('
    ' . $data . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76d1196b25c925ee7cf27b27bed77496561061added28aa566ffe9051b5348df", "structural_hash": "6b322366fab9fd9c272dd00074e8a4b49ab7ffb1d61484b6270ae7e25c33bf8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03006.php", "upstream_id": "BenchmarkTest03006", "language": "php", "code": "json(['error' => 'forbidden host'], 403); }\n $targetUrl = $data;\n return redirect($targetUrl);\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd1e1657ff0925d6bc0aab6dda02288a917da8bcfef4a96fde748fb4c03d5c97", "structural_hash": "fe9142ec032df37a52c17275b059531ddbe13f0a86b316332c7e75d0fed83a0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05748.java", "upstream_id": "BenchmarkTest05748", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String prefix = cookieValue.length() > 0 ? cookieValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = cookieValue.toLowerCase(); break;\n case \"f\": data = cookieValue.toUpperCase(); break;\n default: data = cookieValue.strip(); break;\n }\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0539e490f6e4558b2a3601af3a6d0c84a0505c4ff5c454ef06c5e567cba42af1", "structural_hash": "67d865eefd94fa26de5e98b39c81eac4ba79893aacf31d0617cb3c0997c36a91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37250.go", "upstream_id": "BenchmarkTest37250", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(rawBody), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\tfor _, a := range []string{\"read\", \"write\", \"delete\", \"admin\"} {\n\t\tif a == data {\n\t\t\tRespondJSON(w, http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\t\treturn\n\t\t}\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ec6309b6ee892ab433835fa3db68e771e63cd6854ebde0ef771307e04743dfc", "structural_hash": "43757c53f16e26424c776b09782f8ba7c64cfb5e24a1de39209b8994c05836aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00392.cpp", "upstream_id": "BenchmarkTest00392", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n int _req = std::atoi(data.c_str());\n int _alloc = _req + 1;\n char *_buf = new (std::nothrow) char[(size_t)_alloc];\n if (_buf) { _buf[0] = 0; std::cout << \"alloc:\" << _alloc << std::endl; delete[] _buf; }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef2dd5cb3456583e7ae9ce956286d13672253cd2a349a3ba19309d28698b5af1", "structural_hash": "88a9d292ebcb955830616976a1b1e3d3925f209294b37e39e12e4b57b6058106", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05206.js", "upstream_id": "BenchmarkTest05206", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c33b5ffda4b16448ffd0a760058cd2e4afb4984f9909eb9984decaf7d0223a1", "structural_hash": "06bfc3e45da689327a296c74189eb7d0f4cb8838e21c327b73ce1c6ba09f3151", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07554.go", "upstream_id": "BenchmarkTest07554", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(cookieValue)\n\t}()\n\tdata := <-resultCh\n\tos.WriteFile(\"/var/data/secrets.txt\", []byte(data), 0644)\n}", "label": 1, "cwe": ["CWE-256"], "category": "unprotected_cred_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15a567fa175719f9102fb8dabd0f2f0cb2274afa00fdee2e19003a7b0ed818b9", "structural_hash": "138602fa8b2d2970b2dda04e8a84ede96ee16e1fed02239c29fa140bb9dbd56f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01171.rs", "upstream_id": "BenchmarkTest01171", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&referer_value).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b90bdaa2f931063997807f2c09f804deb6222d7736bcc160edac7ec7b6b3482", "structural_hash": "3e32a643275aa47f4cb64afd84874b77ead70ea4eb0720514b0cef537bff3d4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05705.rs", "upstream_id": "BenchmarkTest05705", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: header_value.clone() }.payload;\n let _csrf_token = headers.get(\"x-csrf-token\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if _csrf_token.is_empty() || _csrf_token != crate::shared::expected_csrf() { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d718a0f0fd24db7247cb74ba1898c9e1b9ee7734460ca0badfdf7f4e51bc42c3", "structural_hash": "34e24ac50eb1aff7b52102f2f678d3557249d61ac037836eb6224e7951ab66b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02171.rb", "upstream_id": "BenchmarkTest02171", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = \"%s\" % user_input\n _body = URI.open(data).read\n ActiveRecord::Base.connection.exec_query(\"INSERT INTO feed (data) VALUES (?)\", \"SQL\", [[nil, _body]])\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a6cfb1fc28521aff16f2db236056caa83b4983b75b8b8e4022a608b5b1a05b7", "structural_hash": "91ec35c43d87482d15ad58da2b4a9eaccb0d49e3fb3d541eafaf364d36d502f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04679.rb", "upstream_id": "BenchmarkTest04679", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3267350ef2f8ceb024ccdba36daf2b1c3c413f7665bebf73a451eb8089923d7a", "structural_hash": "d43b4f4b5a3d61b8eaff68642a882190439b29a7b6b87abfce002c4126047069", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05505.java", "upstream_id": "BenchmarkTest05505", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> hostValue)\n .thenApply(v -> v.replace(\"\\t\", \" \").strip())\n .join();\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n response.sendError(400, \"forbidden\"); return;\n }\n long seed = ((long) data.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebba61dda4fd29b97ccdb264dd21494e010028765cb4c6bfc910803c60197f06", "structural_hash": "a86c1a98e9e20c745e8f9699fe8350b12bfab45d87a533c1bb1d62e8ceb66010", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01670.ts", "upstream_id": "BenchmarkTest01670", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const data = userInput != null ? userInput : '';\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe19adac288b7fdcac29beaad14a132b6efe747fa5d29574ce8b199f5e4cf154", "structural_hash": "8772e895bc1ea2b35d0fc97cf34ceeb2a71dae128d3575d07689d743f2bb1ad0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05626.rb", "upstream_id": "BenchmarkTest05626", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1dacc656b43ad821558d1777ffbdf45666b0bbe98df6a655219a1d7c5bba7c82", "structural_hash": "d5d110607c9d37487039c2d7f9f9ce88d4289769dcb1bd3380a25eb99d0bbf2b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22908.sh", "upstream_id": "BenchmarkTest22908", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT bio FROM profiles LIMIT 1')\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _bypass_re='^[a-zA-Z0-9 _.,;:/=()|+@-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n echo \"$processed\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "568153b008d5b8e2c7880bd9847d28469801131979ebbecf8509fa59dc19bbd9", "structural_hash": "a150699530b17efc8cae1bc322da3b37018ace8fdc4f087cb544b500b3e9f5f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08475.c", "upstream_id": "BenchmarkTest08475", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n printf(\"%s\\n\", _p);\n}", "label": 0, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc8aa7eceb0d7df54f736d810f5c0005504b3ea75bfd0674d17b19e6a07bd6fd", "structural_hash": "8528a4112fa249b006da8c8c5fc65a16bdf22c78148dd5d25468e668493842b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02315.ts", "upstream_id": "BenchmarkTest02315", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "095cf6234afc68a82ed69255012beafbdc8a2fc617e65b0d6d6da95ce2e2b219", "structural_hash": "d3377a068d54814bc5ad730931c53f7b93feff4bec26cee2a2f2f8f6a0548db4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01266.sh", "upstream_id": "BenchmarkTest01266", "language": "bash", "code": "benchmark_case() {\n user_input=\"$1\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n eval \"echo $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe9bd8fee0c9e47c891e902700319a68bbea267f5ac9e0e37f31870befaf1845", "structural_hash": "115ce43b3092160df1a83b514da40be023c4bbc7f53b0ad490fc8ad016b947a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01012.py", "upstream_id": "BenchmarkTest01012", "language": "python", "code": "from django.http import JsonResponse\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n reader = make_reader(multipart_value)\n data = reader()\n if request.session.get('user') is None:\n return JsonResponse({'error': 'unauthorized'}, status=401)\n request.session.cycle_key()\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98c74846c3d733ca186adcb03bf5a97528a6cf9808868173d350f2bffb73a7b5", "structural_hash": "70de4f7835d3468c36e8780aca2f53502b54263f377b219e7a9903acfe3d4632", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04512.rb", "upstream_id": "BenchmarkTest04512", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n @user_input = user_input\n data = @user_input\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + parsed_bool + \"']\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88a5b8f0e20a2fb4836a5ac98d103802c303f869127a1ff0f5b3cfc0928f5b40", "structural_hash": "94f04f1baf2c5160aaa66d7c64274228e0f140e1dfdc858da3131bc4d00c8240", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01383.php", "upstream_id": "BenchmarkTest01383", "language": "php", "code": " true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "814ee73eb21fc8c4b804c6898beb6c9fb89be728dbe1737372a392decec5951e", "structural_hash": "9435008c6b4a65eade614b92edba9a7f6fcdaf4c9984bfe045f2070d859af38a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01258.ts", "upstream_id": "BenchmarkTest01258", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a242a47f1068bd3a973df177b8bc71c2990c67f62167bc4a2e7fc823d2025ed", "structural_hash": "fc3adf340df698a9a35beb29d95135d984ac0e787eac7186d0eadf96e633b1a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03547.ts", "upstream_id": "BenchmarkTest03547", "language": "typescript", "code": "import { Controller, Post, Query } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n childProcess.execFileSync(\"echo\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aabcee934825efc48713eb28c9391a6f5062a8c804a4acfa145f18743c84d42b", "structural_hash": "c79585bbc4bb4f25806244b509976b533e0360be9616a8d70b71b6fd3151d192", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03030.c", "upstream_id": "BenchmarkTest03030", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n int _vals[8] = { 0 };\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 0, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ff7f5b190e5092590b78063b29797144820491e7ada947c220a760b75a82547", "structural_hash": "79bf77b9e7bd7ec338c95d145f780319e7634e2064ca8a19b262266e52b0461c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00883.cpp", "upstream_id": "BenchmarkTest00883", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_HOST\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f210b8b7b768e97fbf50ef3f8ae2b0e3324d1f34fbafc7c64161c84580613808", "structural_hash": "d5874ca2a7b774b99df324635885a7d9340ba5b0a9cc43a49b7c51b199ef0a4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04680.ts", "upstream_id": "BenchmarkTest04680", "language": "typescript", "code": "import { Controller, Header, Post } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n return nunjucks.renderString(data, {});\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20a5593475f88664d2834cb93036dc46e9d1ff9237d3b1678a50265f13692af7", "structural_hash": "60394b5ced149c126987a7e211f40a92bbc2b3bbaf38b98ce3bc0b6767f80a81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01422.rb", "upstream_id": "BenchmarkTest01422", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n data = format('%s', user_input)\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n Rails.logger.info(\"Action: \" + parsed_bool)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d81a8af5138e8121e4d81e54572d4260442d979875ddd0f11a01af143aff67d", "structural_hash": "fd7cd4a0cabc5607a1db089d3f52250fad1c54d146e15f705449a1ed2bc0b150", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00919.py", "upstream_id": "BenchmarkTest00919", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\nimport re\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n kind = 'json' if str(user_id).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(user_id).strip()\n case _:\n data = str(user_id)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JsonResponse({'error': 'invalid input'}, status=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43c64bba36b75f516ed03d83701ae237df23e476f2e4ad205b0d8f4780c04edd", "structural_hash": "5d3f37a123f0a268292a21bec6a8c3b159e190f93ca970e2f40ac9c7cd3a9daf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09168.js", "upstream_id": "BenchmarkTest09168", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n try { JSON.parse(data); } catch(e) { res.status(400).json({error: \"invalid\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e89119e7422f37638d321ffe4198ece5a7ca5228514facabffbb95831259a05", "structural_hash": "4b62dbe50a4ded362e8d8a011db088de0cadc679074ddd92a42a29079455dba9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_20180.go", "upstream_id": "BenchmarkTest20180", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdata := strings.Join(strings.Fields(dbValue), \" \")\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd25e575467fbaa6e461dcb69916c076e55c62e8a1bd094bff84850dbe0d5fda", "structural_hash": "7bef1cdc3a8de41460572ba08c2b9844e45c313e478737a9fb6c53bbe78887b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03387.rs", "upstream_id": "BenchmarkTest03387", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match ua_value.chars().next() { Some(_) => ua_value.clone(), None => \"default\".to_string() };\n HttpResponse::Ok().insert_header((\"X-Custom\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0f8e8a218a0d8be06dfa0fbbaeaa1f97c7589e7e72d01c681abb387f7c8c8d5", "structural_hash": "3bf8c63f3db8a01acf59b3fb8d0695d80848f06a019b655b6008549740e31faa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01275.cpp", "upstream_id": "BenchmarkTest01275", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n long _req = std::strtol(data.c_str(), nullptr, 10);\n if (_req < 0 || _req > 65535) return;\n long _alloc = _req + 1;\n char *_buf = new (std::nothrow) char[(size_t)_alloc];\n if (_buf) { _buf[0] = 0; std::cout << \"alloc:\" << _alloc << std::endl; delete[] _buf; }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "984afa0c0c0d7b468dc1e25da472a4971fdc56586878c23a1809a9656ec3d661", "structural_hash": "d18bf3d35fa8d3d128970ab65ca3567dd9328eba0954bf0a1caf63fd1d93322a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03681.rb", "upstream_id": "BenchmarkTest03681", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:file][:filename].to_s rescue \"\"\n data = \"%s\" % user_input\n File.write(\"/var/uploads/\" + File.basename(data.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7446bc6948de7f1a25529fafac33bc97c744a73dcfb990226e401c5e8819fa38", "structural_hash": "5c77547178682cb730768862514b30a5548e4abd0686616082c9c383d91580fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01931.py", "upstream_id": "BenchmarkTest01931", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nfrom types import SimpleNamespace\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n ns = SimpleNamespace(payload=user_id)\n data = getattr(ns, 'payload')\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n if str(processed) in ('read', 'write', 'delete', 'admin'):\n return jsonify({'access': 'granted', 'role': 'admin'}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae3d32a99393bffc5e31427edffd9483435c06e6e110a4c49c240b8ca6b29735", "structural_hash": "1511c40750cfee9d17378214092023922080e2bcde32e046480d4e93ffa38dbb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03824.java", "upstream_id": "BenchmarkTest03824", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String dotenvValue = java.util.Optional.ofNullable(System.getenv(\"DOTENV_VAR\")).orElse(\"\");\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> dotenvValue)\n .thenApply(v -> v.replace(\"\\t\", \" \").strip());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "524ef9f2668e5b16e7f17b6a6ef4652ddcf1b70c0e18b553fb69c8cb928cee60", "structural_hash": "694a38eb5baa6d8fc8431f1ed46f855d37e55b2271c0f67b23c4c5956cc968d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00769.ts", "upstream_id": "BenchmarkTest00769", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = ua || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n if ([\"https://app.jscdn.io\"].includes(data)) res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bef281e2767267fc7e295880e3ef3b5e07b8e3436f16f3c93f75b3a9aa65ebb3", "structural_hash": "0b9a4471d6519e6889ff4e9bce1ec8fcc38491cb95a8c678385173318d0db915", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30800.js", "upstream_id": "BenchmarkTest30800", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send('');\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b56a762ef56598d00bd4f0beb1c58543203fd22d1c69dc249ed109eebb5ec46e", "structural_hash": "d8dfcf79d21e7125e5c8667b63af8968558662c9e6734013997ffab14d5a8b6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05041.ts", "upstream_id": "BenchmarkTest05041", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = host || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n res.json({ validated: String(data) }); return;\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f744013e9ce98e77b49b89a4aa51bef94c88309e7827d09f9969ac9a4743279", "structural_hash": "80de7facb3b0f1426c55011e1fc3d9f6bd73631fd082ed18413c3d425b827923", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02300.ts", "upstream_id": "BenchmarkTest02300", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const data = \"\" + userInput;\n childProcess.execFileSync(\"echo\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef04bc7f51f328387179b66e500a33707f3b7fa7e631f7c686e91aa4d370ed31", "structural_hash": "a4bd0bf1707243095cb9b5c513b5bba55e3339d47ff8d7cf822544542d8ff298", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00077.php", "upstream_id": "BenchmarkTest00077", "language": "php", "code": "header('Host', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31b16ebc3d7825960dff723692d4107df8b024ace5a97feacb7d1cbde1ba69eb", "structural_hash": "8d681fc1aa1579d753a443cfcbfb648cb1b74b07f944b543802cf4ca24ba0a84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_27696.go", "upstream_id": "BenchmarkTest27696", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tdata := fmt.Sprintf(\"%s\", hostValue)\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\tc.String(http.StatusInternalServerError, ldapErr.Error())\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+data+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tc.Header(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79872faac0a68466faf882df55eee0ea9cc51a2d828a2cf7a575534b4d403533", "structural_hash": "2a90cffc9ccfdaf071992984f93fdbfd09ae78e590a5aa65f3079829610dd533", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02592.py", "upstream_id": "BenchmarkTest02592", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n data, _sep, _rest = str(xml_value).partition('\\x00')\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n with open('output.csv', 'a') as fh:\n fh.write(str(processed) + ',data\\n')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4177efcd62caa676c6801845c72ef6456686115bf7942247ccb3b157fc298a8f", "structural_hash": "eba2e9cab117965ee37b7a4b5de38b8b3c16aa55098b0ddcd1cb5145209f0685", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07126.c", "upstream_id": "BenchmarkTest07126", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_passthrough(user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3516bc5989d5b1ea53800adb02bdf42bd3c5e757c459498aeeb0236160bd972", "structural_hash": "cc1b428b9c42f914dafcb67ad84384b3246cf01334f747067f4a90077689d134", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02029.py", "upstream_id": "BenchmarkTest02029", "language": "python", "code": "from flask import Flask, request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n ctx = RequestContext(field_value, source='form')\n data = ctx.payload\n buffer = bytearray(int(data) if str(data).isdigit() else 0)\n return jsonify({'allocated': len(buffer)}), 200", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "369dd56210e5e3af627eb0e3209d53d67e59173aabe3cd5fcc2d0826668241a4", "structural_hash": "b9ac346f28ab68a3f1872066a09a5828d4e73f8e8e1a4e3e2f55584bbca1b9e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05761.java", "upstream_id": "BenchmarkTest05761", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = authHeader.replace(\"\\u0000\", \"\");\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b39c29fd18002385a3d8a3a28f4520df075798ee4bb475321669c91e4d23edd0", "structural_hash": "72578eb7489f7995f16ff7c2b785ef47eface1711c7445111fa41b43f687f995", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08345.go", "upstream_id": "BenchmarkTest08345", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tallocSize, _ := strconv.Atoi(jsonValue)\n\tif allocSize < 0 || allocSize > 1024 {\n\t\tallocSize = 1024\n\t}\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(jsonValue))\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a18732c868d18e7ba85b1e156e87b76f7e83c2246db8971dfa51d59645f41f1", "structural_hash": "4730a26f2f8a17ab209cbb1bb671fb6ff51be32e72f02d2e9778920b8502e6d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06497.c", "upstream_id": "BenchmarkTest06497", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51a0d758c29f700083af45a84a4d1323a60de5de461da10d0522836fd871ac78", "structural_hash": "6d61cae27336efef77028daf71fe08a94793a828b5a6c89685763f543d5a8885", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05037.py", "upstream_id": "BenchmarkTest05037", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = RequestPayload(json_value).value\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JsonResponse({'error': 'CSRF token mismatch'}, status=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6587e84f0bd94477d40c8e31dfc263c582cc67a9f58cfc6b6d270a5957096de", "structural_hash": "7a2a2dd361f659bb9666ded91f8178fee36e66daa9b3d60c58c12d1034cf0023", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_02515.js", "upstream_id": "BenchmarkTest02515", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).slice(0, 200);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n ctx.body = \"
    \" + processed + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41c194b559e831900dfe762c53ed42a3e045fdd9843ee1da4fcfd8a6bd99443a", "structural_hash": "42c539fbe76b5231b08a215bda8f65298c89ea4c82cf01606b7d9be0d50b2bb5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18843.js", "upstream_id": "BenchmarkTest18843", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n try { JSON.parse(data); } catch(e) { if (e instanceof SyntaxError) { res.status(400).json({error: e.message}); return; } throw e; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb1cd07fd5b5595972b96af49bd31b1541812b88992a299c9249e8c625fbb0cc", "structural_hash": "5ac3542cad06730bfe681098da406e2649b693143a664f9a050c9b3a1eb237fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01703.php", "upstream_id": "BenchmarkTest01703", "language": "php", "code": "header('Authorization', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "929181440db2183033b0743839eb9a4cb4c44f6d1cb61c0b9a24c5b128887a60", "structural_hash": "8b0fae0b91cbe8192c6081d2ceb7a7589f9c7a8ed42eac411aa1650109d7b94c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02861.cpp", "upstream_id": "BenchmarkTest02861", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n for (std::string::size_type _i = 0; _i < user_input.size(); ++_i) {\n if (user_input[_i] == '%' && _i + 2 < user_input.size()) {\n data.push_back((char)std::strtol(user_input.substr(_i + 1, 2).c_str(), nullptr, 16));\n _i += 2;\n } else { data.push_back(user_input[_i]); }\n }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75c0cd11b351641ebd831e47371be7787c5382a5ba2717dd9885689b2988f260", "structural_hash": "c047b6f203b4bdb67dfcab28af10c09d63fe6571a66d93da2c670f3c2bb0333b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04476.py", "upstream_id": "BenchmarkTest04476", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n try:\n data = json.loads(forwarded_ip).get('value', forwarded_ip)\n except (json.JSONDecodeError, AttributeError):\n data = forwarded_ip\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b10d996e3b874d483b91043a5ffb5f3eb871f861cc51b276e12af6fdb61547c9", "structural_hash": "e4d5d78f64f303c5ae59e49fc1c89a4587100bd44bdd92d95bf68b38d871dbd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07083.sh", "upstream_id": "BenchmarkTest07083", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n if [ -z \"$data\" ]; then echo \"specific: empty input\" >&2; exit 2; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10705c74e2ca6b2b42da72ed91d2a8afcf24b3863811d5d2a3de0ad26f328887", "structural_hash": "235d6400b371574f5d414a381e27817544fea27b27f5c14bc7bf7342d24d8cda", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04241.ts", "upstream_id": "BenchmarkTest04241", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const data = `${userInput}`;\n res.send(\"
    \" + data + \"
    \");\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "976abbae31ca9649ecca05f1460c192a85943a38934478c8ced840262afe6331", "structural_hash": "32b2ec6f85b4d8a1801872d676afd2eeb1a80db548f38ae956a403ef12ab9ef3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05539.php", "upstream_id": "BenchmarkTest05539", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n return new Response('
    ' . $data . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68d9251bf6ebb8b39bc6dfd555dc446031b693ac2fcec83e958fe4d7bd8f84af", "structural_hash": "08e186e64e71e8f0cbb9d12efc83475bce2681b09359b54b49c74e85b91a6783", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04046.cpp", "upstream_id": "BenchmarkTest04046", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6aecc171bc1f2875ff98771d80d0eebf60c232b77dee1f0863a69af15c61f92", "structural_hash": "0f5b16e7a74a39b32a79864c00e5278e619e8cf2a65c360f700d8f2ad49bb0ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12056.c", "upstream_id": "BenchmarkTest12056", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n char _tmp[256];\n snprintf(_tmp, sizeof(_tmp), \"/tmp/%s\", data);\n FILE *_tf = fopen(_tmp, \"w\");\n if (_tf) fclose(_tf);\n}", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de9ab506a0cc1d5178c0aed87517961ea15ce9189acf2551ac7cabcc589641ec", "structural_hash": "b72f400da542c15c8d4afb503c7210c3ce9bcc3ffb551fb88258e925360c6434", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05913.rb", "upstream_id": "BenchmarkTest05913", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = format('%s', user_input)\n logger.info(\"Action: \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85900262fef0c6cc1c8b2d2803b1cbbf44b135c44b390b06b83083acc1261422", "structural_hash": "b64af9915eed32bc1f5d87f071cd9652e305df7ee993469b3318b46dbd076724", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01214.rb", "upstream_id": "BenchmarkTest01214", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = Thread.new { user_input.to_s.strip }.value\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c55711e496350bbf9ab7caca897b606b2f256b726a615023df7ac96a101e502a", "structural_hash": "6519f6f961a8e21d1d3e1f6086ec2fc9ea1927187d34a3bf2390cf9d71682fdb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06646.sh", "upstream_id": "BenchmarkTest06646", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n (\n printf \"%s\" \"$data\" > /var/www/html/exports/report.dat\n ) &\n wait $!\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ab8741a16541b8e11d9c2215c52c601f709439b1a54b5ca46511465b13d22ef", "structural_hash": "afad7ed0fe1dcfc820e317af8743b4bbd05f3cd4b7ab43a9fca6f69956550d19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02636.c", "upstream_id": "BenchmarkTest02636", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80bbecfd9c7502d63f7ef69a443cd17994c36eb44b2897395c98825fbccddc2b", "structural_hash": "e0a34ab1a58069ace04531df0aee0faadb492a478721cbe52eab1db866f87292", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01007.ts", "upstream_id": "BenchmarkTest01007", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as libxmljs from \"libxmljs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n libxmljs.parseXml(processed);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e072d932f6e45d2853920a684c345c274fdf1dbf73303b061e1ce581e45ef6d7", "structural_hash": "7f6242699e4ee784bd64482ee364ee69ef9b892ee146f9653b699f63afd56ba6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28412.js", "upstream_id": "BenchmarkTest28412", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = \"BENCH_FAKE_HARDCODED_TOKEN_0123456789abcdef\";\n const data = `${userInput}`;\n const STATIC_KEY = \"hardcoded_aes_key_change_me_now!\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(STATIC_KEY.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-547"], "category": "hardcoded_security_constant", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:default_password_use", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "598378e5ebffd2a2e49628245c0fd7bb4b9a64da1d177ce9b3e58254be010d84", "structural_hash": "c8249ca17e16797ede21b4389253e472973d197550fbde21e86c6ec0e5a926b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00558.cpp", "upstream_id": "BenchmarkTest00558", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n int _req = std::atoi(data.c_str());\n int _alloc = _req + 1;\n char *_buf = new (std::nothrow) char[(size_t)_alloc];\n if (_buf) { _buf[0] = 0; std::cout << \"alloc:\" << _alloc << std::endl; delete[] _buf; }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "110967309ee278599ed3afa4c0193c646baf1a821353b2e2a19f52f8ba6ab94d", "structural_hash": "83aa5e106a329e11188455f7525e1ecba89f6e2d1eae62c7896314002c6067b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05835.py", "upstream_id": "BenchmarkTest05835", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n parts = []\n for token in str(header_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JsonResponse({'error': 'CSRF token mismatch'}, status=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf7fca9236a1ac4cb3059fe8fa5ff7cfe0f5cd39dd61fc33640f81d17d3d199c", "structural_hash": "7732fb6f1c73386d7944ac28f7f2111e663854fbb23452ed47fa8fa3543f2784", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05038.c", "upstream_id": "BenchmarkTest05038", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "002ae4a5f5185c4073f90aae9278da48f1ff0886d51782639497ad3725506b51", "structural_hash": "887c1821a2efc10cd3abde287611fad8d2717b2cdf8c9dafefd03f51b9fd08a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02957.rs", "upstream_id": "BenchmarkTest02957", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = forwarded_ip.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f599f6eba02ddc910628ddd788761d468b2ad86a285743e8590732a5201c07f0", "structural_hash": "061f00024cf93adb5469ff2add0a4d0b6d4f190641ac77a3e6b76bb397309b5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01035.php", "upstream_id": "BenchmarkTest01035", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df0309e5b2443480254fcb2e9b3e40da9b4a047243834cf3084e02aa87602af8", "structural_hash": "896ae774e8ac38726aa68519a586dc3d8e5e31f02f0c8d7d7a9f5e9613495089", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03829.sh", "upstream_id": "BenchmarkTest03829", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-337"], "category": "predictable_prng_seed", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ed1290c823b208e5b30416ab947d41977d52740686dde6078a30811937a9b7c", "structural_hash": "c3d5f8dad555627ac77d45ded799425683e4d58d4fbc5a2bfa45d35eabed4a4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04937.py", "upstream_id": "BenchmarkTest04937", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport html\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n processed = html.escape(json_value)\n return HttpResponse(mark_safe('
    ' + str(processed) + '
    '))", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "136c2efdb4fc68e9f13096d321c76c930c5c92079a5f1e49336d529c6f1e630c", "structural_hash": "9fec57f84e10cebeced7e8f745fdfd87a14f8a097328f03b7cadca39871bf4f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03756.cpp", "upstream_id": "BenchmarkTest03756", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47b8edd6d392cd8c94d1ecfc11c0839dc6987f854e4cabdfb7da96944397c433", "structural_hash": "764f16aaffe1b679cebf64eec62a36034b9dd7c4152ca2c1af49be645ede017f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00277.py", "upstream_id": "BenchmarkTest00277", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n pending = list(str(host_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e33df8aa6563e958484c882c0e4474f2a3beaa52088f630aee37e738049176b8", "structural_hash": "c3d20ca9f69d024e7f13af9e7cdd3600c85dd0f754049ffa4f877b41b13e56bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_26180.go", "upstream_id": "BenchmarkTest26180", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := string(bytes.TrimSpace([]byte(rawBody)))\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8ed9812eaf7750870980959895e2c0c8869ac68ae0f0bdfe91d3a8f5ca2d142", "structural_hash": "b112eebdcda60db5b27df00265b9a7e31e3ca79af7581cffcc2aa9a47b9335b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16095.js", "upstream_id": "BenchmarkTest16095", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT bio FROM profiles WHERE user_id = ?\", [1])).rows[0].bio;\n const data = await Promise.resolve(userInput).then(String);\n const processed = String(data).replace(/password/gi, \"[REDACTED]\");\n res.cookie(\"session\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f904cf1fd022ec5dcf4472a4941421e228676538683cb61b661b64b60f428b5f", "structural_hash": "1625fbeda169f73edf4ac9956be9f2ebc06e58617e68ca8ddc090e01e8b78514", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02654.rb", "upstream_id": "BenchmarkTest02654", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n _buf = \"x\" * 1024\n _ = _buf\n render json: { result: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9e8e49938cdf3e2aa99f18863db8f078c96d2c08afe929de0f9cd48de67fd98", "structural_hash": "e7b6e6ed35043c16b76d1529dec95d25bb3a27b07542cea92183471786a5a33f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05757.rb", "upstream_id": "BenchmarkTest05757", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + user_input.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c908309a1d70c3fb229943ba584df9b08389b11249c9fa8c7b7af9d270bfd15d", "structural_hash": "8d4a5c2f9a4b8b0b042ee0ce2c7be6c6b12e5c8bd856e3cfda994ec93e35b2b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02130.java", "upstream_id": "BenchmarkTest02130", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference ref = new java.util.concurrent.atomic.AtomicReference<>();\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n ref.set(rawData);\n String data = ref.get();\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9dec65effacebd49130581ab5938219d7361d2a38d0aa418d949e04f85cc06be", "structural_hash": "d61652931adb5766cb2fda6d97f74c1c0235f1b6a4a20a796f6b642e94ba0802", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01410.py", "upstream_id": "BenchmarkTest01410", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom pydantic import BaseModel\nfrom starlette.responses import JSONResponse\nfrom app_runtime import auth_check\nclass UserInput(BaseModel):\n payload: str = ''\n_login_attempts: dict[str, int] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n parts = []\n for token in str(json_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if _login_attempts['user'] > 5:\n return JSONResponse({'error': 'account locked: too many attempts'}, status_code=429)\n if not auth_check('user', password):\n return JSONResponse({'error': 'unauthorized'}, status_code=401)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6c697d5f58d5e2b2b9e335df0f9d71882c7e6f97d540c02a4735dd31578cae8", "structural_hash": "6685de874a4daf6fe916d4b7bde5ba36552bb36d4e1cc780c86d319c9de3dd99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02883.php", "upstream_id": "BenchmarkTest02883", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n [$data] = [$userInput, 'http'];\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$data]]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d32271da47fca5d197f6466fa2b18b569cb28de4180106eb0635d69e1bf4a3e", "structural_hash": "cf48add48c4f4faa4821621e5033dbcedc925b457bc39d67e7d4f81a7a048b41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04703.php", "upstream_id": "BenchmarkTest04703", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return new JsonResponse(['validated' => (string) $data], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f1646df693e6d38acd2bfb209809225637ada1f8196a32317cdf63313e97b82", "structural_hash": "49e51742d674bfc92a00dff5b9cb76fab638c74c2a53e508be0410a53b5878dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00706.rs", "upstream_id": "BenchmarkTest00706", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse rand::Rng;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let data = comment_value.to_string();\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "061337757f9943c81eb6470419db0e36f70caa1ff84c83a0ce2a483efcaac68c", "structural_hash": "6763e4cb226e13007f5e7884a67ead7c8a9557039514307248e9a9cdddf42d08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05804.rb", "upstream_id": "BenchmarkTest05804", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cc473e6b774d8b89fdb7c4ef58aee91ced5faf89ad1645b088c33f0a2969357", "structural_hash": "85b1c9233696036353e12f59e84bac40d6bafaf8ea7a83950f7daf30ea7e5db8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04703.ts", "upstream_id": "BenchmarkTest04703", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Header, Post, BadRequestException } from \"@nestjs/common\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n return \"
    \" + processed + \"
    \";\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cebe804eecafc5d7802bae7f60ddfea6d8c30498d4770cf85468fabd2113fbba", "structural_hash": "1d9761edbcb91862b766794e49a79915d632df4f7da1d976b609d93828a2560d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00475.sh", "upstream_id": "BenchmarkTest00475", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n local -a _cmd=(\"echo\" \"$data\")\n \"${_cmd[@]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ece594613e59527f5210d31cdbaaa68a789ee96c5bc9d83c19d015bae9c8f556", "structural_hash": "141642ada1d832ce49080ba4c85ac78e2d1c48c77b0555456d4e1460da99b30a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02500.go", "upstream_id": "BenchmarkTest02500", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tdata := BenchSvcPassthrough(forwardedIP)\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0095c185b7691dea709bf6ca500a519472478f425f017f46aaa633db87babf34", "structural_hash": "896862b7d1857a764162ac0c6e453562f59a8cda04ef5df559e00fbb9408a4c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17514.go", "upstream_id": "BenchmarkTest17514", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tcapture := func() string { return pathValue }\n\tdata := capture()\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+processed)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6a2dbcd8251b6a520608751bc52366cbd8aaa6990c5cdd02502fb3b795462d1", "structural_hash": "29252dd2c89e578bc83053f13d03d9abfbc9b76b245805933b0c826dcb9b3d33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_11687.go", "upstream_id": "BenchmarkTest11687", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tvar data string\n\tfor _, token := range strings.Split(hostValue, \",\") {\n\t\tdata = token\n\t}\n\tc.Header(\"X-Custom\", data)\n}", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30d4a9b1e4217cb30c3a3a2cc6b36e2ee81a10dcf35334d41ebf429b5a7f5380", "structural_hash": "3582766218e682b3ab1801f335f533d2c69d1919f368cb53cbf3eba8cac26abc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01427.rs", "upstream_id": "BenchmarkTest01427", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let dotenv_value = std::env::var(\"DOTENV_VAR\").unwrap_or_default();\n let data = dotenv_value.replace(\"\\t\", \" \");\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "246aa3595fc5cc540b028634f4042ff3fa42cf81ef8dd714a27d81e097a4b515", "structural_hash": "b18f04c2f6fd880d572d6cc408b19ac0e29e448ccfa79c5f88d182fc8203095d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00410.php", "upstream_id": "BenchmarkTest00410", "language": "php", "code": "headers->get('Host', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $processed = (new \\HTMLPurifier())->purify($data);\n return new Response('
    ' . $processed . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a54c0080166e3c1717f08449461430afb8294561f38c2e604c9054619acf3a3", "structural_hash": "5ff8b7e4ffc342189a13d35a84403e53b8be316f5bf09ee003947d7c88b4d7ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25606.sh", "upstream_id": "BenchmarkTest25606", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c7dcc5b66b772843af110c59c736472d4bd0672117e4a224b13ba9674e67c46", "structural_hash": "c1ae1da4822e6757c32829103b6cf9af825ddab6b567769955e01f4dd2ca2421", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02642.rs", "upstream_id": "BenchmarkTest02642", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse ammonia;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = host_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => host_value.to_lowercase(),\n \"f\" => host_value.to_uppercase(),\n _ => host_value.trim().to_string(),\n };\n let processed = ammonia::clean(&data);\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7c99eeef44553df01cffee639ab390ce483f513e155c647f32d11fff13e7233", "structural_hash": "6b93ac989e2603bc508b2f19fe86fd6c10642cbf8a87674e2a85558be2e23489", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15383.c", "upstream_id": "BenchmarkTest15383", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n free(_p);\n}", "label": 1, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3458ef8615ec152894aec5dba67e482f0ae24b613736e56ad58b5efb38c4ee6", "structural_hash": "f487337fb4832ce943e5fae1dd3166fc923b49288294e4d0aa50f6dd27996cd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06502.c", "upstream_id": "BenchmarkTest06502", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e0be3ecba8ea853d735717aebf4590ddad2103917fcbbc5d7a2996b3f798a08", "structural_hash": "2daf955ce8dcb520b3eee211f2799ea67429bba17fbd2cdbbe4ed06043e8680d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01763.rb", "upstream_id": "BenchmarkTest01763", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Rails.application.config.app_value.to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5303fd61dc950fbb1fe7a21e54d0ed6389d01062c6993d4024f231e0f6840598", "structural_hash": "580e3d9bfdba8e7f3491eb99b247d578fe31a20fa04aff05875ee9e62dc28e57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_26703.go", "upstream_id": "BenchmarkTest26703", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tcapture := func() string { return dbValue }\n\tdata := capture()\n\tcmd := exec.Command(data, \"--status\")\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c664016bb9a1ae42228e396d9c70dd5fc6499b7f357c522b853830916e053131", "structural_hash": "356a3c05c303bbb473d718190379304da8d5f8ba74618c7c8e698a2dfa854495", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03903.c", "upstream_id": "BenchmarkTest03903", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n if (_idx >= 0 && _idx < 5) printf(\"%d\\n\", _arr[_idx]);\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "791710edae121079491ec1d80f65cec33b718e32c70a3435e9da71fc6a584d02", "structural_hash": "85aedb4dc66516f960a5a554dbb90484b0bf3862a8db139b6ec0abd3a6b56f2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00325.rb", "upstream_id": "BenchmarkTest00325", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n data = user_input.split.join(\" \")\n trusted_claim = data.to_s\n render json: { trusted: trusted_claim }\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8039e0afc260a95c586e123f4b29080138969962361355c52f45aa15a55ebe34", "structural_hash": "850db6abf5d22f2f2414d0b7dc3b206c41e5653b6b9876db1710522f8f84ac8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19539.sh", "upstream_id": "BenchmarkTest19539", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1757e328e9a0fcc727ef4626afb5676a7f3682927eacfb7aa7d1dce1a1d1924b", "structural_hash": "35ec66da372c5ffa77e7d484383f3eb8c7ab1b27ff8e4252eff44872c9c904a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17640.c", "upstream_id": "BenchmarkTest17640", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcfc124e515096de3fc8c6bbc4f3ddd76e091fe8f9caa8469c717e91515da071", "structural_hash": "adcbacc050918aed1ae2bc287f18f8f1b2636c2f035335cc56ab6f84473ded00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00292.js", "upstream_id": "BenchmarkTest00292", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9c1780f9e786be90803db6b36084fb09e36d0a925909320a4a0b1cb5c2f0035", "structural_hash": "d4724f011101956ca59b82ec566098e27ac68aab2f0f5ae68687049ee23713ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04439.rb", "upstream_id": "BenchmarkTest04439", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n data = user_input ? user_input : ''\n Net::HTTP.post(URI(\"https://api.intra.net/data\"), data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "028702d248fea260a159330c09de075f6e9305e172c6f1ccbeea9c8375796c69", "structural_hash": "2c607c4a6c20bfb78d003a9b20912ad1f7e2fe7d8c478a00dc72227c635ab9af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04309.py", "upstream_id": "BenchmarkTest04309", "language": "python", "code": "from django.http import JsonResponse\nimport logging\ndef coalesce_blank(value):\n return value or ''\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n data = coalesce_blank(host_value)\n processed = data[:64]\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2fe0a253b4357a2531b876d4c3c61b94e21ce40267cef82e527b0251d5e69bb", "structural_hash": "4201afed3082d0b4aea462dadfc257625a66b4f310da7adef6ec26f998f6ac83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29159.sh", "upstream_id": "BenchmarkTest29159", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n echo \"$processed,data,row\" >> /var/data/output.csv\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13726091bb456740d81084bb2a20cf9864eb8fe38183e448dcc465eb29747566", "structural_hash": "66d875839b522dd5eb448bd6b2a93e3d79c990adeca7aba3881b86f8a0895982", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01197.py", "upstream_id": "BenchmarkTest01197", "language": "python", "code": "from django.http import JsonResponse\nfrom lxml import etree\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n if header_value:\n data = header_value\n else:\n data = ''\n if data not in ('asc', 'desc', 'name', 'created'):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af8c45fc5fdc5d7f8ee2bfd02964b619f68582ba5d732d72156fdc629d530523", "structural_hash": "82bc8d442f49efa94e73cd4edd6fb63bd2c9544dddb8be6958951a56dfead41e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12101.c", "upstream_id": "BenchmarkTest12101", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_OAEP_PADDING);\n RSA_free(_rsa);\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "784b9b363dd9023476b01f265b9ca9a4179a7a807c99c8883d542696f8b1cda5", "structural_hash": "245041d5f22efcce97004695c4cd8881dd76e37110703fb93566f5db400d9401", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02635.go", "upstream_id": "BenchmarkTest02635", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := strings.Join(strings.Fields(rawBody), \" \")\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\tc.String(500, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f9f65be52cfea929b8d97304998205a067319f8370a4665e3e7c1ce56e351f3", "structural_hash": "f4402cad94cf2f6aae3f1b2fe28b6b79e47e4d4deaf5f795935b7800af0295bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05135.py", "upstream_id": "BenchmarkTest05135", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n dotenv_value = os.environ.get('DOTENV_VAR', '')\n if dotenv_value:\n data = dotenv_value\n else:\n data = ''\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83e3f66fd5eb3ff6e57ccca42b307ae9f707476aa5d422fa1a5790b2ba0091ae", "structural_hash": "64ab464773fb25b4c8a5af4b774d8fc44ba746b5693b32d0f2566767382d7386", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01754.py", "upstream_id": "BenchmarkTest01754", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n reader = make_reader(header_value)\n data = reader()\n digest = hashlib.md5(str(data).encode()).hexdigest()\n return JsonResponse({'digest': str(digest)}, status=200)", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ea1b50060457baa81f60842c1869f38195bf0fb21e55f45bb95a5754b5d1af4", "structural_hash": "5cbb912a7188789b542e11d85894a0a29fcb494b2d7b7b93af2aa8152cfdfc58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02246.ts", "upstream_id": "BenchmarkTest02246", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n console.log(\"Action: \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dac2c1d5d7fab2821feb04441aa2cadb1b75395ed0443a7e4381cb2d1f755e5", "structural_hash": "dae12069bbb7fbad9e8707dfc023c8204dcc63c2542bee9400545bc663723c4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05983.php", "upstream_id": "BenchmarkTest05983", "language": "php", "code": "headers->get('Host', '');\n $data = '' . $userInput;\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return new JsonResponse(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n eval((string)$parsedBool);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc6fb3d1c00857617b39190a3b73bc34c1715a17ea31c66cefe36e97a6bee6b0", "structural_hash": "e6fc9dc013e1f12aa3f4a5ce43ff828d74fdb6a325e5dd25ad5ef6703fa92270", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04895.py", "upstream_id": "BenchmarkTest04895", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n reader = make_reader(field_value)\n data = reader()\n if not auth_check(str(data), session.get('token')):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8b2f5b206d02fdf7d502c84d195c03b4068804ab12bbb60a10de2460f8903d3", "structural_hash": "db64e02a128ce89b74edf0befe95f1dbe5c1161418e6dbd6b56074f634d29a2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01891.cpp", "upstream_id": "BenchmarkTest01891", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e8fffa7d27bd3d80fece3ad4e428b1fd1f36a0c5ba0731b1a8af164a2d8f765", "structural_hash": "bde76b6f5fa029a76886ae2330d77e56d4299b0cc2bda4b206d11f8a2ddfd2eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26591.sh", "upstream_id": "BenchmarkTest26591", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n _fname=$(basename -- \"$data\")\n case \"$_fname\" in *.jpg|*.png|*.gif|*.pdf) entry_file=\"$_fname\";; *) echo \"invalid file type\"; exit 1;; esac\n echo \"uploaded\" > \"/var/uploads/$entry_file\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4982910e5e188f56ac334bf7c693ab9d75669d766f3249966dffdd559f3a41a6", "structural_hash": "ffb65cb1d766ab91d4431795d7d81e9c4d866f5bc179c897dd890feb98ff7721", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12194.c", "upstream_id": "BenchmarkTest12194", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char *const _argv[] = { \"/usr/bin/tar\", \"-cf\", \"/tmp/backup.tar\", (char *)safe, NULL };\n execv(\"/usr/bin/tar\", _argv);\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe5c13d8ea7dc2bb43768b3aaa7a8ed761569b4d705b8014d472c914f600abdd", "structural_hash": "c129121ea63348a54b24697f00b868ce41dc2690b5ed39b6a22084ed4c0233dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05825.ts", "upstream_id": "BenchmarkTest05825", "language": "typescript", "code": "import { Body, Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string, @Req() req: Request): Promise {\n const userInput = field || \"\";\n const data = userInput != null ? userInput : '';\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1312ed0d5291a154917d7840de73a60222bf6e013d36b4e078467daef7d7ff42", "structural_hash": "c2a56cf5f3eb3e6c3aa5a36db9b19620c2f9c531ac91ab516cdbe358a927d32a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02049.rs", "upstream_id": "BenchmarkTest02049", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = header_value.split_whitespace().collect::>().join(\" \");\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b56517ba5193a13bf0d084b4aaf04a6cdcc1dc610bc63f310d70d93348d6ae6", "structural_hash": "ed72a6940acc9ee7f2460443393188f9eb0ca73a0205d7359fab4cdd26338ab7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03442.php", "upstream_id": "BenchmarkTest03442", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n return new Response('
    ' . $data . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16ce1482575035b4dac0f91c09dbbf427e9826f3c0e2216325febbe88d5cba41", "structural_hash": "1a68aca12946774140c198b748e67d05c5982723c1c8b970a7016ec95e2f6157", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01226.php", "upstream_id": "BenchmarkTest01226", "language": "php", "code": "getContent();\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader(['p' => '{{ name }}'])))->render('p', ['name' => $data]), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4a2ccaa401d736d2dbbe67cae40dc713556bae99004721d91fd765c91782f62", "structural_hash": "39d357e75d2baef955ce7160dae71150249eb009549ff488042e192806926b80", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02350.php", "upstream_id": "BenchmarkTest02350", "language": "php", "code": "input('multipart_field', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b92d4ef0aade73d0cf246deeb3c137c2fb01e9401a39b4c715d68bfd2b67ed6", "structural_hash": "ff23483db9c962ff44cd49766742ddd6bb7c9171a1734b14ed992232d930e01c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05358.java", "upstream_id": "BenchmarkTest05358", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String prefix = hostValue.length() > 0 ? hostValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = hostValue.toLowerCase(); break;\n case \"f\": data = hostValue.toUpperCase(); break;\n default: data = hostValue.strip(); break;\n }\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3916426b46c5a1c641ca57088828cfe26ddb503ed83fa4d3e5b206b85f3d93d", "structural_hash": "068acbc91dbb500146c767a56fd4223fa1677da0d7d0acef5493ff86cacb2723", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05201.py", "upstream_id": "BenchmarkTest05201", "language": "python", "code": "from django.http import JsonResponse\nimport json\nimport defusedxml.ElementTree\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = '{}'.format(json_value)\n defusedxml.ElementTree.fromstring(str(data))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0c2a6ce194e45b4c13d8e3a93523477815b634c769995f07ee2bbba0e65d234", "structural_hash": "134f609ea8f2cf5fb8439861bf3dedbe11a7b12e15e53048d8e5e4dc305dc23e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02932.rs", "upstream_id": "BenchmarkTest02932", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n for token in json_value.split(',') { data = token.to_string(); }\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c9958c423eb3110190fa0d2d4a839a26bfb1b860fb5221d6910242c4f25a780", "structural_hash": "2a8b11217f9c8b3fc2dfaa8626e40e6d044ed501de9035c0c2f70c9d81c73e21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01969.rs", "upstream_id": "BenchmarkTest01969", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let queued = referer_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dce696cc7251b89032cdefb7c65f4e2f2cdbf8d6babd61c151bdc2ef1c8d2dcd", "structural_hash": "563230207f8decc352ee95328ad4be433d114bcaaa0f1432fb5b83cfc0d7a888", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08705.sh", "upstream_id": "BenchmarkTest08705", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec311b5455e22ae900fddb193a89ab62192d4d22a443468da1131d334e60a3a1", "structural_hash": "5aca57d9ff0794aae232b45dac66edbacda22a9d045cc8815e5322ef4330bd3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01962.rs", "upstream_id": "BenchmarkTest01962", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let data = match multipart_value.chars().next() { Some(_) => multipart_value.clone(), None => \"default\".to_string() };\n HttpResponse::Ok().insert_header((\"X-Custom\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0412e9470d160c8b4d1f01880a38ae4899502d79f31ac73436e8998bc013f301", "structural_hash": "69b0444a4dc1e2caf6f30d2d4fe8d843759fd62e8e29af0b15d9522c96054cff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17025.js", "upstream_id": "BenchmarkTest17025", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = await Promise.resolve(userInput).then(String);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d1523b8a210bbc2111c8ef3dbead603efb38a122f5eb89a1359529b2715c295", "structural_hash": "7a19445ddeae0b94ff81b12034e04e87898e212f13098f184e9be97c88e2d758", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00149.rs", "upstream_id": "BenchmarkTest00149", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let queued = path_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cba95a9329056c9e5420e617ce091a66050adccc24fdfe33474308753bb7c064", "structural_hash": "850fcad54c81c32be4589e703993e122400b503bca8383cd73ff397598984efc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04111.ts", "upstream_id": "BenchmarkTest04111", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = userInput != null ? userInput : '';\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb21fc4197c690dd73755ffdf721ba515b3f051095faf8e9a5465164422ac299", "structural_hash": "b7b955f495ecde44739d9aa3a6deff1f4f0e0063f87aba0e76d00ac0ad43360b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04070.cpp", "upstream_id": "BenchmarkTest04070", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int argc, char **argv)\n{\n std::string user_input = (argc > 1) ? std::string(argv[1]) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8ac7f5363b1f41c04440d657d2792c6908f8948855adca635ad8c0d3a2a696d", "structural_hash": "d56d135f13142d1206ec684c0d97f43f3696217cae508fb65ba635099aa95ffb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00965.js", "upstream_id": "BenchmarkTest00965", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = \"\" + userInput;\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(data, 10);\n const value = buf.readUInt8(idx);\n res.json({ lookup: value }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "638827c208f4e3e0e0a040188af94df291ce6e086ebe46db28c60a8446b6451c", "structural_hash": "d8b91307ec60010ee562d90c831de1ca6e79afa2345d0b7416faad57348aa8a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01460.cpp", "upstream_id": "BenchmarkTest01460", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7914214099f6e7c9ee378dea2fa6e833af46c5f5225fac0bf7f273bd265c0fe", "structural_hash": "378a205abd649b0c29535e4b727073c4eb22c7b0b15f7324d9bdec846ba56a43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03277.php", "upstream_id": "BenchmarkTest03277", "language": "php", "code": "header('Referer', '');\n $data = \"{$userInput}\";\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a338d3c09394d093df9d69cea10d253f2ddfe3226d922b625995c6e4a845dea9", "structural_hash": "4905c7359c1d26496abf8f5da5f6b5b9625efa2bc316d0e55a23e0a9b76165ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01545.php", "upstream_id": "BenchmarkTest01545", "language": "php", "code": "header('User-Agent', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06ab0e264c8ff5ecdc32b28c5fe840a253e3a7b9de7f1b6e4c24ca43f414076f", "structural_hash": "3f8a02c62c7c43e8b99ba7fe4f8822a58fad8c5cf00ce390e35ae1560da24150", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24711.sh", "upstream_id": "BenchmarkTest24711", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n if [ \"$(date +%Y)\" -ge 2020 ]; then\n echo \"uploaded\" > \"/var/uploads/$data\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "219435bc606aa2da57d72a621be384067674baf234a19c5ffe8f1464532a17c7", "structural_hash": "7997ef227cbe3da6c36a054017002a99ad2bb1e7d2ef36e76039db1559b8b045", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02984.php", "upstream_id": "BenchmarkTest02984", "language": "php", "code": "cookie('session_token', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n mt_srand(ctype_digit((string)$data) ? (int)$data : 42);\n $token = mt_rand();\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d365f41e6062d9853e89fd5e7b0617c90270f7156755897ac41241201ce7ac7", "structural_hash": "a9d635241948e6c7b56d0a82c527a38d44fe0e5dc7f23536c82730aefc27f7ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02793.c", "upstream_id": "BenchmarkTest02793", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\");\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3370fa802315f08b533b8ae925d2eb68256cf523eed435470ac5766667de1fa5", "structural_hash": "cce7f878f3835c31ae9491859f4bc874961718d75c7c69a6dfda0104e6d39479", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04233.ts", "upstream_id": "BenchmarkTest04233", "language": "typescript", "code": "import { Body, Controller, Post, Res, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = dto.payload;\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e21db4c869304d13419be7e27dd475ab76610fdac1d365a51c7404b250a03d06", "structural_hash": "65aef54b71728ebb7b05c5499af3af9a6347f33ca0511b2fe5faf8ff38dac5ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05416.rb", "upstream_id": "BenchmarkTest05416", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n entries = Dir.entries(data.to_s) rescue []\n render json: { listing: entries }\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a03221f3878cb2c2cd4308f9c217c0f2799709091a8a79aec85becd9277fab76", "structural_hash": "7e7439b5bc4c05520bbda9836c5e3dbdfed5c4755f7dfcb9fdd950a93fe59c19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11105.sh", "upstream_id": "BenchmarkTest11105", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"${user_input:-default}\"\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-941"], "category": "incorrect_comm_dest", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d17fda89f7efa04de711807c36ff238179b15d498a7ca30937051eb3015868c", "structural_hash": "ae72cc28634fc919db7d98b5bbfb61d5351f200dce385a85959c4327cacca03c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05699.php", "upstream_id": "BenchmarkTest05699", "language": "php", "code": "text;\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $result = DB::table('users')->where('id', $data)->first();\n if ($result === null) { return response()->json([\"error\" => \"not found\"], 404); }\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c56507cda2d181ee444f253cf29b3b0e1897c0448d5c2769db7b3ca4d57396dd", "structural_hash": "7fbb09bf758876101a7cdf35142605bd7a9a8490a1d7f6579c44a0be86355ba7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02631.cpp", "upstream_id": "BenchmarkTest02631", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dffb1920019ba184160de043bb873c582fd1e233da677b55835d280c9baa7d3e", "structural_hash": "03cd7df857ca8a964918fd05889a3d71f9566e1b5777af12f9cb94d446986a66", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04630.php", "upstream_id": "BenchmarkTest04630", "language": "php", "code": "json('payload', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89586d42c701d28c7e36cd8953efc019a75f8b94b6bd30a1c06a99c5c3fcdd0d", "structural_hash": "a9ccc895c5d86392a24b66ef5815466b532ae6ce01d9ca8a336dd6becf2d82e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04181.rb", "upstream_id": "BenchmarkTest04181", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b89ae6aab6c50fa5144a157b7f125a3e3955a8b87d079c5d6f51fb6b9daf411d", "structural_hash": "9a0d2aba4dda094b24c8af62cf4bd94094c5d3ec2c99dab4119fd8d82c9d4fc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09793.js", "upstream_id": "BenchmarkTest09793", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-807"], "category": "untrusted_security_decision", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db2e72b88dab6d4e4ab2ceb2b84110cd9c6a18ca67b7aa39cd0f52acbd555d1f", "structural_hash": "5f8b1a38530c6f5000939f633f7af51710e21d19587a584d6256fee757b9ad3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03788.c", "upstream_id": "BenchmarkTest03788", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"cfg/%s\", user_input);\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0580d5a0b5ff18880b7a989e343b2eeaf34179d1e4d556d4c2a88b28fc7c5c46", "structural_hash": "f83b1912c1b85314a44c9bbbee52092a742a272abcf14f0bf67cc98aa48469bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05941.ts", "upstream_id": "BenchmarkTest05941", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n const data = decodeURIComponent(userInput);\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ca4cc3f65f288b9ee7f0a9e146c4b387e999c81499940e96e96eaf01822bed1", "structural_hash": "e14e54f0af8cf7e4e1f995dff5492d7d4b4abd348bc593e7f3afae657da889b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05037.rs", "upstream_id": "BenchmarkTest05037", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = host_value.replace(\"\\t\", \" \");\n let requested: u32 = data.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ea7d208c6fedc253c982c628034350bfa742acf6f99f8d907cd59c2db5d1626", "structural_hash": "f8c8a453c8f5220797f6e6027fc5562aa48d7e6ae74369c9cb0cc071499b8fa2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00366.cpp", "upstream_id": "BenchmarkTest00366", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c6fbe2f57fc82afa361e7ed5e02b7d9fb3da5d9bfb30dc44bc5b7d37fc18269", "structural_hash": "1920b152a4f66bea85648e0ccf4cbb878f44efc77fcc96333609c9e1ec014083", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02676.cpp", "upstream_id": "BenchmarkTest02676", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a64c8844c35f7974d4b9e69834d0199e71a9a3dfd24906954b94cb883bad67bc", "structural_hash": "8924e00d8535b242871ebd0f95599a3db3c3f835af4262557226b7b7f7b277f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01184.sh", "upstream_id": "BenchmarkTest01184", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT bio FROM profiles LIMIT 1')\"\n if grep -qF -- \"$user_input\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef9784b3b65c5e488e73651cfb1fd91d95a4d73fd355314a03311d0a8b8bc5de", "structural_hash": "e8bf86b40a2d2d2f864024aecc82c9b63208900ed43ab51b99b396f37e6fb33c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02638.cpp", "upstream_id": "BenchmarkTest02638", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Host\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f77d8f693ffe3c59846261096f0f50c4e95269f8d1a772e1b5b5def820f82ee", "structural_hash": "1caf70d90a5e9617c40e872f1e86fb8651382c4ae62c9385c7b538d885e9cb45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10652.js", "upstream_id": "BenchmarkTest10652", "language": "javascript", "code": "const fs = require(\"fs\");\nconst os = require(\"os\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const tmpDir = fs.mkdtempSync(os.tmpdir() + \"/app-\");\n fs.writeFileSync(tmpDir + \"/data.tmp\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "406e91b5c4b1c700f5d7676c51b4d021242adfbdf4f6554a7c593fb26eedd3c3", "structural_hash": "894ba50dbad2428fd12e71871294febd46dec5ccc66b768a6898410375bc9504", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03766.cpp", "upstream_id": "BenchmarkTest03766", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Forwarded-For\");\n std::string safe = std::filesystem::path(user_input).filename().string();\n std::remove(safe.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7941801cb0084868af48caa724f2d9f38687d21a5cb50548492cc78352e6ce6a", "structural_hash": "8110654c10186268e9b24c6d8d39890c5c2b84d8fecdd483ae89e97c7e63758c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02365.py", "upstream_id": "BenchmarkTest02365", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import mongo_db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n auth_header = request.headers.get('authorization', '')\n def normalize(value):\n return value.strip()\n data = normalize(auth_header)\n mongo_db.users.find({'$where': \"this.username == '\" + str(data) + \"'\"})\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6b639ae3ff6a408cce20582bd5426fcf91a61c900e6585ebccc2bca8074f7a5", "structural_hash": "8f6eea374989519676bbdf04180a994ec64f0e8178b7ea8ddc17a28d88eaa909", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00977.php", "upstream_id": "BenchmarkTest00977", "language": "php", "code": "json('payload', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad951efa54f981ddeea2e3429ae538a702ecc289d29176bcbbaddc302a4eeb77", "structural_hash": "843fef7e98646ec8ecf72de690dcb50b1d9046406b4867f579c77640103077c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02176.ts", "upstream_id": "BenchmarkTest02176", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.origin as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6166ddba1775ea1ed44148fa57a838805b8cd23dbccf607e8be7d27a470cbdfd", "structural_hash": "fe42ba3665304f1f6c7dc23b0bd1de35e5ae1d6574b57fd9f10d274eced40469", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03145.py", "upstream_id": "BenchmarkTest03145", "language": "python", "code": "from django.http import JsonResponse\nimport os\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n kind = 'json' if str(cookie_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(cookie_value).strip()\n case _:\n data = str(cookie_value)\n os.system('echo ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dfb5fe0ed8c88fb7f7a30b3baaf4a1c9511f3051cc4a18c55003828638dd85ea", "structural_hash": "0d68f17498ad0edc6ff664daea3bfefdfb6ece5b0eab9cafe9c6978ed40347fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35572.go", "upstream_id": "BenchmarkTest35572", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tsegments := strings.Split(pathValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-346"], "category": "originvalidation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a698e28453f5df967e87f187780194bb73f25460827a28058bea963ce7da7b1e", "structural_hash": "20adf3a1cf3bafe71f3cb126f1bed0373ab4be2e425c4b497bdf9d9b5b9b2453", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02016.cpp", "upstream_id": "BenchmarkTest02016", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "075aaaa43b0c77719d52c5f03ae46e3bce290098a1955e9404462d11386f9dc9", "structural_hash": "f1b70e0ef338249d4c468347f9ed79d02b598c9021e9d226ea36bc608e7b947c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04551.ts", "upstream_id": "BenchmarkTest04551", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const data = userInput != null ? userInput : '';\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3484af8f0da70e1a052cc9d81737dc8aa9bfadc5bcb1ae9f2a73b4067a832e1", "structural_hash": "589d47d422bb2c55b80fa09e589e6f9e3b93cfbcd921de7ff89630581a7e0b24", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01307.rb", "upstream_id": "BenchmarkTest01307", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n ERB.new(processed.to_s).result\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de82a48ee354d54a750af98055eea56132f82b63ec458cf44146c0fe6ba02798", "structural_hash": "b6418fab8af1452ced7b3b794d9cd8289028102a0abf28961e430d83ee184379", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09261.go", "upstream_id": "BenchmarkTest09261", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"golang.org/x/crypto/bcrypt\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tdotenvValue := os.Getenv(\"DOTENV_VAR\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(dotenvValue)\n\t}()\n\tdata := <-resultCh\n\thashedPw, _ := bcrypt.GenerateFromPassword([]byte(data), bcrypt.DefaultCost)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": string(hashedPw)})\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88f9bf17a6a7fc61fbeaabed4a1c71cfa742edcd37bd0ff91a7033be69e43767", "structural_hash": "f863696ddead9c52b741e9b3a364288d519e54d429ebcf129ff96622aa70c0c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05557.py", "upstream_id": "BenchmarkTest05557", "language": "python", "code": "import logging\nfrom dataclasses import dataclass\nfrom flask import Flask, request, jsonify\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n form = FormData(payload=user_id)\n data = form.payload\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n logging.info('User action: ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "018adf36a2cd587ed65ed1cd1127f036569a8acdb60cf9039462fdd503b790c3", "structural_hash": "add9d3d3d5a0e5b1cea7fad3ab94f0b8e680fac0cdcd80772d0833a824317093", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00963.rb", "upstream_id": "BenchmarkTest00963", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"base64\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = Base64.decode64(user_input)\n redirect_to data\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19219c776f4ac66ae94a42fe5e7dbc1881e6e1ad5f3efb7d54cc1be451d95417", "structural_hash": "fab771ccbc75049b8d62d7a72367f3278242af5a7f459f3624cbe7b1f49e9187", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02009.rb", "upstream_id": "BenchmarkTest02009", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n tokens = user_input.split(',')\n data = tokens.join(',')\n File.write(\"/var/data/output\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c7f540fa655cc17fa9c72dc2b1cae3a087f1e4c043a082f949d7a70524128b9", "structural_hash": "981647058b7f54b1c500f8a96ba6b64f74a5daf6d8e5d3acca56fdc93f99d70a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01265.ts", "upstream_id": "BenchmarkTest01265", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.DOTENV_VAR || \"\";\n const data: string = shared.passthrough(userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c0218b2aa250e43b05358b384c894105d8c27570eab8d7d01de86d8f34728a6", "structural_hash": "05094005a7cb8883f154106bba4f023635fc2d4e54a0cf9efb9c22b89d17ba92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05048.py", "upstream_id": "BenchmarkTest05048", "language": "python", "code": "from fastapi import FastAPI, Request\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data, _sep, _rest = str(raw_body).partition('\\x00')\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a1c555dbbdf8fc1138d8dfacaaff35b3358a2b549ebf1684e04dc918f61f5f9", "structural_hash": "2572129c0161604e1ed01a6a41852ebd6c718d192053d0355616074610a1c7b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00788.rs", "upstream_id": "BenchmarkTest00788", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = header_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let _dispatch: std::pin::Pin + Send>> = Box::pin(async move {\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n });\n _dispatch.await;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4319062a224fc183ad3feded9afde8e635c607039cb33a056c09d342cd715051", "structural_hash": "c382fd82fc80e10b30c35743138700a53250fad228c51f11123a2a4acbfd6247", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00811.rs", "upstream_id": "BenchmarkTest00811", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let captured = graphql_var.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a8d7aef314189bdcf8fca52b11368894a6c373627efd067ab814db7e876a4dc", "structural_hash": "a70b04458e64f96f467c234a3320b14f2e0cdfba2af59a561b702d221a56fd00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03717.js", "upstream_id": "BenchmarkTest03717", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = decodeURIComponent(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d78e97841b1f709ed47e8c9fd13310e6769ec2b9c2694ed5a847ca4afacb346d", "structural_hash": "c7f92a0f9c42b0d84f8e0913dd111e5009cb00528022b2fb21e44ba05f7ecea0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04436.java", "upstream_id": "BenchmarkTest04436", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : jsonValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cad8c15fee5c33d3922c7fc4c66ed712d8c1d19784decd9a79086ff8f983484f", "structural_hash": "8463ac6b531c63bcc1148a50f6c74ce645664a02a3bf5973df8dfe5e67ab8136", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02620.cpp", "upstream_id": "BenchmarkTest02620", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Cookie\");\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70d59da0dc7079bf67fe1a1015937c8eea1f415272d5511e1c844922507acadd", "structural_hash": "4aeaa871d4aee40c96dfbdc6cf93dce33db6015a8560277245870ed26a783904", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00588.rb", "upstream_id": "BenchmarkTest00588", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "827e4dbaaaae3e8a1844d4912cebc2498d780509341e2f7286f1a5d24c1fda3f", "structural_hash": "6d61d933bee78310d8839fc78575296fd121b0e448499d254b33761d2a0c248c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03134.java", "upstream_id": "BenchmarkTest03134", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"file\") java.io.InputStream fileStream, @FormDataParam(\"file\") org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uploadName = fileDetail.getFileName();\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(uploadName);\n String data = normalizer.apply(uploadName);\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f888bf8a0be54a73ab528e13785646a92b70c910a49b106808e19f428e510309", "structural_hash": "def872a65242bdcd4922c58c8642c7fd30fb6c27a697895dc9c614de7962f17e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00625.java", "upstream_id": "BenchmarkTest00625", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference valueRef = new java.util.concurrent.atomic.AtomicReference<>();\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n valueRef.set(commentValue);\n String data = valueRef.get();\n String dispatchMode = System.getProperty(\"dispatch.mode\", \"primary\");\n if (\"primary\".equals(dispatchMode)) {\n java.util.Hashtable env = new java.util.Hashtable<>();\n env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");\n env.put(javax.naming.Context.PROVIDER_URL, \"ldap://localhost:389\");\n javax.naming.directory.DirContext ctx = new javax.naming.directory.InitialDirContext(env);\n try {\n ctx.search(\"ou=users,dc=example,dc=com\", \"(uid=\" + data + \")\", new javax.naming.directory.SearchControls());\n } finally { ctx.close(); }\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13155a5331acb046e0b5c367a5418f5da24ca76f71b54282ab3cd56b17942350", "structural_hash": "2c08a17f6122732529c6a617da61ef942938c50926c354033cc623edc1710627", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03503.ts", "upstream_id": "BenchmarkTest03503", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "daff5708f44218607c57be2abc9f70564499860f8009adb14702c1c5cb8ebfab", "structural_hash": "53fb67ec4d2084e170cee09797589d197ced6f9a099270016c16071c06fc9550", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21020.c", "upstream_id": "BenchmarkTest21020", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n if (_idx >= 0 && _idx < 5) printf(\"%d\\n\", _arr[_idx]);\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "163b20cd9edc68afcb41f0c67ee720cc80681f456decd4191159c50fee160aac", "structural_hash": "8f6837a9ecdc7d1e52fa00035e0e5e5b51f7d778f1b90075750e146f9a727826", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00942.ts", "upstream_id": "BenchmarkTest00942", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n if (!row) { res.status(404).json({error: \"not found\"}); return; }\n const value = (row as any).name;\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "065b91cb37e526c59137f53d71236313378581f67cb76377c0136d9f434a7165", "structural_hash": "0485f6d56ce918874a78eaa5a7c2ee4dcb11e545a324ce14f936613b8697c168", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05760.ts", "upstream_id": "BenchmarkTest05760", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data = `${userInput}`;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n res.json({ validated: String(data) }); return;\n }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c55008ed012fe01362535ae8641788a1e64d26fc0e517623548a31c0b9ea9d4d", "structural_hash": "16720a4c32833c5bd2a160eb767bbcbfe4b937402983134ecfe2d123091e534f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03003.ts", "upstream_id": "BenchmarkTest03003", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n shared.authCheck(String(data), \"admin\");\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8292fdd214e70b9d8b322d4d09319e99d8f600b1305ca1512bfc877dd32ad8e3", "structural_hash": "557e2bb95cbcc6d70a2e97b1dce3197def9ca7ed59e20b1f759ff97649b42b09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16625.js", "upstream_id": "BenchmarkTest16625", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n authCheck(String(data), \"admin\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "482d7640ac541612466280f6c407ac625803d0799b96c900d55d0518dba171d0", "structural_hash": "5155783e8b20100adf5427f041fa2053eb223c16dca52b607060a979757f5811", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03812.rs", "upstream_id": "BenchmarkTest03812", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let data = multipart_value.replace(\"\\t\", \" \");\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb49ce097005b487ba7bf08fa160d469f2dc0d0e37620c43b3e6ba04c7da5246", "structural_hash": "7034ef8c3bf6953c743192e6a08807568c502353b0bff4cf87e46feffe837379", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02026.rb", "upstream_id": "BenchmarkTest02026", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n File.write(\"/var/uploads/\" + processed, \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f70a83c2da5667793e320558b8ca579775fd2cb1919f80db02273e50ee3493b", "structural_hash": "4a928dcbc92725fae0d6ead6d70559cfa3115403d0de5071cdd886158dd1479b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03913.rb", "upstream_id": "BenchmarkTest03913", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be0eaa6e7e2ddf51123c83203b831d91e989ba57c86f761406e6fce69a595654", "structural_hash": "e14ce2e1a40bbf537407d990a7f19293e6d69d2ceadbf0111fd4cfcd8db9c622", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02334.rs", "upstream_id": "BenchmarkTest02334", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data: String = xml_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| xml_value.clone());\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n tokio::fs::write(format!(\"/var/app/data/{}\", processed), \"data\").await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "577af78421555547c19d471268324cec7206579aaccb859306ddf12f6ae19519", "structural_hash": "c6a7c5219b8b9a84e99fffa33bfb7c546a5cb7eef9e3408911f645138f2e6623", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07667.c", "upstream_id": "BenchmarkTest07667", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0777);\n}", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a35645947f05c189f3b601313e5366c740e3af37d3d04d89909a00202f648d1", "structural_hash": "af51482845d2d251fc5108b8beaafe3838aa83a163655e3f3e0150b67a771f42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08640.js", "upstream_id": "BenchmarkTest08640", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const _val = String(data);\n if (_val.length > 256 || !/^[a-zA-Z0-9 _.-]+$/.test(_val)) { ctx.status = 400; ctx.body = {error:\"invalid message payload\"}; return; }\n require(\"./shared\").sqs.sendMessage(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\", _val);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e272d0a2c8db4a212dde04d6bab64a7a318381f16b5e5f9a4069434f5d7064c", "structural_hash": "2ed9824ac2883ba5af29d70237aa1f26ae01488a75d1291d67015a28a3dd32fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00741.php", "upstream_id": "BenchmarkTest00741", "language": "php", "code": "json('payload', '');\n $data = call_user_func('strval', $userInput);\n if (empty(session('user', ''))) { abort(401, 'unauthorized'); }\n error_log((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5991e59fab7fd67fbd1a1728723c95c8f285b9f152b2a8d3e8dd46701f1cd579", "structural_hash": "b4677e65115ace66fe54082c81e727fc5ce107e32643a27f864c7de7ff66a279", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16148.c", "upstream_id": "BenchmarkTest16148", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char *_p = malloc(strlen(user_input) + 1);\n if (_p == NULL) return;\n strcpy(_p, user_input);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22f17384ec8955daa16c0140dbcbe5556c1933d19ce4bce92567b13dd58e69b9", "structural_hash": "b177627337119190e39f7a5f01ad6a0535e06ae362607d23844f0e5262861fc6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00061.py", "upstream_id": "BenchmarkTest00061", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n reader = make_reader(ua_value)\n data = reader()\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c25f47b54120eed8055e2278a94e05b02dd15d0fb54f63dd0f94a9230fdd923", "structural_hash": "e515040467a026263f5f869d32a449b239d6cf2a9f42f1bb2fb037d79672b1c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21853.js", "upstream_id": "BenchmarkTest21853", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n switch (data) { case \"a\": break; case \"b\": break; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "285f29a334ad92bd96e7d57f3a4dbe22f26ba85ac5d098bd11571609e62ec155", "structural_hash": "c1e10a080478b2f1fc3ff1841a141a0f765f9240962ca0e8d0eebabd9f089d04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01949.py", "upstream_id": "BenchmarkTest01949", "language": "python", "code": "from flask import Flask, request, jsonify\nimport json\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n try:\n data = json.loads(cookie_value).get('value', cookie_value)\n except (json.JSONDecodeError, AttributeError):\n data = cookie_value\n if str(data) == 'S3cr3tToken':\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1464578851756bef4de651ccfb16ab5857544f62ce4c28dd4626c781b5b6427f", "structural_hash": "246130f96ee05c44e02105ec4697792a43f4508bd3ca3802efa9b69f1a922960", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01136.ts", "upstream_id": "BenchmarkTest01136", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data = String(userInput).slice(0, 200);\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46a766d05fc7d4b3113b951896d1ede25835e6cf177ab24c682f2e782b532796", "structural_hash": "c1b95a3eadcedac6a5a11310fc62b9fa3903bd7f59e8c739a0ec60c9ff5813e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02667.java", "upstream_id": "BenchmarkTest02667", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.xpath.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.function.Function firstStage = s -> s.replaceAll(\"\\\\t+\", \" \");\n java.util.function.Function composed = firstStage.andThen(String::strip);\n String data = composed.apply(fieldValue);\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n return Response.status(400).entity(\"forbidden\").build();\n }\n XPathFactory xpf = XPathFactory.newInstance();\n XPath xpath = xpf.newXPath();\n xpath.evaluate(\"/users/user[@name='\" + data + \"']\", new org.xml.sax.InputSource(new java.io.StringReader(\"\")));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d008f4e601045e7bdf57520c443fc77eb7e36da0d5d8ccfddca3a7ca190ca0db", "structural_hash": "a92b48c803f51a742cbef4c975678b3a7ce20aadd05746125c3aa57ca1cd3787", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17666.js", "upstream_id": "BenchmarkTest17666", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const data = userInput != null ? userInput : '';\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d78e1dbff8ca375b8b4b261834a920e7283a5f23b398d812c5a6a16780e2b063", "structural_hash": "fa0f129581d25eab411f518e91090ee875cb7f8c34d88fbdb48001ebf026747b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02719.c", "upstream_id": "BenchmarkTest02719", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb263f3cc69a78f459e6fc35f1d42db9b84cbf8d8084b18a5c7893a1185392b4", "structural_hash": "290e99c841d2ed640eaaac095b0f9b1dc2e96b1e347c84bb26bd41f51bd07375", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03730.py", "upstream_id": "BenchmarkTest03730", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n reader = make_reader(origin_value)\n data = reader()\n requests.get(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d4a8efd1312cc858bc1cb0354fcf9ff5cf8bf8a169b2b5297fde5953e23c318", "structural_hash": "573b6b598b4a0c4c68422c7ad3b9329659da14e4ce7ad57d0df3ec859f4b0bef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05788.py", "upstream_id": "BenchmarkTest05788", "language": "python", "code": "from cryptography.fernet import Fernet\nfrom flask import Flask, request, jsonify\nimport os\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n reader = make_reader(cookie_value)\n data = reader()\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13528affd78968e23105fa500831fd920b89dbdedc1337ad20229747514f2b8d", "structural_hash": "1f13abe0f5f6b15a2e62a03363c7ef3d59679545237b291e0e4d9719dc2ea1e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02226.ts", "upstream_id": "BenchmarkTest02226", "language": "typescript", "code": "import { Body, Controller, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string, @Req() req: Request): Promise {\n const userInput = mf || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ba3215eaf68855fd1a8c35595e03114be994559b9255aa935c02c272a624e9b", "structural_hash": "3ef41a0b4f1efde6fc6e333b6dcceebabc51c1b1595c3b8296f3313982234bdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02231.rs", "upstream_id": "BenchmarkTest02231", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let mut data = String::new();\n for token in raw_body.split(',') { data = token.to_string(); }\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return (StatusCode::NOT_FOUND, \"\").into_response() };\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8dbe4124fba57f9f325d66aaa2faa3e9cdf91d7240a05d54967628e28a33535", "structural_hash": "92a02a183550c4dfe01b5ad628d90f2c74f36c344f4241b25854bbf4fbf330ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03571.cpp", "upstream_id": "BenchmarkTest03571", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fad2206798e0bd4a548d2a33d088c67e2b01a2ed94aae16a9fa2a5757857ad6d", "structural_hash": "f2fea6dec5fb24a5f949a7c1b02f6191e1d1854ae07b24f3108cc92ae68daf47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02222.py", "upstream_id": "BenchmarkTest02222", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n parts = []\n for token in str(multipart_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n return JsonResponse({'error': str(data), 'stack': repr(locals())}, status=500)", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c8df56f1919bed0fdb30fed527fd5ce46c3bd4108711eac6e207ff469e5f235", "structural_hash": "48715020c7f18a2168edbd85ed21d56d9c6625fc768ec4b51396efdfe557064b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05570.php", "upstream_id": "BenchmarkTest05570", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $data = str_replace(\"\\0\", '', $userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2536087bc71f35d821da61625e56dbd4fe1152b7fa5e309859291a7746889221", "structural_hash": "452374e7f2df6df99ae075d33e7b3108b53df90da4d5a73d9048d2d937d5a3bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02789.go", "upstream_id": "BenchmarkTest02789", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := rawBody\n\tif _, after, ok := strings.Cut(rawBody, \",\"); ok {\n\t\tdata = after\n\t}\n\tif !verifyBearer(c.GetHeader(\"Authorization\")) {\n\t\tc.String(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\tc.Set(\"data\", data)\n}", "label": 0, "cwe": ["CWE-454"], "category": "external_trusted_var_init", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c63088f261236a720e172e0f0de9481b5d137734c1eb9d3ad9777a5b7c729a3", "structural_hash": "85c5ba387d62dcbb2f6be79185cca5ed9a23d69999d85e0e18a0c41d29f1aad3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03057.java", "upstream_id": "BenchmarkTest03057", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(fieldValue)); }\n catch (NumberFormatException e) { data = fieldValue; }\n URL url = java.net.URI.create(\"http://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL();\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n try {\n conn.connect();\n conn.getInputStream().close();\n } finally { conn.disconnect(); }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a11cb76074202aad19a8ed35e18eabaff1ee917d1111f07595a0af93b805bda", "structural_hash": "0bf92dc29bbc425f014df6d3adabb2522c232fd725d0255af7afdbaa532755d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00787.cpp", "upstream_id": "BenchmarkTest00787", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a89c4d812ec926afabb7b5f79579760eade7bc23014ea633ebdfd2c7831feff5", "structural_hash": "d723ad60df5a32e2db609e96ef1371110ec9b89e34085b25b6f64f025974161b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03510.rs", "upstream_id": "BenchmarkTest03510", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let _prefix: String = env_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => env_value.to_lowercase(),\n \"f\" => env_value.to_uppercase(),\n _ => env_value.trim().to_string(),\n };\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "819acdee168afccc231ffc8c4adea56818520ff348c1cf8c69d4f1eecaa931c0", "structural_hash": "a883bae90f196afd3062417274264c1502954c33c1555a739a4918eea56e3d03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00015.py", "upstream_id": "BenchmarkTest00015", "language": "python", "code": "from flask import Flask, session\nfrom flask import request, jsonify\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n data = f'{origin_value!s}'\n session['user'] = str(data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf860210b5a41ce7c8609f84efc5ab91142853f86e64d897193ad88855bf8c7e", "structural_hash": "f33d01e96b49d91143b0cc90a05636f841981cb4e8b72fac64bc62132513e431", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05987.ts", "upstream_id": "BenchmarkTest05987", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n res.cookie(\"session\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40e61a8127afbff198647d1fa240f59b2bbcb05547779fe34b0568c10342380b", "structural_hash": "b727b710efb9ea02f3e7f1bae118f1b7d8b6fdb3029fe2c7a08555957fe27aee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27868.js", "upstream_id": "BenchmarkTest27868", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n Buffer.alloc(parseInt(data, 10) || 0);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab268652e0d9c0caf6d48321b71496b832e427176108a2dd5808503b78c257de", "structural_hash": "4958c48110613db32b6d0747ba6176a0355084ad50592ece8ff9bdb2cd32c573", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00887.cpp", "upstream_id": "BenchmarkTest00887", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3ebdb982812a582c8833834ea98329643a8fa19250e6cd5b33a29ae60d45086", "structural_hash": "d3847c61739e29f5fa628e3f114bb146513293734c5a420ce6431a8bd18d9638", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01059.php", "upstream_id": "BenchmarkTest01059", "language": "php", "code": "header('User-Agent', '');\n $data = call_user_func('strval', $userInput);\n $valid = is_string($data) && strlen((string)$data) < 4096;\n if (!$valid) { error_log('schema validation failed'); }\n $processed = $data;\n $role = (string) $processed;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77aa8419331e62d156be16b3e73c60c55885e5950b9ba69e251add8fa6872770", "structural_hash": "990859cbaaa7dfa260cb8d72540e807af5cdc61d14284da3d23d996cc3cbfcc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02416.rb", "upstream_id": "BenchmarkTest02416", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b673be76cf9ebd215617e6d3a3f05988b3e5e6ea00eb1b554f182ceaf67ba0e7", "structural_hash": "359b793400d03de5d8a2ca849ac04ee00a6fd7c96bb116371a4228ab2b560c14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01687.php", "upstream_id": "BenchmarkTest01687", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13b4a6a32b048fcbededc4c989984a72622819455f5525541bd867ecc07de66e", "structural_hash": "62ea498129f944d3a6d271b742f0b8596ddf14e5d5335ee22daf1062c310b956", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04717.sh", "upstream_id": "BenchmarkTest04717", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n data=$(printf \"%s\" \"$user_input\")\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e71edf6f35dc2309d26caf78128db8157ec827804040ee3aec97b34eb171458", "structural_hash": "c0f116f04d3879eb9e070d653080f178c4844db7f30fc5467e7c6b93d0b0f7b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02766.cpp", "upstream_id": "BenchmarkTest02766", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5074cffbdaa76b45f4907970537e0a6f2ce4c273b39250e63ef1a99842c431a7", "structural_hash": "da2074859ba4dd79d3204c4f0804e9a3e36c8a8668d509fbe3e371285bc9fc3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04614.go", "upstream_id": "BenchmarkTest04614", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tlastRequestValue.Store(cookieValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tif data != r.Header.Get(\"X-CSRF-Token\") {\n\t\thttp.Error(w, \"csrf mismatch\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif !verifyBearer(r.Header.Get(\"Authorization\")) {\n\t\thttp.Error(w, \"unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-309"], "category": "password_only_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88968ddeb2ca0dd72d19e379597567efd3130a09197241be488c95fe17489df3", "structural_hash": "1e1a2474a77d84ee311606a7bb6e77c1df5b94c3c45497c7e08b0ba61d3dcee5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00850.php", "upstream_id": "BenchmarkTest00850", "language": "php", "code": "getContent();\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n mt_srand(ctype_digit((string)$data) ? (int)$data : 42);\n $token = mt_rand();\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a8293f7919f9d5dc2613b90e2bc31d4dea62ff815a39917b5caac9cfe4ebe9d", "structural_hash": "3f429fac0b4dbb96ed960b79c140576e292c2514a4418eada361f9733f30a609", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00189.ts", "upstream_id": "BenchmarkTest00189", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n res.set(\"X-Frame-Options\", \"DENY\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a0c600ee8ea97ba90bbbcf246ff8fa305a21fd658926757b361a57eac219246", "structural_hash": "0bc84bb909a229a663254828bc3660a92d3c9789d5c589fdbbdedc4325c10ec5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08627.c", "upstream_id": "BenchmarkTest08627", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "110597b87a9e1cbb24a91a938cbeed192cace48df3ce0e9aa0345de2ab5a6faf", "structural_hash": "e3e7f23b962f7f3086d5e4655422599d2b319b4f1073c9c401ea558fbc4caada", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02505.ts", "upstream_id": "BenchmarkTest02505", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n res.set(\"X-Custom\", processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bfd37871ce3c53ff99eadb140e09fc90851a2b5cdc4d370b153b2966c12fa4c4", "structural_hash": "51a5641860c171316a2a13d72d624fe599a148ae964ae2d2c45da7f6dedc4572", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01803.cpp", "upstream_id": "BenchmarkTest01803", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "369d356390bf24dd7002a7a1a312f7237105a3ea5858683c679eae4372f9f13a", "structural_hash": "4eefe281ce92c07a33e2d17ec5c342057eb6a54b7060c450a038f68fff7b6a75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03052.rb", "upstream_id": "BenchmarkTest03052", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"default_setting_value\"\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a950ad28f455a9d24db90b0f6625154c2562d6dc8b2dbd3112c642c4ad1e0c4c", "structural_hash": "26fda1b785346baacba0d7557b01d5c5d53068305babce107b710cf69646033c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20564.sh", "upstream_id": "BenchmarkTest20564", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _fname=$(basename -- \"$data\")\n case \"$_fname\" in *.jpg|*.png|*.gif|*.pdf) entry_file=\"$_fname\";; *) echo \"invalid file type\"; exit 1;; esac\n echo \"uploaded\" > \"/var/uploads/$entry_file\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f05db92626475c7175527b733d9637b0fb532dac123d49615ba0047e10511138", "structural_hash": "5dc37bf5df929ac21a48e6cd9f20665625b0843f767ae6f50ea19733963c9990", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05102.rb", "upstream_id": "BenchmarkTest05102", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = sprintf(\"%s\", user_input)\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce8a0e448ee03da5e134d6f3224dfe5b8b1f0e96b01d69895522e6facfd7fe5e", "structural_hash": "f57bc5f2c9c07f5ef535b9e615d5dc0f95e1ec82922ad4726d94a629a7ec1b7c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04624.py", "upstream_id": "BenchmarkTest04624", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = handle(raw_body)\n record = db.fetch_one('SELECT * FROM documents WHERE id = ?', (str(data),))\n return JsonResponse({'record': str(record)}, status=200)", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4d1c9be0f61633af628ead2cc4711e1627f2c44698d2a9cee6e7709771c3fce", "structural_hash": "0069a950607d161bb23520a829f9d6c16e24f580270a1f26aa9684fed3b09016", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16231.sh", "upstream_id": "BenchmarkTest16231", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n checked_path=\"$(readlink -f \"/var/app/data/$data\")\"\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66234c0632273ce70a650239d5c1955228acda53cce1e955e9ec94f2ced0f87d", "structural_hash": "b880de191dccd147e3d79a0e089c5ccde4ff70af8d58597629226e364b02ee46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23120.sh", "upstream_id": "BenchmarkTest23120", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n local -a _cmd=(\"echo\" \"$data\")\n \"${_cmd[@]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "984d23c4d968985e2ca3a00f6f28fa39243d489603df27331ebf0b650ad808e7", "structural_hash": "bd833f58624cf2925c7535c48057cc67bbad98bba2f6f5f138204f832ac99759", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_15520.js", "upstream_id": "BenchmarkTest15520", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-922"], "category": "insecure_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7360858d6507d9307ff3cd20c83becdda54e72255ea4651d96546892904fad62", "structural_hash": "58d1c58096177b87b7cf14d6e011a6d82536860017472bb318d916d81ff885bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01987.java", "upstream_id": "BenchmarkTest01987", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.Map.Entry entry = java.util.Map.entry(pathValue, \"query\");\n response.setHeader(\"X-Tuple-Context\", entry.getValue());\n String data = entry.getKey();\n com.fasterxml.jackson.databind.ObjectMapper safeMapper = new com.fasterxml.jackson.databind.ObjectMapper();\n safeMapper.disable(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);\n com.fasterxml.jackson.databind.JsonNode node = safeMapper.readTree(data);\n response.getWriter().print(node.path(\"name\").asText());\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a6f3cf7237cc50d8ed4c0935f5c701106640987483a216ef3c6590e594bdca3", "structural_hash": "11be806a77fd00e95c1e9b853b4832eb866e0714decd40a7a6f2b4718a440da0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03049.rs", "upstream_id": "BenchmarkTest03049", "language": "rust", "code": "use axum::extract::Path;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(Path(path_id): Path) -> impl IntoResponse {\n let path_value = path_id.clone();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(path_value.clone(), |s| s.trim().to_string());\n let requested: u32 = data.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "277a22409bc418a62d878d99959c7de81180948b2e6f7dad8529d3ece49cb6f9", "structural_hash": "563e2b9e0ac121f52aeb08fcadf65c59695cf63c82c4458b0a641897574e28a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05799.ts", "upstream_id": "BenchmarkTest05799", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5ddc8c4ad2abd8aea9f8348d3b7d0755280cec89b373883bfeaff05adb812b9", "structural_hash": "5d32b0cb7db8fcabd93a18a02414ebbe3f0245bce1d20232089c5a9bd8bda0f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03611.rs", "upstream_id": "BenchmarkTest03611", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let captured = comment_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "299d5e54f95e9c44422da25552aad9496de37cdc2e4c1861913b937cb95b2bac", "structural_hash": "f28b1406a39c89907064194a75ad383661bfabd714dae9e641d1c83491009c5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08768.js", "upstream_id": "BenchmarkTest08768", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const fileContent = fs.readFileSync(\"/var/app/data/\" + userInput, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "117233114ea3c28c83dfc065ab277a82e5b543bd4810c620d01ad0659f3d08a9", "structural_hash": "61e6c8617791b1cd80454505d663339f9b5a788e3d809019866d384541c04886", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10833.js", "upstream_id": "BenchmarkTest10833", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "deec726fcd224d348535cf9f2cd7a1a2809bbb207b7d01b11a05d34802360292", "structural_hash": "0d72868b64c4bc2685309e096496ec304951a16c1cf9ddba81fbbf2f50947985", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21514.js", "upstream_id": "BenchmarkTest21514", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27e1dd370decc95ed655f07936633bc9dcaa7c02131b079ea2cd187651e09211", "structural_hash": "f80309aaa7460dc7195e411f98af188409c79bacd414d9f0cc540f7ab52a15b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06196.sh", "upstream_id": "BenchmarkTest06196", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _host=$(echo \"$data\" | sed -E \"s#^[a-zA-Z]+://##; s#[/:].*##\")\n case \"$_host\" in \"[\"*|\"\") echo \"private range blocked\"; exit 1;; esac\n _ip=$(getent ahosts \"$_host\" 2>/dev/null | head -n1 | cut -d\" \" -f1)\n _ip=\"${_ip:-$_host}\"\n if ! echo \"$_ip\" | grep -qE \"^[0-9]{1,3}(\\.[0-9]{1,3}){3}$\"; then echo \"non-ipv4 host blocked\" >&2; exit 1; fi\n if echo \"$_ip\" | grep -qE \"^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.)\"; then echo \"private range blocked\"; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1437308da75280be41045d43bc29402f287b5407aa89e441ccf68f46143ef60c", "structural_hash": "e2bcb499fac19bc192f8ae0fe357ab3aceb20671a5aea81fe4168e3bb9759608", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01077.rb", "upstream_id": "BenchmarkTest01077", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n payload, _origin = user_input, 'http'\n data = payload\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => processed}).first\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7aa2026df76f686c41cb1f27a1966cbc29a229b7ceeb6623ddab2d46896474d9", "structural_hash": "14e1ffb33b8ab1e4c3c2aeb8b7b56780f19d26003710a3fe1489f62db837f764", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02861.py", "upstream_id": "BenchmarkTest02861", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport json\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = json.loads(db_value).get('value', '')\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b81065f830273bcc770a377377f1f694aa343b029fb37c6ac5546f40d6e96a1", "structural_hash": "731dc813917a45c3cde26de72bbfe31a347717da808d39229174bea928a57c4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01606.cpp", "upstream_id": "BenchmarkTest01606", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8a6313f0c3018af07e7cc6e6062bfa961b877a1bcc5f4ff1f4806abf2e7116f", "structural_hash": "e0256568c2dacb49bed8bdd8b020541c9aac0401d19ad79ece6b9db0aefb22b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_31246.js", "upstream_id": "BenchmarkTest31246", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nconst zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.send(nunjucks.renderString(processed, {}));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8f9bb62c2545e0d51242299331deaed55e3d01f37e32064b3f2da2aa66fad93", "structural_hash": "842f66fd945421bd80378f62e321b97be431fc5f8d242fc4611a99be5d97406c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05276.ts", "upstream_id": "BenchmarkTest05276", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n res.set(\"X-Custom\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98fbab8c68b7f4d4de9c7cfc6d18a9ef46f145386a2d57d0206d4a9682ab6f54", "structural_hash": "c31b7ed9b6171827b93b7210ef480a3236c5b4e472dcf32b073f7e4d53d829f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00998.cpp", "upstream_id": "BenchmarkTest00998", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::system(data.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2ba21978649d2f0dfec3d1318da190b5c6e2ec7fc55a5ee9224db7604d036a3", "structural_hash": "4e4f102db82049c8afd5a975913a4e7f88ac81b1cf77e9a6859b22ab01a62b9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02183.py", "upstream_id": "BenchmarkTest02183", "language": "python", "code": "from django.http import JsonResponse\nimport os\nfrom urllib.parse import unquote\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n data = unquote(user_id)\n os.setuid(int(str(data)) if str(data).isdigit() else 65534)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51e656eb333d48115e43abca9a4dc5ee58c77ef477c3bd8596bb77eb2f99314e", "structural_hash": "9644c1896ee29769e076ffb31366433af44edccfcd7fc91ed9f0c4dd02b3c3fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28365.go", "upstream_id": "BenchmarkTest28365", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tdata, _ := url.QueryUnescape(pathValue)\n\tif c.GetString(\"user\") == \"\" {\n\t\tc.String(http.StatusUnauthorized, \"no session\")\n\t\treturn\n\t}\n\tc.Set(\"data\", data)\n}", "label": 0, "cwe": ["CWE-454"], "category": "external_trusted_var_init", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ec3b700aca03ac5f1e8049694e0d32c31ec205b189302ba07de363794882e88", "structural_hash": "a50c402ffef01fa2782036f0d7b38c379924532b59968b9ce6b769d72f75250b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01282.py", "upstream_id": "BenchmarkTest01282", "language": "python", "code": "from django.http import JsonResponse\nimport re\nimport ast\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n try:\n data = str(ast.literal_eval(user_id))\n except (ValueError, SyntaxError):\n data = user_id\n if not re.match(r'^.{1,256}$', str(data)):\n return JsonResponse({'error': 'schema invalid'}, status=400)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return JsonResponse({'authenticated': True}, status=200)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c20ed83023eb8562d120efc92b219a0da9f69bfa1d77fdbb6ce4170387124f27", "structural_hash": "de6c80996f7adbc1db6f5d2740a5ea6b18666311ed0f5a1c03e8be95047bf1c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00420.js", "upstream_id": "BenchmarkTest00420", "language": "javascript", "code": "const fs = require(\"fs\");\nconst os = require(\"os\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const tmpDir = fs.mkdtempSync(os.tmpdir() + \"/app-\");\n fs.writeFileSync(tmpDir + \"/data.tmp\", String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afa81d9a427efc976edb12d714734509e06470105b7db9d9c9fbc01d377e5857", "structural_hash": "5091020893bbbe81d0691a94d16cbbbb3e39ca51cc34c7ea498db705b08376e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00818.ts", "upstream_id": "BenchmarkTest00818", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n shared.authCheck(String(data), \"admin\");\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61ae5262c4cc28b5e3219a9516b49a316cfc134b3cb5a7c15a9a5bd86698c143", "structural_hash": "8bb07bee246f32a592a2aa913478c95206a22628ee4ec60fa46fa6d5fd4122c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04096.ts", "upstream_id": "BenchmarkTest04096", "language": "typescript", "code": "import { Controller, Post, Req, Res } from \"@nestjs/common\";\nimport { Request, Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = (req.body as string) || \"\";\n const data = String(userInput).slice(0, 200);\n res.set(\"X-Frame-Options\", \"DENY\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86202e1a9387cc059a228c8981d4e58acf5d0e13b2b5d22f2280b340c73773f9", "structural_hash": "2e9b3adac75fe280e96591d85431b4fc3ac1fdc9941a97b6d96f51a4f79be753", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02432.py", "upstream_id": "BenchmarkTest02432", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n multipart_value = request.form.get('multipart_field', '')\n def normalize(value):\n return value.strip()\n data = normalize(multipart_value)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n trusted_claim = str(processed)\n return jsonify({'trusted': trusted_claim}), 200", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11761eb821713f3d1c123dd8f7479e3f6e300b384352310bab741684a698f87d", "structural_hash": "5ca04249b05bcfee0bbebb910f5f448efddd59bb06e866b2e8eca789eb8c586e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03149.rb", "upstream_id": "BenchmarkTest03149", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n system(\"echo \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6828c876eaacd47126139067e4a1951c3c34fb1c27f4568b16fc54fee76fac81", "structural_hash": "15a7598f7a7727b1085d0aeeb9f47d3e13d308ce04e5122454095d15355578b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02562.java", "upstream_id": "BenchmarkTest02562", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + commentValue;\n String data = valueSupplier.get();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1553cee3437b90c144357b49bb2cc3d76c48f39afc7e0b81c85a4bc3c693dd79", "structural_hash": "adce380a9ad560c53216b0439572afc9d909a368388b68b3d5f49bde2eccd4de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02298.py", "upstream_id": "BenchmarkTest02298", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n data = ' '.join(str(graphql_var).split(' '))\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n return jsonify({'status': 'ok'}), 200, {'Content-Language': str(processed)}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "487438fd52e932fc01d3165c972481bfde6bef7e49adfdf67bae2bb246bcd3eb", "structural_hash": "337fa28248c2d05e02a2bfe10f889c2c3b4e159a091f5ff822b71bff4b1ffe8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00413.sh", "upstream_id": "BenchmarkTest00413", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"${user_input:-default}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n eval \"echo $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "726c4767bae4013d5813cf7b38b563db1043867d1e57de9f9e812ce33378ffb9", "structural_hash": "0a0d9d4319ed302bfd7cac238f67cf31a1847ff5fb8fe847ffb21c9fabcb7917", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05941.rb", "upstream_id": "BenchmarkTest05941", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n data = CGI.unescape(user_input)\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + data + \"']\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3fc2f2d2cbf8e344b28a6e7001efe320c79b6c6f3ce9392c63f4e74f03a05870", "structural_hash": "4cb6b587c8a4a45670bbc93b345199cb10c81121a7a977222327cdf4292a41c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02808.rs", "upstream_id": "BenchmarkTest02808", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n data.push_str(&json_value);\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f61b8c401f39ab832e4bb9b7c2bf4bcf74c1d3b8346f5fbc30a3a3b214812c01", "structural_hash": "49f55ca979b2ae2f925af4d1e491c534859d88f5de7129df0ae984262cb021fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02863.php", "upstream_id": "BenchmarkTest02863", "language": "php", "code": "getContent();\n $data = (!empty($userInput)) ? $userInput : '';\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01036ad0109999c7e0b76ae48e473cd0f8bc9ab68d211491e3a6e1ab97cecfda", "structural_hash": "1dd678917cbb12c40ad9860f857686d975c596669078d6cfdf3c3d38f61d6544", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05400.rs", "upstream_id": "BenchmarkTest05400", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = origin_value.split_whitespace().collect::>().join(\" \");\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e4e316d1edfb846958e205cb7de64248986972096a38787849ee3028bad599b", "structural_hash": "716e6473d11862d18a3e2502e882d5a4465a187c3414e1e0c1baecfce9ea051f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05358.rb", "upstream_id": "BenchmarkTest05358", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n response.set_header(\"X-Frame-Options\", \"DENY\")\n response.set_header(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a93a6f85ebfeed39a067d4c9107e12ce6f65c227f339bd0c563fb08f3335856f", "structural_hash": "5e882c1f92bfd86317ae9c1deef143b02f5a797ca2416dfcad3ac2f8fb32493e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33042.sh", "upstream_id": "BenchmarkTest33042", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n case $data in config.json|index.html|readme.md) checked_path=\"/var/app/data/$data\";; *) echo \"forbidden\"; exit 1;; esac\n echo \"uploaded\" > \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "167a403fb9fd541d45232074d687125e4408092225a88cd8ceaa1dfad629c4c4", "structural_hash": "d8d68a8d90690eef14e3b814396b9d9f30aafef609670116ce17a7156766f101", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02525.cpp", "upstream_id": "BenchmarkTest02525", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data = cpp_own(user_input);\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44e519bc864d14e2842806bbd34ee652291ac28a37ef86a5d761c2f5f06759b0", "structural_hash": "f8679f67be6be76b5b8b5d725b3becbebd4b2d7c343af7eb0ffc7af7b0162359", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03596.py", "upstream_id": "BenchmarkTest03596", "language": "python", "code": "from dataclasses import dataclass\nfrom flask import Flask, request, jsonify\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n form = FormData(payload=referer_value)\n data = form.payload\n buffer = bytearray(int(data) if str(data).isdigit() else 0)\n return jsonify({'allocated': len(buffer)}), 200", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ac1d88535a0691dc8b92a15a8f933f085de7a4b4036702986431d49c677b691", "structural_hash": "d56116dc0c6ccfe7f9b0aaf78b714e2d9e7331e147701b42f9b3384f7fb2dfbd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18810.c", "upstream_id": "BenchmarkTest18810", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n long _n = strtol(data, NULL, 10);\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7155dc439c5954604dcad847b0e49eb5c443e2cc27e444a9689fdb3193d5fe6f", "structural_hash": "64a606eca5da7857c9f495389a7f771f93d46d28cfa209a5ebdcd6035c1b283e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08049.c", "upstream_id": "BenchmarkTest08049", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n long _v = strtol(data, NULL, 10);\n if (_v < -128 || _v > 127) return;\n signed char _c = (signed char)_v;\n printf(\"%d\\n\", (int)_c);\n}", "label": 0, "cwe": ["CWE-194"], "category": "sign_extension", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sign_extension", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5a4c75149920bc260c5e94cae13d6c55f98eedda1c50bc09627f5123018ac10", "structural_hash": "eafb76d1c7f6a372dd500bcc16d9fe7a90698e7b7da2db4701eaddf61834ab57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00201.rb", "upstream_id": "BenchmarkTest00201", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n _buf = \"x\" * data.to_i\n _ = _buf\n render json: { result: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd1bdefa15dd9849ddf70ce35fcbf9fc46082a45097511bfc74c71b788eee2ce", "structural_hash": "1f13192ef71454905fd7c5a07c01814479c62dbd56878427ce63e4bebf0008a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12314.go", "upstream_id": "BenchmarkTest12314", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata, _ := url.QueryUnescape(fieldValue)\n\tparsedInt, err := strconv.Atoi(data)\n\tif err != nil || parsedInt < 0 || parsedInt > 2147483647 {\n\t\thttp.Error(w, \"invalid integer\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tboundedVal := strconv.Itoa(parsedInt)\n\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(boundedVal)\n\tif idx < 0 || idx >= len(arr) {\n\t\thttp.Error(w, \"index out of range\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tw.Header().Set(\"X-Lookup\", strconv.Itoa(arr[idx]))\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8644947f3b624fd104e4297e564c819bafa121c18606dbd0fe015c6cff28fd97", "structural_hash": "04f4fa31c37b4558c0d89e0a8ad0942cc7a6f257a5b999aefba0aae6b8f31dc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05271.rs", "upstream_id": "BenchmarkTest05271", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", ua_value).ok();\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47af2bdd7172c10a4514daf1670898d608995795ff76aa5c793c360e98a0bbf3", "structural_hash": "0778bb6d0ec2a0a3bfadfb5a6ccaf9c3db824dad1a1e44487ef706ed17b9eb4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02425.c", "upstream_id": "BenchmarkTest02425", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7720a10956a8b8ef6013a03e8571eb12bea3e098cde07344a7004ad17b111246", "structural_hash": "4fc29af821b50b6dde5f2b47a06e22c34ea8d7eb7bea947089cbc391ef4a6e23", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01968.rb", "upstream_id": "BenchmarkTest01968", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n File.write(\"/var/uploads/\" + data, \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b484cf407c7b0569ad1265d9a26bfa9c4e7dc2d5253031b3b15ce87447e0010c", "structural_hash": "0039cd9556ed185f2b47c7d52acd86e0bcab67255a728c118706fd00037bae0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_23802.go", "upstream_id": "BenchmarkTest23802", "language": "go", "code": "package testcode\nimport (\n\t\"html\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\t_prefix := \"\"\n\tif len(uaValue) > 0 {\n\t\t_prefix = strings.ToLower(uaValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = uaValue\n\tcase \"f\":\n\t\tdata = uaValue\n\tdefault:\n\t\tdata = uaValue\n\t}\n\tprocessed := html.EscapeString(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24fb11688e821cd502c73be5b53f45b6090fddcb90cb4daf04b38b5e572adc4e", "structural_hash": "3fb0c81f761017c151fbf8c121d72882f29bfedda1a0945aaa5b6c9dc0d7101c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13319.go", "upstream_id": "BenchmarkTest13319", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(rawBody), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\tquery := fmt.Sprintf(\"SELECT * FROM users WHERE id = '%s'\", data)\n\trows, err := DB.Query(query)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-566"], "category": "auth_bypass_sql_pk", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef74301b283110670788fdf2aa5b9c45a4c61dd81556c91024e1bc0554688fc2", "structural_hash": "0865ee6817a4a55215aa51bbb2747d895c9ef7a66420afd75e509de0df863fdb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00148.php", "upstream_id": "BenchmarkTest00148", "language": "php", "code": "headers->get('Host', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec53c3e67ada558cc46c06e3bb9af507db5dfba3f67d0073582825a1f20314db", "structural_hash": "6da9d63f34dcb057a785d302aa53ac6c09a178cc3e8908c7379729c4c7920ac6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01768.c", "upstream_id": "BenchmarkTest01768", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n unsigned char _digest[16];\n MD5((const unsigned char *)data, strlen(data), _digest);\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "234a7daaa72ec34c398e548887633b282e3e336fce7fc5ff307f19e603cda0ec", "structural_hash": "1153baeaa238bf46dc81cd4a0a662a465549a536e5e5c5508c858d947bd31590", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03657.ts", "upstream_id": "BenchmarkTest03657", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport * as nodeUtil from \"util\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Req() req: Request): Promise {\n const userInput = cookieToken || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n if (!shared.authCheck(data, req.session.token)) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b377c2c39cd7ee0a076cbe379214f78c65e6fb0aad7566e951d0bcb4f75887e", "structural_hash": "1baf9ea4349e2a39018a0cbb040a9b95a4d3b6a897c385404fc28286e7d8bc9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00234.ts", "upstream_id": "BenchmarkTest00234", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n req.session.id = String(data);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45e61bdc4fc79b6496ef776029de304b761c6db85b40400348ed4b550d2984ff", "structural_hash": "154bed1253c5d3b7fa1b60ac9a9fef354f7edf075c052fae8cdda250001d10c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02698.py", "upstream_id": "BenchmarkTest02698", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n data, _sep, _rest = str(referer_value).partition('\\x00')\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Access-Control-Allow-Origin': str(data)})", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e36d83bcf5bb6b62da405b9e2bf9210647c666bf4f291e86511403e6edf87988", "structural_hash": "1d61e55bd9796644b1f7aff6c9a4be50a01bf126c86dcc9862e90f42b9fe4361", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32241.sh", "upstream_id": "BenchmarkTest32241", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "278a86b5444b8f2199bfdcc3b3f3ef0a77c52adfdefffaa951318812fe0c65f1", "structural_hash": "e105d33ce10a3999f3f223e16246bb6a979e31fda49548270fab01b9cde3066a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03543.rs", "upstream_id": "BenchmarkTest03543", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (xml_value.clone(), \"http\");\n let data = payload;\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c5ab4598607fea80112bfcc2da0e36e953e8f4fb25952e5170837ae14a4284b9", "structural_hash": "e28074b0e79065027af40bdfc8162c632c34a082c95a8f96c5b52b7567203a69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33979.js", "upstream_id": "BenchmarkTest33979", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8afd148914af45374bff36aee6cad35f6c50084a77c9729613dbaee0812a1861", "structural_hash": "a62c22f26b11aba58a999a8d9c0428e914884d20aa11449544f41a5d709574e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04944.ts", "upstream_id": "BenchmarkTest04944", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = String(userInput).slice(0, 200);\n res.redirect(data);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd5045c56aa63af79166334fdaeece13fcc2c3ba7ee7d0d05ebdfbf5532db536", "structural_hash": "27a7d4e4ff7b9b1b770a72c2c7639a7cbb5aa4c14db4e3d1805820fca069017c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01950.js", "upstream_id": "BenchmarkTest01950", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = `${userInput}`;\n if (!authCheck(data, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-642"], "category": "external_critical_state", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "820d3d2b2935f3e3e299bea1f669a5d4998c2dc70be291d0736ca425b7b4384c", "structural_hash": "71ce87a1e25aec170451b6867ed3a5ddeaf3ffc189426b0e0e0de67a436b41fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_05956.js", "upstream_id": "BenchmarkTest05956", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (!authzCheck(ctx.session.user, data)) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45bafc79aa622285cbe33ef889c451aee72917ff494f1d577f595b726373b8f0", "structural_hash": "634fafc67eef2797d75ad6ae5ab11e7f62148752e42fb61959d84f683c154270", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00500.ts", "upstream_id": "BenchmarkTest00500", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0dff6588c453ce1e1251c0a2afcb6d950c6f5e11498764f8850ef63ebfee5b8c", "structural_hash": "0ee49d32ef30fd15f9fc40df1c5d95385aec518c6840c9831bed5bff21310ef1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_39821.js", "upstream_id": "BenchmarkTest39821", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = passthrough(userInput);\n console.log(\"Action: \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23492d2a42462f556803b29fff0c04ed697043684eeba12844ec80218220a6e4", "structural_hash": "7bb5569f8a16a4f77b4b0977c0e9130c48549ffc2c0878d38fbaa426156cc607", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_38037.go", "upstream_id": "BenchmarkTest38037", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\t_prefix := \"\"\n\tif len(uploadName) > 0 {\n\t\t_prefix = strings.ToLower(uploadName[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = uploadName\n\tcase \"f\":\n\t\tdata = uploadName\n\tdefault:\n\t\tdata = uploadName\n\t}\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28d2a4d22b53d69bca76428db77d6453945b2993ac67257e61b23c9d904c2246", "structural_hash": "47cc3c6f579a4cd9a9efdc25a84d8e4589caa19ada04b90a32381a3e1cbc4ab9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02571.php", "upstream_id": "BenchmarkTest02571", "language": "php", "code": "header('X-Custom-Header', '');\n $data = vsprintf('%1$s', [$userInput]);\n DB::select('SELECT * FROM users WHERE id = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0859675b0f79d73721bf416e0fc7b05f99b609ff407f93e73eb46555c92df9f", "structural_hash": "93d5d1540750514576c329a95792e56387ef717a3d5d9d4f07967e3bfa123c7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03653.java", "upstream_id": "BenchmarkTest03653", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n java.util.List tokens = java.util.Arrays.asList(uploadName.split(\",\"));\n String data = String.join(\",\", tokens);\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1c6f2a0fe1eb38b773940676911fdc49d13c044c43a41b77576abb259939a78", "structural_hash": "ed883a63d38a8aa40fcc2f911e35f4379235040e489dba4679afe7db9e6d5b56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02525.py", "upstream_id": "BenchmarkTest02525", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n data = handle(upload_name)\n db.execute('SELECT * FROM users WHERE id = :id', {'id': data})\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bbce348133d2776d540f2070e7ce9cd7e02a3b676c814c7fced16d0f00372806", "structural_hash": "e09f78da1e309d12e979cd499e53c0a1fc84ac839f47112309a61ec711578316", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01049.sh", "upstream_id": "BenchmarkTest01049", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n echo \"$processed,data,row\" >> /var/data/output.csv\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04461da46bd8478069ac5f38bed37e5f5ab18eb850b16bea1a43e2ed33e708b0", "structural_hash": "7a81ddd41e5596f824284556545c388dddad8ad5f0c14e7d3aa090c555948866", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02562.py", "upstream_id": "BenchmarkTest02562", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n kind = 'json' if str(auth_header).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(auth_header).strip()\n case _:\n data = str(auth_header)\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return jsonify({'error': 'invalid integer'}), 400\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return jsonify({'allocated': allocated}), 200", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7de13d4405c032f1d4caa3b4bb201176a52f802ceefdd114a5cc8a6ddaf0fe1a", "structural_hash": "c195c5574cb1337a488a55ea8e18a881dfc9912ed06b4c7099ceab0a874e9f62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05736.py", "upstream_id": "BenchmarkTest05736", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n def normalize(value):\n return value.strip()\n data = normalize(json_value)\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n return render_template_string(processed)", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80cab277fabd51fb7dbfa8a563e321bd107208d3df127a6a9b8dbe941eda34e0", "structural_hash": "6e23ac45625c854615e289e0cc8aee02bc24208e4ce2f4897ad9979b3eeabede", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17070.js", "upstream_id": "BenchmarkTest17070", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const data = \"\" + userInput;\n process.env.APP_USER_PREFERENCE = String(data);\n ctx.body = { configSet: 'APP_USER_PREFERENCE' }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "745faadd2e2983bda634db023513dcc3bff1bf732cf28d4c179412597fa993cf", "structural_hash": "e3dd4f0152d7f761c6da13d1f411acd14c0edd1161baa6a96854a1d46b248760", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05541.py", "upstream_id": "BenchmarkTest05541", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n parts = []\n for token in str(cookie_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "327aa0db3a90e8bd81814750b65f930fdc4fa82abda267a4f4e2edcaa466541f", "structural_hash": "bcebe7b634febc5383bbc7bd239ebd4a0826d06de682db957b5f78c193156b68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01796.cpp", "upstream_id": "BenchmarkTest01796", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63e3563b7814b4260a1bbb96903ddd21678860a26c79f36433e130b6f7a0e30a", "structural_hash": "5d636828686cb26316a09ca4b51b4fb2f79e170022ad725d5990dfc9289ba873", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07594.c", "upstream_id": "BenchmarkTest07594", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_PADDING);\n RSA_free(_rsa);\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "deff3f8bed200666bdd05d4cc84c95d9116f7ae86e10459a0e1eeda20689979a", "structural_hash": "e07f40f2974f44c5039c5b64d432fc080887e051c34f2c5dcd71307f204064ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20189.sh", "upstream_id": "BenchmarkTest20189", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n mongosh --eval \"db.users.find({name: '$data'})\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2af4f221c913883416775afb5a639f9387c413e9f41afe91105d44ebaa6b6752", "structural_hash": "763f25f294fc4f19be17a28057ece47c542be2460196495a00ffd475449259bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04290.rb", "upstream_id": "BenchmarkTest04290", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n render html: (\"
    \" + data + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bbf46642c5b92ce09ca256b867b6a8969cf69029fb4698ea5b7b37790196e99a", "structural_hash": "4cebaa986cfc59a8aa70daf973e96a79da82ead33d0336b8d41ee34d8e920423", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_28619.js", "upstream_id": "BenchmarkTest28619", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = `${userInput}`;\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e83987761e2876d942d8f02e7412170b1cfcbf9656cd7d067a61ab3e6f615478", "structural_hash": "979574375207cc08733b68c0987c1001cd018d71675637cb3d82c5f5f2d90a90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00358.js", "upstream_id": "BenchmarkTest00358", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n try { JSON.parse(data); } catch(e) { ctx.status = 400; ctx.body = {error: \"invalid\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "187eb80709d10a4cc0adf2c2803de068e0474bf7a2236d8625c5964174c7df04", "structural_hash": "a70c7fba64f4c3730ce0387bd0ae9e55299a708558cbeece02c97d410b09f896", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00671.c", "upstream_id": "BenchmarkTest00671", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e069a6c46d6d09f6764ecf4bc7054e953a1fd95689fa750d7e4013e470f08be", "structural_hash": "5a5e6efeb79250d19be02be0d49556c42c8de3157c3e317a6665323f9d0a5c6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02699.java", "upstream_id": "BenchmarkTest02699", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = xmlValue.isEmpty() ? \"default\" : xmlValue;\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { response.sendError(502); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8e99b55d78c44fca1ef7bdf77445a95c9a26da7848c9ed2c574fb748fa5f0cc", "structural_hash": "2b405c3297d0aa6ce11a8519793f61a15fa433f6b8348069dedc70b932676c56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04928.py", "upstream_id": "BenchmarkTest04928", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = raw_body.decode('utf-8', 'ignore') if isinstance(raw_body, bytes) else raw_body\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return jsonify({'error': 'invalid integer'}), 400\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return jsonify({'allocated': allocated}), 200", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd025acd3fd20f4efce285183642082b0ab3ab5c5c9bbbdf311d14e23611d68c", "structural_hash": "cfb6527ecf30f91523c8181ef14d32da8a3f2d437fa7cb1ef34d948474dfb8f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02470.java", "upstream_id": "BenchmarkTest02470", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(authHeader.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3a02602873474a550809fb4965c060cf907ccba98bab32ba9c651b016a07cd1", "structural_hash": "b21b3cc6c0d3b3c1e4d947e7b7b101ba68a49602a009d5e55bc8f7ee1467ac4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00199.java", "upstream_id": "BenchmarkTest00199", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { APPLICATION_JSON, TEXT_PLAIN, TEXT_HTML, APPLICATION_XML }\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{rawData});\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n response.setHeader(\"X-Forwarded-For\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22edeebf36666ccf7a2cf13391ae9623e686ed1869f3d58be8c985d3948d4f56", "structural_hash": "26fbd8a6f24d093292432189ef6e20cc0104b126afae000c985a47d6b0b7bb3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00686.cpp", "upstream_id": "BenchmarkTest00686", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n char _dst[16];\n if (user_input.size() < sizeof(_dst)) std::strcpy(_dst, user_input.c_str());\n else _dst[0] = '\\0';\n std::cout << _dst << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0fd6451b5e2e1ec44a5e563ea5458788d34d4ccee19a753d365339f1f1b9bc3d", "structural_hash": "13c3bc0fde7ae2882d768d8d6e35edc0deec19d504166384ab97237e4f81c6fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02121.php", "upstream_id": "BenchmarkTest02121", "language": "php", "code": "input('field', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $cred = getenv('APP_CREDENTIAL');\n $_match = hash_equals((string)($cred), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "804e2dd421eae124d1099d38c40a70c643b471e1c22c66b2a4ce9a8c6530a02a", "structural_hash": "ffed41c2b676052a3aa2ad6f0f6dfb79c9f527265b8efdd4fd4f8a84a837f926", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01534.py", "upstream_id": "BenchmarkTest01534", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n pending = list(str(xml_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n return render_template_string(data)", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "397d732757015a1b9940e37637c92f55b4625786a738ddd19fad9602341896f6", "structural_hash": "99ad146b6e23802689006a7184f9b263b70ea2df4720ab28b6d29711b1a4eba3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03589.sh", "upstream_id": "BenchmarkTest03589", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config.yaml)\"\n data=\"${user_input//$'\\x00'/}\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9750cb1e0ea7a35a6154f70c1005227ed09952c12bfab6ff6032f2434720648", "structural_hash": "655c391b427ceb98c1eefd75d6ac8f4edc3fd66b97f865c74648579027ab3a60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03614.php", "upstream_id": "BenchmarkTest03614", "language": "php", "code": "header('Authorization', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6296a5f0c8ce618889e4c64d2e096fa84538fd1dab8584d04d13ab1c7c9c3d9b", "structural_hash": "683fc4f36e85df7ef31f11dc9ebf5df92d609c5c1acae00ed398f7555d49487f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06589.go", "upstream_id": "BenchmarkTest06589", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvar data string\n\tif len(uploadName) > 0 {\n\t\tdata = uploadName\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tw.Header().Set(\"X-Custom\", data)\n}", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f52054c45f787e6b9560d14333d2914556554edcfd878fdab1256a4f175874a4", "structural_hash": "8e7f35e1852e18b15ea1dad352bd6f38cc6a99327e5d81eaff391550581d8e51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19974.c", "upstream_id": "BenchmarkTest19974", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", safe);\n system(_cmd);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0a33c8ec6bb0c000d955ec1a4130159c451eadd68669e6f3a6be7b8498f18b9", "structural_hash": "f3286939f60c198cc7eb9d98b4f351a9fb22442558225a1c28bfd0afaa2ff49d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01098.ts", "upstream_id": "BenchmarkTest01098", "language": "typescript", "code": "import { Body, Controller, Post, Req, UsePipes, ValidationPipe, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Req() req: Request): Promise {\n const userInput = dto.payload;\n const data = await Promise.resolve(userInput).then(String);\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c590ec6962b8fe63766ca5f38596b4158e6b45fe6d932c2b63f63835687b04d", "structural_hash": "b03e52074cd42e3859bafb030efeec7c42dcea0c3dd5dc74649e57677619dc67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03352.py", "upstream_id": "BenchmarkTest03352", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request, path_param):\n path_value = path_param\n kind = 'json' if str(path_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(path_value).strip()\n case _:\n data = str(path_value)\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return JsonResponse({'error': 'invalid integer'}, status=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JsonResponse({'allocated': allocated}, status=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f67c02d5db30a5c0b7107445ff3735e534cfacf2a79f32c5d1b97a714b617bee", "structural_hash": "c51ffce682db34d60768d3bb7f2f8a3dc0803d5806a06e8826996e269acd3084", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32228.sh", "upstream_id": "BenchmarkTest32228", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n chmod 777 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc7ded48970684f84aac23246017a7ce97b18cdd9754d50a5b558ceff5f9d16a", "structural_hash": "477bbd48db5a8c740b62ecd6efacc2277065d2cf5ff2bdd094becda1ba7c4964", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02121.py", "upstream_id": "BenchmarkTest02121", "language": "python", "code": "import bleach\nfrom flask import Flask, request\ndef ensure_str(value):\n return str(value)\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = ensure_str(referer_value)\n processed = bleach.clean(data)\n return '
    ' + str(processed) + '
    '", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba3dceab416679f697b5e56db97eecf6eb21287dd32cdc4c70e0b8331343e592", "structural_hash": "9fa6bdcaa7a298c2e4b59d291c221e84b84bdd013082abafda5fc6bc20967358", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04751.php", "upstream_id": "BenchmarkTest04751", "language": "php", "code": "request->get('field', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!hash_equals((string) $request->getSession()->get('csrf_token', ''), (string)($request->headers->get('X-CSRF-Token', '')))) { throw new HttpException(403, 'csrf mismatch'); }\n $conn->executeStatement('UPDATE users SET name = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d7d747e0cb25842000648f89b8a8a4b438364abcdae5c6c865c19ece79db436", "structural_hash": "be326c4611835cb42154c3e41d3648b776cc42e4c5d9c2cb847f05a7accaaf82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00336.rb", "upstream_id": "BenchmarkTest00336", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"base64\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n data = Base64.decode64(user_input)\n unless session[:user]\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n Rails.logger.info(\"error: \" + data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28adc0925989de1b5fb4a6deb8ca2e5a4fb92a885394b45d5d486c4dfc91bab7", "structural_hash": "036471844a1f0c354320d07d8a1c0d6618360dcbb9e90b032179b7d0c6697c1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08718.js", "upstream_id": "BenchmarkTest08718", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n const role = String(processed);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a00da60e62b414480cdd7bac7583a4ed5521ec5e71bd4d3a4e37f7105682738", "structural_hash": "bb5bd1f097987f63b4c7b0b755d97195fff090cf7be30d01d3a834cf995a65ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05013.java", "upstream_id": "BenchmarkTest05013", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference sharedRef = new java.util.concurrent.atomic.AtomicReference<>();\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String dotenvValue = java.util.Optional.ofNullable(System.getenv(\"DOTENV_VAR\")).orElse(\"\");\n sharedRef.set(dotenvValue);\n String data = sharedRef.get();\n byte[] passwordSalt = new byte[16]; new java.security.SecureRandom().nextBytes(passwordSalt);\n javax.crypto.SecretKeyFactory skf = javax.crypto.SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n byte[] derived = skf.generateSecret(new javax.crypto.spec.PBEKeySpec(data.toCharArray(), passwordSalt, 100000, 256)).getEncoded();\n response.setHeader(\"X-PBKDF2\", java.util.Base64.getEncoder().encodeToString(derived));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4994e07db3f7154b94aad48d56e11f640614f9b9599c28218e795ecf99d66ff5", "structural_hash": "35a027d4b0542d5d90cda22a320d1c9ba89266d2e517bacbc4d16b448a448eae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00168.rb", "upstream_id": "BenchmarkTest00168", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n system(\"echo\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86cf7f2583f35ffe23b90df1977efa59a46e3522ae464bf6a00cc863fff80691", "structural_hash": "344f16d4ab3f2e5832ebf9b9b460dc9141ac0d66655fae3c17d64c47fd4b07df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04522.rs", "upstream_id": "BenchmarkTest04522", "language": "rust", "code": "use axum::response::IntoResponse;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let data: String = env_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| env_value.clone());\n axum::response::Redirect::to(data.as_str()).into_response()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c66633b25c489d1902766779d99867e58745a9bf4f6d9327e7d5f1635708e96", "structural_hash": "5d9eb174daec48d69132aa60fba0fcb032e8465e5efd829d8e5bb5ad8790384b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04009.go", "upstream_id": "BenchmarkTest04009", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdata := func(v string) string { return strings.TrimSpace(v) }(dbValue)\n\tif !aclCheck(ctxString(r, ctxKeyUser), data) {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-424"], "category": "improper_alt_path_protect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56caf23260d812d41c73c2ad11a472f9b4db3331892174c82d03e9f6cb0d5e13", "structural_hash": "a8bf2204e87708535ca2e309cda8f9b4afd3942a11c32dcecbc9dcd94a4a49ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19325.c", "upstream_id": "BenchmarkTest19325", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n if (_off >= 0 && _off < (int)sizeof(_dst)) _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "668816fba20c2415400b4756ba935617f34996612622b9defbef937ddb85be74", "structural_hash": "ffcca0b7d4e632d3ddfd241bea7201d165501ff3fc2f7665caac285a186fa7e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00420.cpp", "upstream_id": "BenchmarkTest00420", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d7b04882c1141edeeaceef6661c96b55643a23b6030ce415de4d11ec452ca7f", "structural_hash": "7f1ca0b82df433701f0ec223f00d360c6ea7039f7666fe34bb4eaf4426eed1a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04618.rs", "upstream_id": "BenchmarkTest04618", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in auth_header.split(',') { data = token.to_string(); }\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "834211ceefd456a948f0ce4aa61f50c1f1470e63d319f8069e31276938f2cafe", "structural_hash": "fed215c5973b1edf94c2b02dabed0788c30878239176d0c627db57dcbfefcbe0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01669.php", "upstream_id": "BenchmarkTest01669", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $userInput)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $userInput;\n $expectedSig = hash_hmac('sha256', (string) $processed, getenv('DATA_SIGNING_SECRET'));\n if (!hash_equals($expectedSig, (string) ($request->headers->get('X-Signature', '')))) { return new JsonResponse(['error' => 'integrity check failed'], 403); }\n $trusted = (string) $processed;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb75d84070deeb24c272f17e348fc1098dc4f192ddf81e0ab581eb67da14c79f", "structural_hash": "ae628ff02a161a5211325fe3bc5e0318cf7c5418c0c8fc7c6de38d1c9ad116e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05576.ts", "upstream_id": "BenchmarkTest05576", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(userInput)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = userInput;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4ae495b210b921ed82fd4ca01f2bbd9b8939480ef5ebe74a85116299d598c27", "structural_hash": "523738f3ef793c3c6e472fd94b9d51d8d2021d0929ec4ae254b6301c24cfd058", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32726.go", "upstream_id": "BenchmarkTest32726", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(jsonValue), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b774f679aab8cf8ad215ecaa01732ad59df9239df9a618d7a86589602d0d4058", "structural_hash": "9257b8c2c76ca0dbe5b66db832ed373c4e84b3f34a097d305ebc9f828e145c32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16093.sh", "upstream_id": "BenchmarkTest16093", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\" >&2; exit 1; fi\n requested=$bounded_val\n if [ \"$requested\" -lt 0 ] || [ \"$requested\" -gt 2147483646 ]; then echo \"overflow\" >&2; exit 1; fi\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b6f4ff5846c804fb363dd53ec2772eeb2a1bbc0623f540eb72e3f3780c73069", "structural_hash": "f44b9017ac9115c5c9d53326d3b82354385d0a3cb89e1675955cb090838ebc39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05023.php", "upstream_id": "BenchmarkTest05023", "language": "php", "code": "cookie('session_token', '');\n $data = ($userInput !== null) ? $userInput : '';\n session(['data' => (string) $data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a2c37ed70ba86701478e3e0ff9be7a7e61cbe9c199fc254646e5140274f82d8", "structural_hash": "4c6287cc84172873e2d3870a6f434cde1473c26e8526a4c0a196fdeb1a8f1373", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00902.rs", "upstream_id": "BenchmarkTest00902", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in path_value.split(',') { data = token.to_string(); }\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ef0c0f7454c79030160fdfb34bea6ccc0cc9117f5d1c0802a0db2505ff1b02d", "structural_hash": "9bb09902bb0abc0bb817cd8e2cd8f823127736db4c9a02f5446da31b3f937f51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04731.java", "upstream_id": "BenchmarkTest04731", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String prefix = xmlValue.length() > 0 ? xmlValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = xmlValue.toLowerCase(); break;\n case \"f\": data = xmlValue.toUpperCase(); break;\n default: data = xmlValue.strip(); break;\n }\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { response.sendError(502); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a5bdfba159a6931be41916ea25d3bc349a0e3a2cfff6336ed2733cd4109936e", "structural_hash": "84762bb65323b7e9458eeb9b09bcb6c81e81757e678d215fb6153d2bd7ef3580", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21435.js", "upstream_id": "BenchmarkTest21435", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = String(userInput).slice(0, 200);\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b3667f1c342618c29bec60f91c651a4b981da13fcfebfd1935872cb3011016c", "structural_hash": "136ad6f4ad168b6019610f2a56518d5ffd28d469c26685a883faf5a49b011740", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03915.java", "upstream_id": "BenchmarkTest03915", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n int boundedVal;\n try { boundedVal = Integer.parseInt(jsonValue); }\n catch (NumberFormatException e) { response.sendError(400); return; }\n if (boundedVal < 0 || boundedVal > 1048576) { response.sendError(400); return; }\n long requested = boundedVal;\n long allocSize = requested + 1;\n response.setHeader(\"X-Alloc-Size\", String.valueOf(allocSize));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a26257b6fd6372cdb9a93ce6e26a49793392808c61d9fef90982471af881dbe3", "structural_hash": "e83e99b99cb0f360fcc523b9451d652d336d6276fafd7b96ebf74b48e1a14f81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04986.rb", "upstream_id": "BenchmarkTest04986", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"feature_flag_value\"\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d1b86d566c9ce1d8f61b69b19b55e1900690f819236d8e400ab5e5a39b02f67", "structural_hash": "0d223b259fe9feff07b0d5f3a83f7265e84585dd14428e408ba45173f2014701", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06529.go", "upstream_id": "BenchmarkTest06529", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(fieldValue)\n\t}()\n\tdata := <-resultCh\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:16])\n\tstaticIV := make([]byte, aes.BlockSize)\n\tcbc := cipher.NewCBCEncrypter(cipherBlock, staticIV)\n\tptext := []byte(fmt.Sprintf(\"%-16.16s\", data))\n\tcipherOut := make([]byte, len(ptext))\n\tcbc.CryptBlocks(cipherOut, ptext)\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"aes-cbc\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4abf1fa28ab160127af46cc773a8bb17351f5b45a9ba38b8b320afac26aaf2fc", "structural_hash": "8188d1b769c0407c9d56936aa978988ab68f166631f6a99d762280470feb5073", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03354.cpp", "upstream_id": "BenchmarkTest03354", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic thread_local std::string cpp_shared_input;\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Host\");\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n std::string _truncated = data.substr(0, 64);\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + _truncated + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2235705263ce293b85b0fabfa61e0a26160f28c00f757fcd11bde377b607600f", "structural_hash": "106dd9407c8541a916a007880b02cf64462309070750fc2e26706c38f5f63f3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24074.js", "upstream_id": "BenchmarkTest24074", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-340"], "category": "predictable_prng_seed2", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6807350baccfca02422bb6f7b9c9e3f17019408b5936f1097c6cbcec968e96eb", "structural_hash": "34d78d63d3fea09c6ab38841b3cf49ec088efcef6f6d64da5f73a7081da447b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00436.cpp", "upstream_id": "BenchmarkTest00436", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data = cpp_module_transform(user_input);\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c26f130098670e0f6e41c32f0eae3dde10a977c6a5439d41b7a82815b5b2ac52", "structural_hash": "fca9a3f0915ff9cb673cdaf9175812ae46232d4c24a22a888747b69de8fc3c11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04959.rb", "upstream_id": "BenchmarkTest04959", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "915d436a73af1e4fc556b62059d7da1b847ea6a5d42ea4f21d1059e45d48540b", "structural_hash": "0b0223ef0717314b1f065848dcddbd13929e15fb27fe3a423a0f9a98c8e199e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01790.java", "upstream_id": "BenchmarkTest01790", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + commentValue;\n String data = valueSupplier.get();\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "087155b6357fb68627cd27c2b3735acf9ce1e91e99b55092d10a6e46d98e75e6", "structural_hash": "4973d181c38986123b4e6d8959bee1bb0446400a6594ed23b164532facc08002", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05992.rb", "upstream_id": "BenchmarkTest05992", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n data = user_input.split.join(\" \")\n File.write(\"/var/data/output\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00f1fb176a44760573dfc5c52965307024cff3437ceec06e41bbfe7763d4367b", "structural_hash": "9b80234f815d2c48016efadc7a1608c3d0e89cf2f5bc45685198a1a91198946b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03662.java", "upstream_id": "BenchmarkTest03662", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> originValue)\n .thenApply(v -> v.replace(\"\\t\", \" \").strip());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n return Response.ok(\"{\\\"status\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5ba29bee1ed59d1889c96c835c3f052da9899b240935b86c1802e17092eec39", "structural_hash": "a1cdd9497fdeebfccf3c38285c3a9369e06f3ef692c5f3a5b6d16851ed8fc1c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03983.py", "upstream_id": "BenchmarkTest03983", "language": "python", "code": "from django.http import JsonResponse\nimport os\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n data = header_value if header_value else 'default'\n os.system('echo ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef3e0fbf1ecca143816b70ea9e39596ca044b9b09a8081ebcc1aaa1e65582791", "structural_hash": "995b9fc601d9583fb68557772b3adbd1c003a60f89379fbc2c1d7391a3871c26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05291.ts", "upstream_id": "BenchmarkTest05291", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n childProcess.execFileSync(\"echo\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b383ce7b96918e8971a933067906caab04ddc24d999bb2b413f309f372a8f22", "structural_hash": "c4a3bac668ed4ab11ae677e47d27d5e194ccccf95e0838c25153af8f2adb7779", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05571.c", "upstream_id": "BenchmarkTest05571", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "882c8eeb46177d5ea3dd474ae80078c26387ca13a49c69543deb6ff02b6ec0d1", "structural_hash": "2ae6077d80ed27eca084cc3b988e3f82bb44ecd0b749995c3cf6376e2d3daf4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01591.php", "upstream_id": "BenchmarkTest01591", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n json_decode($data, true);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f31f12211f8dbac8ab634092d8af104207d7bd820848b12fc25690196c956d80", "structural_hash": "fa7dab8cf0b044772265b87068bf9b59132ed8d6ebf8138858789fa4a4a138f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02178.c", "upstream_id": "BenchmarkTest02178", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _dst[16];\n strcpy(_dst, data);\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7496028b0ccbac4685080e404421b973e8198fd2d79e434054ea5866af761c3e", "structural_hash": "a4487ae68e0d0582b4396a537003d52dd1f39d5073957a5c55576130abaa5a03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25859.sh", "upstream_id": "BenchmarkTest25859", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n tar -czf /tmp/archive.tgz $data\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "baef7c98e2ccc31c18d92db39d4afe6552c8b66ab58c1a52c8b2a78fd3761e97", "structural_hash": "a49ec1fdeebb24556ab48a46d14fcd25525cc8f89a2d0925f003c0bce6fc12e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04288.java", "upstream_id": "BenchmarkTest04288", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n private static final java.util.concurrent.atomic.AtomicReference atomicValue = new java.util.concurrent.atomic.AtomicReference<>();\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n atomicValue.set(jsonValue);\n String data = atomicValue.get();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"DES/ECB/PKCS5Padding\");\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(new byte[8], \"DES\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61538904446987ae3c0d42c521e8e0dfc14e787fb0346b4f740bc3e3b16ea937", "structural_hash": "79f11bed1e066b334a770ea7550bae983cf51d74d821d07653c1d698c5ae6d79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04898.rb", "upstream_id": "BenchmarkTest04898", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = user_input.force_encoding(\"UTF-8\")\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n headers[\"X-Custom\"] = processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "149b710e20b56e7e203f6f7907d982f78cf9ee53e1a9e64eb8da18618de4d687", "structural_hash": "5bc5e32093e670d9ba7ce8894c4e7ad556ba53d0c3901025a669c778631ace74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05958.rb", "upstream_id": "BenchmarkTest05958", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = String(user_input).strip\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "882ed329cc55a936d01ee815356e4d0da67b1e9647637e4c05633db147c49a4b", "structural_hash": "c2d26695925222c865ea07cb3444944a7d3e380e45ab781c154f76927ff78e5c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17773.c", "upstream_id": "BenchmarkTest17773", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_OAEP_PADDING);\n RSA_free(_rsa);\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3996f7d72aed899523ec40403fef3d3206100a7222bad284d4cb72141ab200f", "structural_hash": "0c022f05392f50bf989036a1dfad15ce6e58d837490658d871ecd6178eef784a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01962.java", "upstream_id": "BenchmarkTest01962", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadedName = java.util.Optional.ofNullable((String) request.getAttribute(\"uploadName\")).orElse(\"\");\n java.util.Map.Entry entry = java.util.Map.entry(uploadedName, \"form\");\n response.setHeader(\"X-Tuple-Context\", entry.getValue());\n String data = entry.getKey();\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7a74f63fd3e407c9d8fc24ea13392716702b969b591d58c6b14754b8f230c22", "structural_hash": "12ad202a1e04a909b32e312543be1b068183724595d3a2bb2265be666a080972", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03533.rs", "upstream_id": "BenchmarkTest03533", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"setting\", \"default_config_label\")]); m.get(\"setting\").copied().unwrap_or_default().to_string() };\n let mut pending: std::collections::VecDeque = secret_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ct = crate::shared::encrypt_with_key(&store_cred, &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d397678b476bb79899d323050bd1be74cf58beabd635bbb94ed610f291bc1788", "structural_hash": "8cbcfe516d99c2455287eb5ba9a6418c2f3c9af1804a0c2284a009346c409460", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03973.py", "upstream_id": "BenchmarkTest03973", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n data = handle(forwarded_ip)\n processed = data[:64]\n db.execute('DELETE FROM accounts WHERE id = ?', (str(processed),))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50627f571934a758e6e3108e68081ece622d82e31e7fa5aab04c7a86c28c75dd", "structural_hash": "872955b88b958b9d51be5e11b3e812269d97d91d6b4c365c82b42988da204be0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04056.rb", "upstream_id": "BenchmarkTest04056", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n role = data.to_s\n if role == \"admin\"\n halt 200, JSON.generate({ role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36b80b23066cdeb2cf8ffd7162405be489075f0d08a2a75f1646faa86dc75a41", "structural_hash": "cb24c9bef338c5bd05aaf497e1b5f10882208488b14ce7a46e1d814f8475567c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15856.sh", "upstream_id": "BenchmarkTest15856", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a600e27ee9c08078edf411f9d3fac2777cebb956498992cc490d07f71d8f05d", "structural_hash": "2f185cace5a29152e87998e1048b1ee8e2f9471bbf67d804ddd93c719a0efe9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05676.ts", "upstream_id": "BenchmarkTest05676", "language": "typescript", "code": "import { Controller, Header, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a0137ca642c697c23b785b4a564fac88cef02228521b6fb8c656470c2404dda", "structural_hash": "b2857f8dd56150e579b0a9994e0ae3572b073af26ce0b5616f461abc808a63b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30516.sh", "upstream_id": "BenchmarkTest30516", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n printf \"{\\\"echo\\\":\\\"%s\\\"}\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "990c658e458f91da073045c9100c63f8736f193b53c050c900444fe4442f566c", "structural_hash": "37fc89c484b1c78c32f58830e5658e755f63629c9aa0ce61ca11bceb2f999165", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02441.rs", "upstream_id": "BenchmarkTest02441", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse hex;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let data = String::from_utf8_lossy(&hex::decode(&cookie_value).unwrap_or_default()).to_string();\n axum::response::Redirect::to(data.as_str()).into_response()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33fa122a39775778c4e26a0c1426ebcee59971d76e5c827cccf5af9e696d4474", "structural_hash": "6ae6b23a663a05aa80e401f17525bf69991fe7c914f8c8c44f5bffc582b2b9d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00384.rb", "upstream_id": "BenchmarkTest00384", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n result = DB[:users].where(name: data).first\n value = result[:name]\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "344451eff2c5d28fdb904dc111700b942f29aa776930d9045d806dd970c62b91", "structural_hash": "af4b407134b0b1ccf74a2d047f4ea43ca09cdf52b070fbcb6063cee3a22b40f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00237.rb", "upstream_id": "BenchmarkTest00237", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"feature_flag_value\"\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ddd014ca94ee80cfd8940385488fe3abb935a0db7929bbad861ef4a93e7fb90", "structural_hash": "335091c0418d7e38ba3f314b0ff0424c8c87d634f975d19c5d42388c11afaa70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03444.rs", "upstream_id": "BenchmarkTest03444", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let redis_value = crate::shared::redis_get(\"user_data\");\n let (payload, _origin) = (redis_value.clone(), \"http\");\n let data = payload;\n let _: serde_json::Value = serde_json::from_str(&data).unwrap_or_default();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e34ba1ce1718096141c04982c77f24090683bed6975defbae423a7f394258fa0", "structural_hash": "2e53676e0eebb85cd01aac81d71c7d2621b6d63b3333b715e25322f3a8ce0d57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04291.py", "upstream_id": "BenchmarkTest04291", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = bytes.fromhex(cookie_value).decode('utf-8', 'ignore')\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return JsonResponse({'status': 'ok'}, status=200, headers={'Access-Control-Allow-Origin': origin})\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c3468d986b6c986d70d216d79e7b6a4e2a74e7e7161bcbbe33785539e2967d9", "structural_hash": "bbea9dd2b45fc03bb4c828852b6bfdacd1429f4241a9b7a7ee36593ba3d04826", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02476.cpp", "upstream_id": "BenchmarkTest02476", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _fname = data;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec588611cf1c7694bb706e109d7ee0ae216387454bc9a5f11f6ed74de2017844", "structural_hash": "bf6af5c380ff1db3d8ac0c1f28ca6a9f4ee4d50b6f31fe83b6d584a343f10496", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20108.js", "upstream_id": "BenchmarkTest20108", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9367d63bfec99f184998c0aaa182ecf7fabcb422e04fd585d33b62a8a8e6f630", "structural_hash": "a171fd7055144127de8ca34fc0102847bcd39b071bc3ad09371b53827af56310", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01054.rb", "upstream_id": "BenchmarkTest01054", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = Thread.new { user_input.to_s.strip }.value\n Thread.new {\n eval(data)\n }.join\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13247d5bcbb170ecf612c1435698d1a116c31fb534cbe585f17927e312b47711", "structural_hash": "088e35077549282642e0731cdd2e8468835c856ce9d1902b47c3c822636d4abd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01002.py", "upstream_id": "BenchmarkTest01002", "language": "python", "code": "from fastapi import FastAPI, Request\nimport json\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n try:\n data = json.loads(raw_body).get('value', raw_body)\n except (json.JSONDecodeError, AttributeError):\n data = raw_body\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bef653d3c5c2fbda34473ae726c32ca35bedea096eeec2453f4a071a911dd081", "structural_hash": "467bd3b83a6020dfa108741345e5ab83c63f83d34d8680caff5497972fc5c9d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01935.rb", "upstream_id": "BenchmarkTest01935", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c0293f56e5f0284f4870e37c7fb3879e6a1cbd77ae833ad30d250a79c48b27c", "structural_hash": "9287e211fb92bb3d61b73505e5c2d670534f7a12a9e3c6f68a03407f8a3f466b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00205.rs", "upstream_id": "BenchmarkTest00205", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = \"xoxb-EXAMPLE-0000-1111-abcdefEXAMPLEgh\".to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(secret_value.clone(), |s| s.trim().to_string());\n crate::shared::db_connect(&format!(\"postgres://app:{}@localhost/prod\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8239501392a6b8bd61f572bef4acb97c5bd5b23516f54aa71ea00bae2a86aea5", "structural_hash": "0f2a02562b4ecd4a73c97435120ad294d9bef74e7956a40ed130f6df9c65246f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00081.ts", "upstream_id": "BenchmarkTest00081", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "563a26e9a0efe1b33a48f6175a28b845e2470ca57305e23574ca560cfa8056d1", "structural_hash": "2f7aef15205736f90f5a2740a18268de1762ad34dd5030429801bdaa6049ed1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02754.cpp", "upstream_id": "BenchmarkTest02754", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "756c73903930a16061af5ff3b132b4e8027dd55718561d40adda1ea404d28814", "structural_hash": "09b96fd5ec7941dd07d4ff6dcc86d6a8b97aea55a127311cedf3a2d7e7a781cf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04815.rb", "upstream_id": "BenchmarkTest04815", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless session[:user_id]\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "101dd41099dd12ce5cdf3df3a8b2b3d291854b87792a4465769f94d92430cc14", "structural_hash": "15db4049801301edd726f0728456f6d0ffdde0a597b121f95ab07182cc85932e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02309.java", "upstream_id": "BenchmarkTest02309", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.sql.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n String data = pathValue.isEmpty() ? \"default\" : pathValue;\n try (Statement stmt = connection.createStatement()) {\n stmt.executeQuery(\"SELECT * FROM users WHERE id = \" + data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee970ebdc761f1e0ba9adba94c719aa8c143fa5b14e4c911f98530672230e102", "structural_hash": "fbeef8bde455762098f2c0c34708c7727e992e8fba2cfc5350c100ddeb3030d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17623.sh", "upstream_id": "BenchmarkTest17623", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06761cb3e4338ba2979b52ae3a691e5dfc53d6ebc5f8758e3f12f5678fa5e2cd", "structural_hash": "6cae3df766146cab75624f256e43013576abc4afc7e943f0a4242b8339181f25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01983.py", "upstream_id": "BenchmarkTest01983", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nfrom types import SimpleNamespace\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n multipart_value = request.form.get('multipart_field', '')\n ns = SimpleNamespace(payload=multipart_value)\n data = getattr(ns, 'payload')\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n if re.search('[a-zA-Z0-9_-]+', str(processed)):\n return jsonify({'validated': str(processed)}), 200\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efb2cdeef9133eaf2e0e619aad3c9ce4492ac8bfc9d9c7d22a839fe27e132a89", "structural_hash": "cdbc0d5e7a9d95799f33b030d016b9af178f0494b6416707548975fe14e40361", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05900.js", "upstream_id": "BenchmarkTest05900", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aeeda1aeee61440eb8b4003be0580f3ac893cfe44ffe5003712e61f4e82f3c1e", "structural_hash": "643fae9ba407894f62d85bc687d511a308f6a7da922b4d2b13168c0b96585043", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00286.rs", "upstream_id": "BenchmarkTest00286", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let transform = |v: String| v.trim().to_string();\n let data = transform(comment_value.clone());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1deee48caf6992637c941aa0c3eeb29eb15b77b378e8124d3ec4ab4b2d445d7", "structural_hash": "8d248f6b879b024b55475ab63b5a1499826648c80a34401c517d94fdc9507605", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00850.java", "upstream_id": "BenchmarkTest00850", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String configValue = java.util.Optional.ofNullable(new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(\"/etc/app/config.json\")))).orElse(\"\");\n String prefix = configValue.length() > 0 ? configValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = configValue.toLowerCase(); break;\n case \"f\": data = configValue.toUpperCase(); break;\n default: data = configValue.strip(); break;\n }\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff49144a639313f71c4626462943228a51712257fe5c1a1d6f63fdb71ba6424e", "structural_hash": "a8670734e5d56e46da06f7670faa304d9cb2168562ad5389ae92cf5fd95340cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04293.php", "upstream_id": "BenchmarkTest04293", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $logger->info('Action: ' . $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d7245ad00827abc4c9ea4006efe2d9e7e28b82cddcede89ddcc094565a7a8c8", "structural_hash": "ad5b3290f2f58f140083beff99c9911e5778d28c7e0f43024a1cd63b32a1fb95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01775.cpp", "upstream_id": "BenchmarkTest01775", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"http://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a27c60b0899be091909e20c9c3a6089ee140bf1240f6d2c29666983a85533745", "structural_hash": "0d3d326419ed9334b919ea773e0d5e94ea84e740cf176d255f80717429733f0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04668.c", "upstream_id": "BenchmarkTest04668", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd188735d6a4f7754ea57487d3c95a5031834ab13c0db9ce31e5faa6d82add84", "structural_hash": "f0748a0fec9fc53e18a103bcae7be522d5e58bce2c9ff5aaa0459f940f689506", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11220.c", "upstream_id": "BenchmarkTest11220", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 0, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b178dab0cf79c67a52467ad410b7ec5a95285f5c8db80fd66220a0233f1b3821", "structural_hash": "cd0f0cd9fc98f8e950d9a8b4e1d06eff872420e75ac93e409181d35fe8736f71", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00118.c", "upstream_id": "BenchmarkTest00118", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n int _vals[8];\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 1, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2dcb36f8fd07ac197bcb49ba5b204e71b049a233479effdb7ab7eb843eb7cdf8", "structural_hash": "cae30c7924291c597ac81783aa42470510a76905303c3a9ba9a9d7745f233252", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00975.rs", "upstream_id": "BenchmarkTest00975", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = referer_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let processed = data.replace(\"\\\"\", \""\").replace(\"'\", \"'\");\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4461cd8380b193ce10e96e0b6927c29c44fcd6fc1c0c38596ae71ee291e0d30b", "structural_hash": "ac69ff3fd9f8dbf45589891ac92f211858f3aca6c08a6ad080a240ce35353c52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04489.rs", "upstream_id": "BenchmarkTest04489", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = origin_value.replace(\"\\t\", \" \");\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "308a0dd7bd6cc43e5524956767d78288e6140940a20545c4b60e79dfe2373c7a", "structural_hash": "7242603ba9976e346b237f90374bd0865cd59cd98542dcfb365941a34f026787", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29028.sh", "upstream_id": "BenchmarkTest29028", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n case \"$data\" in *DROP*|*DELETE*) echo \"invalid schema\" >&2; exit 1;; esac\n processed=\"$data\"\n _seed=$(printf \"%s\" \"$processed\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dde9ea8e7d6ce60422d8dd8b014c91f8dd9fc87d2285d8dc47bc9d5d6e3534e", "structural_hash": "4434f20e450e3c30ac063e5a16654c4edddbff499738b4d554a758f68ee50143", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08902.sh", "upstream_id": "BenchmarkTest08902", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n chown \"$data\" /var/app/data/managed.txt 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51a3e328e32fa7708f008ff68a6c321b0bb5aeeda47f0c843a09c7ec3a638822", "structural_hash": "db64dc5ea61ea9e85561f89eac55295ae86d2c8c748167100b134b6486951a9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16070.c", "upstream_id": "BenchmarkTest16070", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4942fdb00a3c975c95a7c251ad0e8f3a6053e1e54c7277db7c3e36a524dd1b91", "structural_hash": "70b83bce40a1d6147ba05fb71110bf0a0c8e16f9ff651e9a9fad6af07da480f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36925.js", "upstream_id": "BenchmarkTest36925", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _cred = String(data);\n if (authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "523359c6866427bac0b5a3a27e95f0906ec27ac7c774efa6dd9bbd290df4fa59", "structural_hash": "006f4fbe1da7bbf02be5c5a4cb107360f35d413958afb14141c64821b2ecfcee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16760.c", "upstream_id": "BenchmarkTest16760", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "188bee71680ec4e2e0cb788ec4958e6dbe5971e6256d467c07fd59b8635ddec1", "structural_hash": "19d354f7359cf52a839656e5959181a6b38a35883e15fdcc44fee4d28f8c76f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01737.ts", "upstream_id": "BenchmarkTest01737", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n shared.authCheck(String(data), \"admin\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f61b57b1802a0928c3d3eaef9b4e2fdc21e31031ddaa25a279ddd36fcbfcbae7", "structural_hash": "b572263df6b40718cd9990da0f480ea077c56e5db2b0046fe32f474041b3e982", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04328.rb", "upstream_id": "BenchmarkTest04328", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n requested = data.to_i\n allocated = requested + 1\n render json: { allocated: allocated }\n end\nend", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3dd17e8088b317f428ec4bb33f5043a29f0be1dfa3d60c16457db54507ee0ff", "structural_hash": "66bb2b86439ba1f9238cbd3db87f03bf6bd5a25a89b0f89c7b1732cefe04f121", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03358.rb", "upstream_id": "BenchmarkTest03358", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n if [\"https://app.railscdn.org\"].include?(data)\n response.set_header(\"Access-Control-Allow-Origin\", data)\n end\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4bcc49574447da794f205d2749032cf2d3e0cf2d19481963d480094b1e05273", "structural_hash": "7fdd4145616b88fa2d0c56b9a742282eb29d3b5f7548f23c7f99f14ec34ef1c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02936.cpp", "upstream_id": "BenchmarkTest02936", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.path_params.at(\"id\");\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string _cmd = std::string(\"ls \") + data;\n std::system(_cmd.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "979b25af0d608cf656471c47cc7c08c9e14c9c164025ce8275af6eec43147d22", "structural_hash": "60cb94205e96072f5ab47cac6f0a26386cb1e53ad21b38c86aa5609fabe1b63c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00416.php", "upstream_id": "BenchmarkTest00416", "language": "php", "code": "headers->get('Authorization', '');\n $data = str_replace(\"\\0\", '', $userInput);\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47aa957303cf35e694f8f3d4e4bf8817536c295182d872fc6a488cd42249d871", "structural_hash": "305841360d24f14af76de398369181a9bd36e2ad57a5ec0528c8e3bff48b9d79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04115.rs", "upstream_id": "BenchmarkTest04115", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data: String = field_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| field_value.clone());\n log::info!(\"User action: {}\", data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a7b7fff715cc8962f7bffbd8e69a1eaa549abf2fe683f04c352a70776f8f04f", "structural_hash": "c312e6892aeed21bc8c79a398221b74f80c22ec14a11a7f2e1d50d7d54241ebe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05652.php", "upstream_id": "BenchmarkTest05652", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return new JsonResponse(['validated' => (string) $processed], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e425bc960f3b8b4928fd0db9fd90792fd57f16aaad0c01eeb65aa466d7d8b0ef", "structural_hash": "1ddc1d34d53fdeb4c53ac3d23fc2f5e7c784a9808ba4fd2025c86edfbfc40f17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00752.rb", "upstream_id": "BenchmarkTest00752", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d18a6746229ca021fac4a003e4ec9727c81569f6a0c592012ee79f09058f0603", "structural_hash": "4c7c869ac694f33bcda56d63ffe10f56ff2d9bf2eaf88e56fdf06d88bb3022d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05002.py", "upstream_id": "BenchmarkTest05002", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n data = ' '.join(str(header_value).split(' '))\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if _login_attempts['user'] > 5:\n return JsonResponse({'error': 'account locked: too many attempts'}, status=429)\n if not auth_check('user', password):\n return JsonResponse({'error': 'unauthorized'}, status=401)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "927f6fc7e917a667518a1cf1055306a82ff7946dc311f5c7c69105ccd35c3af0", "structural_hash": "f95c7c7e04c49df76f7fa4ce99dea5789d509198070b3b020b69269d08cf60ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17897.sh", "upstream_id": "BenchmarkTest17897", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"audit actor=$data action=session_revoke result=ok\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9c0d06ed1894bfd74fd31a6d963845f3cf10ff7d8518f89f2fd73676409dbfe", "structural_hash": "e85256f6b69b11b98f15abf466aeb74e4b62d4bcf36d3eb5f72174254eef60db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08893.go", "upstream_id": "BenchmarkTest08893", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvar data string\n\tfor _, token := range strings.Split(dbValue, \",\") {\n\t\tdata = token\n\t}\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcontent, err := os.ReadFile(\"/opt/app/plugins/report_renderer.so\")\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f453d3274fd26c47b601103adf6feacb405b8b04e3138cd17829047cea0f9360", "structural_hash": "d23e3c9b0a0b6dbcdf662fab724c424e1243e2756aa406eab1c698b488f4493a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06165.ts", "upstream_id": "BenchmarkTest06165", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n res.set(\"X-Frame-Options\", \"DENY\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c6a79d15bd8aa9d088fc83a94b5b89dfb88f81ff3c976f468e37935b718b521", "structural_hash": "54d3c3e701ec81cfdff6272478fa04ef11f0f248037dd647b8965c28da20bc88", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05020.rb", "upstream_id": "BenchmarkTest05020", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n data = format('%s', user_input)\n trusted_claim = data.to_s\n render json: { trusted: trusted_claim }\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0434867890121126fa811c631ef30be41e4304d82d3ddc93101b7d738712a0d7", "structural_hash": "40af8fa08cdf013723cc293668e6248734ef356f90b12289546380a772f7fb58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01531.js", "upstream_id": "BenchmarkTest01531", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = await Promise.resolve(userInput);\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1125"], "category": "excessive_attack_surface", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b5fe1f13e66be921ae6a75dcaea563ec709818b095ff44ebec08848c162c51f", "structural_hash": "6f325652ef84cf0aa9b6074ebae86671cf4caccd5d7f025716788f680449a95a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_11114.go", "upstream_id": "BenchmarkTest11114", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tdata := strings.ReplaceAll(hostValue, \"\\x00\", \"\")\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "863bdae3d8e8fa0f8aa16a730b2d45c38c69e5095d818abdc45db617e4a58a19", "structural_hash": "b13673f200b7587395de2718112f0e84d0c5c132ca0aae5b00b68c5d2a078553", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18234.sh", "upstream_id": "BenchmarkTest18234", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e526200e4ebec67889f222581c0e457f696098c1eecdb0775d35f80028bc755c", "structural_hash": "1e5b4dd2fe55318af621bd2523fba8e1aee1ba32f7a97a3281ef992b707bca6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03640.cpp", "upstream_id": "BenchmarkTest03640", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c3741fbb3b12cf9b0b01d887678ec2fa23333292f825c1fb860b48b6294daef", "structural_hash": "56dd5b3a741f6d72f65e14f8ad5dd9195840881fca34fcba2861c07c4fd61606", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05427.c", "upstream_id": "BenchmarkTest05427", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_OAEP_PADDING);\n RSA_free(_rsa);\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1382f4457d2241f175679ee14720729db24d1f27a6f9d0c181548e9be5813ae", "structural_hash": "e07f40f2974f44c5039c5b64d432fc080887e051c34f2c5dcd71307f204064ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02515.ts", "upstream_id": "BenchmarkTest02515", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Req() req: Request): Promise {\n const userInput = cookieToken || \"\";\n const data: string = shared.passthrough(userInput);\n if (!req.session || !req.session.user) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n req.session.id = String(data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25646b3aa5a3665cdadfeabe7a6a01e49693340a0f55d981880ffc5f1ae5562a", "structural_hash": "dcb0df68e7870a6f2d14be9aebeec48dce25a61818f42288418fe84920e3f92a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09876.c", "upstream_id": "BenchmarkTest09876", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d70d4f4c1b2b5109a6ccc819019aa8a5adbfc96909dff59224b53ce712abcc6", "structural_hash": "c4ad9b36134a2dc0281104de358b5304e55cd5b9f66cf7da31f49647bcc17139", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02247.rs", "upstream_id": "BenchmarkTest02247", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(origin_value.clone());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n #[cfg(unix)] { unsafe { libc::setuid(65534); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95cf3a16fd79aa05d721c8405c4a4e9d15aef8def87de4ddb7de3513e08b9a37", "structural_hash": "1264d75126a2433a3a03f843b150ecd68a8bc8c68315a0858190ba270c464f64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01661.ts", "upstream_id": "BenchmarkTest01661", "language": "typescript", "code": "import { Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Res({ passthrough: true }) res: Response): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17c25a09cbe4c13a6c34c44b3abbc7c966971de2cb3bfcfe2db909c9d37230ad", "structural_hash": "bb3a177641d4d79cb3f21ef91029150ab45f1075688f0c632e4cd6f8211eccdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01383.ts", "upstream_id": "BenchmarkTest01383", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n res.send(\"
    \" + processed + \"
    \");\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d6f69aca350052e002af9c950e84c861482365095efc770479bccbd7f3f5128", "structural_hash": "59b069515e8bacd5d88919d879dc11a34f26ce44f58c5f5ae10768a69eb4ea7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04722.java", "upstream_id": "BenchmarkTest04722", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{headerValue});\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98bb8b0cd3657581a5f11896c4df07947edd0c9e26d815f0fecb297616d353c3", "structural_hash": "dce6ef4dea490e48ab220871e99a8a3fd815cb706cdac42b92e378c869b56e87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23697.sh", "upstream_id": "BenchmarkTest23697", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(printf '%s' \"$QUERY_STRING\" | tr '&' '\\n' | grep '^items=' | cut -d= -f2-)\"\n printf -v data \"%s\" \"${user_input}\"\n processed=$(echo \"$data\" | tr -d '\\r\\n' | sed \"s/[a-zA-Z0-9]\\{4,\\}/****/g\")\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c380071d63550f23d92630591ca4442d08f3324c4250a773d973986c0d330e54", "structural_hash": "a06a1e95b8edb672dab76d9ca892bef4f5211edfc061078fb67a1f444ab3c376", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36368.js", "upstream_id": "BenchmarkTest36368", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n db.execute(\"DELETE FROM sessions WHERE owner = ?\", [String(data)]);\n console.log(\"request processed\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ccc3029690b5a319e98fd36e2b9775acc9eef224595eb371d8a17e73d9a9a51", "structural_hash": "c7e145ad18303cbf0b475cf63a0edc90b0242314b2ee1f82782018cefca5e9d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24430.go", "upstream_id": "BenchmarkTest24430", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(refererValue)\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\thttp.Error(w, \"invalid option\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\thttp.Redirect(w, r, \"/dashboard?hidden_field=\"+url.QueryEscape(processed), 302)\n}", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0dc294697d4444779faacff4a23fb3713f56d0ad7907335c9b9ffed92de45f7", "structural_hash": "c8f8cf9d3326b1e028b4df186eb79368768531028d91f482e38ab72a4f75de44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05257.py", "upstream_id": "BenchmarkTest05257", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom pydantic import BaseModel\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data, _sep, _rest = str(json_value).partition('\\x00')\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Access-Control-Allow-Origin': str(data)})", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f0870a50127c49bf8a87986195016a5d53eacaedb8a5c2f63c04283f4f41d90", "structural_hash": "218da7226bff607a6916f852c6224b685263d62c2873184f9f2649725dddb50a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06271.js", "upstream_id": "BenchmarkTest06271", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n authCheck(\"admin\", String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad3b547c5a779dfdfa87d80687fe7a5b7ce02e5414c189e8871881b12ee3e3f3", "structural_hash": "f7dd3004cfb9c8f514a29278e25bbf95aef745a3cd8149f7b470967e4ef7f2a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01460.java", "upstream_id": "BenchmarkTest01460", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(headerValue)); }\n catch (NumberFormatException e) { data = headerValue; }\n long seed = ((long) data.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a90d9d19d3d62c3935f9ead2b27d8560f2df15ba893252feedcc93ec8ae66ad3", "structural_hash": "b1f721b9907ca61f3fb48ee66e819cf97c027c199d6080d0fc05a4f610b358f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01156.py", "upstream_id": "BenchmarkTest01156", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n if upload_name:\n data = upload_name\n else:\n data = ''\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return jsonify({'error': 'invalid integer'}), 400\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return jsonify({'allocated': allocated}), 200", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32a47262e934db5c1c1bb77f4a593d8928d03fe84a989d2cb69235d9239c242f", "structural_hash": "e8d9faa5809f9e0efee9d142273729ed79922cec2a034825272905ccc68df1b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00329.rs", "upstream_id": "BenchmarkTest00329", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (xml_value.clone(), \"http\");\n let data = payload;\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0d8bebf9f63e6d29378214bc2748843b2575fdf55535f035f4ec2d95291b74d", "structural_hash": "4f9ba1f295a30ab5d63ea69825c9f16e3e07926ecfd79a62a95d51ccf2607930", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04573.php", "upstream_id": "BenchmarkTest04573", "language": "php", "code": "getContent();\n $data = ($userInput !== null) ? $userInput : '';\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7687f6545ecb721e6d9a3eacb0fdd89f96fa1f02b8f3e098a50a451fc24715e", "structural_hash": "716fdccc63a2d92de0aaf61ca83a0355a0950eb0e6b600d21f8838f665245095", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06114.js", "upstream_id": "BenchmarkTest06114", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n ctx.body = \"
    \" + data + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b73e7594ecd0658edabb5fa3e5f1a42b71550f62ebea6fdb082ae45ca6e3a758", "structural_hash": "f2463be423f36e452fedba9f50ab10e0811f9ad86ac4808096b0e48986878820", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04046.go", "upstream_id": "BenchmarkTest04046", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := func(v string) string { return strings.TrimSpace(v) }(jsonValue)\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e47c746740afb9c5eb9c6d64fbdc5ec167e8b2354ef349223276ac0f884a0f44", "structural_hash": "ec435c92ef3c42343ab52cf24df5897c9a7875176db4eef68177aa964aa81cc3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03922.js", "upstream_id": "BenchmarkTest03922", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0252c56bf7e265e4004e114bf7ffc40e72c324870030b819ac7067efb5ccf947", "structural_hash": "74283b305836fa56430c4cdbb39301592dced1910e20302c92c94e1acb2f59ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03324.php", "upstream_id": "BenchmarkTest03324", "language": "php", "code": "json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14c46edc12272296ba95dfb8da8dbd3cd66728c02d061570d5593ec6a06c74fe", "structural_hash": "17efc1dedadd848659f6ddbbc06f6e2a907279fe1ec9ca48146c5efacec6a985", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27348.sh", "upstream_id": "BenchmarkTest27348", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4cba76de9be4a1eeed4896e6f28e67ff8e5e07efd3f56e177956d6b5a909672e", "structural_hash": "e8016d7d77143559e86e3c01801069ac08aea71586c9019c1025702d9de61c27", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05296.php", "upstream_id": "BenchmarkTest05296", "language": "php", "code": "json(['auth' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fef58ce274729a9bfd16da4c1240b082755ea2b5152a14d05b0fca308d88f15e", "structural_hash": "707cbe5fb4404c7a5b7f082dec8140165323e6ad5578bd4f79d74beccae73fed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03839.py", "upstream_id": "BenchmarkTest03839", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n reader = make_reader(graphql_var)\n data = reader()\n if data not in ('ls', 'cat', 'date', 'whoami'):\n return jsonify({'error': 'forbidden'}), 403\n processed = data\n os.system('echo ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7961cd5ab17838902fe39a2533008133190d16308c33844859f89bdee9e6a674", "structural_hash": "6b210eb68eb0e2bc729d49bf9b55dc4d3fc859baa00e3d2010f1fb912a217a03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12709.c", "upstream_id": "BenchmarkTest12709", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n if (_idx >= 0 && _idx < 5) printf(\"%d\\n\", _arr[_idx]);\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "548f7eaadb8b91681b7b4bbf689ddf780972921aa3a30a908ca658eb2869b643", "structural_hash": "0a82146f3405d35bc17b08773dce3bc81f5d0b54f51225f73264a29e6f8122a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31515.sh", "upstream_id": "BenchmarkTest31515", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo $((RANDOM % 16))\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8ff50a951c148ba242400b54cd356c4b9a6038d3eefefce7220b08bb56003b0", "structural_hash": "c79b9a8dde8a635351d9733d0527e2f24cc11edd673f4545968bcffbd8e4a887", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04565.rs", "upstream_id": "BenchmarkTest04565", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: env_value.clone() };\n let data = payload.value().to_string();\n if std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) > 0 {\n reqwest::get(&data).await.ok();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60c66dbe82748e22b2bfaa9addbbc40fc0e7ca56bd2150be9b415e61fe9178ba", "structural_hash": "cf964478d66ab9d7548d52de22723ebd3e6098e63c0220d9eb2173e178515daa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05595.java", "upstream_id": "BenchmarkTest05595", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n String data = envValue.replace(\"\\u0000\", \"\");\n byte[] passwordSalt = new byte[16]; new java.security.SecureRandom().nextBytes(passwordSalt);\n javax.crypto.SecretKeyFactory skf = javax.crypto.SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n byte[] derived = skf.generateSecret(new javax.crypto.spec.PBEKeySpec(data.toCharArray(), passwordSalt, 100000, 256)).getEncoded();\n response.setHeader(\"X-PBKDF2\", java.util.Base64.getEncoder().encodeToString(derived));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4774deea12617e1cc41538f44c541e25b92fa83573f67ca57a220c41c327615a", "structural_hash": "25be5411464bb07d2810e194d06a54c779b67daf3f202ce240ebeb0370eb6a56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01458.ts", "upstream_id": "BenchmarkTest01458", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86cead94147113a6da61d9d85bb3e1544bdf15ec9a56a9e3048d2660c1ef38f9", "structural_hash": "9be0ce4821dbb3fb99eb0622f0d562cf49d003a8ad0b836496a115fa4605f903", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09721.go", "upstream_id": "BenchmarkTest09721", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tdata := headerValue\n\tif _, after, ok := strings.Cut(headerValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_info_sent", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82671b7a3d794ba171b3a921d2e547b43cb7410b707ef12d8b5af8bc35e6375b", "structural_hash": "c04b7765946761f46ee7b4f3394c5c0fc69a14b3c76daefa56714641c0d494b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01488.cpp", "upstream_id": "BenchmarkTest01488", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78868c5188e5dcf2bf0a73c1709c8221e98d7628747b38c5ccec687a0423a81e", "structural_hash": "66604269704deb0f1beba000c34c4afeaad49f5b80ff1648ae5637f2873f83cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04609.ts", "upstream_id": "BenchmarkTest04609", "language": "typescript", "code": "import { Body, Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n if (![\".jpg\", \".png\", \".gif\", \".pdf\"].some((e) => String(userInput).toLowerCase().endsWith(e))) { throw new BadRequestException({error: \"invalid file type\"}); }\n const entryFile = path.basename(userInput);\n fs.writeFileSync(\"/var/uploads/\" + entryFile, \"data\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b2b9e9886682e54e938171ca2490a63e687050a1165f4b0d2f16a42992e1640", "structural_hash": "ea0b74394ed05850d1732569a020b03f8b79cd556a7c8330ed9992917611691d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03270.cpp", "upstream_id": "BenchmarkTest03270", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char *_dst = new char[16];\n std::strcpy(_dst, user_input.c_str());\n delete[] _dst;\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "458c65eab5c6b3119de10c2ab8f4d6567d98b77c0414920be13fe99f578c60f3", "structural_hash": "c349400f7f4e31a416fe75a26a0c9de7c93edb386e691d6f5d704fadb6c7bec0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02556.php", "upstream_id": "BenchmarkTest02556", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "135b5ba859b06f6becb8e601baefad78c542a516c272bd9d4d9cb549c9ee7adb", "structural_hash": "c47ff199f17d07cecee0cc7aaad523e7336c0233a842c7aeea1c13b317f9f3ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01868.cpp", "upstream_id": "BenchmarkTest01868", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && user_input == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f84e78361ffa309c83279d754d39001d5ee69cf75b3916c16ea28036d6c05b0d", "structural_hash": "6fd349b06f7dfa65006709577d746f03b5727a5edc2dfb263d329cf7f30e1974", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21440.js", "upstream_id": "BenchmarkTest21440", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n try { JSON.parse(data); } catch(e) { }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43e3c5028861c4e5d41daa6cf8961ce99f895bad1e4c45fcc1f8bfc204355937", "structural_hash": "f48032d026b1e18e4ad5e34664a42fc8a5203b2dc737b42f00d5d5bb4fd465a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01260.c", "upstream_id": "BenchmarkTest01260", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e671117d3126467aab6e75e8a65fdeef7aa593307a81a72f11cfb9db08511f80", "structural_hash": "96672fb8b365b70432d80d638bc60d51084817554be6126a5650e20224570fcf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02619.py", "upstream_id": "BenchmarkTest02619", "language": "python", "code": "import subprocess\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = raw_body.decode('utf-8', 'ignore') if isinstance(raw_body, bytes) else raw_body\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n subprocess.Popen('echo ' + str(processed), shell=True).wait()\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19209ccbaf255501070a9d173323245ea304630b5dfe0ec41cd53eeda38316cb", "structural_hash": "d3590c98e3232ca0d245858bba345920e76cf4835a536d1104b179f0b7f331c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09816.sh", "upstream_id": "BenchmarkTest09816", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n IFS=\",\" read -r -a values <<< \"$data\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02e3b3f760c912c50d7d608512ebeeb5de8063b6cef9500b49908586c6242504", "structural_hash": "2de93a94c37cea5f4a31438a7e3d8903d70c60c09a6988ba3755b6d40bc4a26b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04179.rb", "upstream_id": "BenchmarkTest04179", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n result = User.find_by(name: data)\n return render json: { error: \"not found\" }, status: 404 if result.nil?\n value = result.name\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66edbf2e525fbed2c14872991cd0387c4ffebc492adae2ddbcde87b726dc2271", "structural_hash": "e764ac72e09504ec7b8564f10920c8e31554cf387287b69c86f8c7840dc50bed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01770.py", "upstream_id": "BenchmarkTest01770", "language": "python", "code": "import logging\nimport re\nfrom flask import Flask, request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n ctx = RequestContext(raw_body, source='form')\n data = ctx.payload\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n logging.info('User action: ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a9bf39ff3b8f79bf8e5e2e060561bc27714bf4c812bcc60ff7e9ce4ecbef49a", "structural_hash": "60bb26f92c3df513a617054b70903a933b55ae901bc23855e868698dfb408253", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_14325.js", "upstream_id": "BenchmarkTest14325", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const data = await Promise.resolve(userInput).then(String);\n ctx.session.expiresAt = Date.now() + 900000;\n ctx.session.data = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "097015e9f8e1c86255c90e13e7a2b2114c7961c73e4cd94c86cac61dc8588344", "structural_hash": "4581555ea8d9268c7780f0b0276252d1a4a50ae4e2efa77fe342551d7e37935f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02085.c", "upstream_id": "BenchmarkTest02085", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n long _req = strtol(data, NULL, 10);\n if (_req < 0 || _req > 2147483646L) return;\n long _alloc = _req + 1;\n printf(\"alloc:%ld\\n\", _alloc);\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d631c828c584a55cd34d11990c79b72dc6e3d8a368b9e1634eabc794b422acb", "structural_hash": "7d839e5c38b95a4070447e89beadc4dfcab4b5999d2de5429bf38a5613347d96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26276.js", "upstream_id": "BenchmarkTest26276", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.set(\"X-Custom\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdf69f923c0fee639e1a3e689da83f8a05036fcbcacb57fe00eb35a51842ed7b", "structural_hash": "53910c9fce5574184762a8b2caa91e9514d383d73186097f5c0635eccaf6e49f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03814.cpp", "upstream_id": "BenchmarkTest03814", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "539e18f905193259e6486986d4ef6813e02abf72198e8ca13adb78766c83b482", "structural_hash": "20c245b2b5ab7dffabd5d1abeabeb9be04a6b6547aece4fa45065fab92786d99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00657.cpp", "upstream_id": "BenchmarkTest00657", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Host\");\n std::string _msg = std::string(\"DB error processing '\") + user_input + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "caf8c0eb50fda40077a6bf2d596cf690ca88d3fda9f4a964da6d803388881629", "structural_hash": "142a1548ca18d57d9155283e9f70da8ea4db4a92649d109dc1bb715d326e37c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03367.rs", "upstream_id": "BenchmarkTest03367", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: raw_body.clone() };\n let data = payload.value().to_string();\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "639d2984560179bfe473bf79baa1848c39213eee684ffaf660f46d8d890221d0", "structural_hash": "2b627c499616cf66fbe26034682f5f3b7e6e0873ba618d4feea5a55e1332081c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01105.go", "upstream_id": "BenchmarkTest01105", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(headerValue)\n\tif data == \"localhost\" || data == \"internal-gateway\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-940"], "category": "unverified_comm_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35703b746f00e1e5ce787fd05d5bf3c151aa15c00ec5bf1383e98641aa2e1884", "structural_hash": "d44b154a3247c93502df0a446e46d3b0ad0c7c72bd5cba549eb171c418b25f44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01288.rs", "upstream_id": "BenchmarkTest01288", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = json_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce6be10c588a11dd9f6e7b5f352d15b6315ba18135f12307338e2cf5efa286a6", "structural_hash": "9709519443221d387b1c933185066576b5a242a85c92cbd2d35ba0edcfebb88d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04351.ts", "upstream_id": "BenchmarkTest04351", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n return { listing: entries };\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f58ea404510efd007bca6c29ce7914f91ebccdc6217349f3174cfe19c144a76e", "structural_hash": "a4e8cdf36442a025076590f4f4cafa1b54d3b57cb40ff59821b3305262717e40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01796.php", "upstream_id": "BenchmarkTest01796", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (!hash_equals((string) $request->getSession()->get('csrf_token', ''), (string)($request->headers->get('X-CSRF-Token', '')))) { throw new HttpException(403, 'csrf mismatch'); }\n $conn->executeStatement('UPDATE users SET name = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31218ed3d144ae397103858a5f3b42070fc928ab25d7485365d29bb0f3cda7f5", "structural_hash": "b38057b28602713b2b8b0533597ddac7dce3b3730bf512b8396d1f451e60526b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04070.rs", "upstream_id": "BenchmarkTest04070", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = json_value.to_string();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5597d4ade496d229322acaeedccf8fddfd808c109895e17d59484b5a0a76a1df", "structural_hash": "98aa37c26b8ebdd195334edf8d4c5aa33e8adb7ea58aeb7fbe325c47e909294b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03807.php", "upstream_id": "BenchmarkTest03807", "language": "php", "code": "input('field', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37b10fe0dbd7c22065b159f3ed5c773c82a103a8e070d6accd7ea7393279b4bc", "structural_hash": "c9bbf40f8705ac7b68480da6a7ab25920a5d849fd9e22e53ee9f85ae3f176b91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_39560.go", "upstream_id": "BenchmarkTest39560", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := strings.ReplaceAll(jsonValue, \"\\x00\", \"\")\n\tencrypted := encryptForStorage(data)\n\tos.WriteFile(\"/var/app/data/store.dat\", []byte(encrypted), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7ecfc30576d191d2d714050089937aafc8ac9c284eaecc0adb6eec82861e05b", "structural_hash": "56d1d3cb99347d2d6e369f58eb0e5622c3c7a5aa3482ec6bc5808b890352d73f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05324.ts", "upstream_id": "BenchmarkTest05324", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6742d50dcbf899856a8d78abe0b8255eaba8187f2afbdd4652e3700867c2df86", "structural_hash": "0ed046133d657035fb446b83a593f5f10e0dfe7b27cd11410943a4d78891f7ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13340.c", "upstream_id": "BenchmarkTest13340", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n free(_p);\n}", "label": 1, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37310e0ac3c3ef3bc5969951678afa4f730a34e2450c73106562b6daecba3e19", "structural_hash": "34cff97ce6d3dd31dd63db16f67f6548fcb2122d2916179866baa9daa5da818a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03803.java", "upstream_id": "BenchmarkTest03803", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : authHeader.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n Object evaluated = new jakarta.el.ELProcessor().eval(data);\n return Response.ok(\"
    \" + evaluated + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2db3c5c7b46734eb29ae2c6750f7fcc5acb995686e2ba4d0a63c19ed5eb811ee", "structural_hash": "46c586b503952610480cb7c02497cd5e9ea8715351ebf93e1c8c94dd98804aa9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14991.c", "upstream_id": "BenchmarkTest14991", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n _p = NULL;\n if (_p) free(_p);\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9c3258c52f59fa96569a760b4de8ee7724e3ec97661308c55e371a37f527bc3", "structural_hash": "c95d32e74483d046a9ccf49a5ee70c669033269784ab3da07729323e1fccda82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05552.php", "upstream_id": "BenchmarkTest05552", "language": "php", "code": "json('variables.input', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48e69a0380254acd2f649b5565adbad11e22f10c0550c4a2cce5e3113dab0b72", "structural_hash": "0749fcac8d80d69a11dd175c6a47eacc7b1afa939d8d4623097e73851a848674", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02546.py", "upstream_id": "BenchmarkTest02546", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom fastapi import Form\nfrom lxml import etree\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(field_value).encode(), _parser)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b1cea8193e922e063e42ddce1ffb102aa599c1bd46cf2aed47ff55638a771ed", "structural_hash": "4a1f5c5b580769e47c98dac669fcd37491904c62016abc500376347edcf8ceb1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00875.py", "upstream_id": "BenchmarkTest00875", "language": "python", "code": "from flask import Flask, request, jsonify\nimport json\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n try:\n data = json.loads(auth_header).get('value', auth_header)\n except (json.JSONDecodeError, AttributeError):\n data = auth_header\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec52e9e8abb71742a02da6c39321b67b9d7cd0e21b437bd8662819e521521174", "structural_hash": "1e52d4a44a02d3038432da0d8e33710204ed5a4b5ef04acd8673e249dfb92e14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02388.cpp", "upstream_id": "BenchmarkTest02388", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca4f0fff1cfc4ed0882bf7616ed1d53f447120f2cdf09be140d6a58f53e0acfc", "structural_hash": "5795b54e26cfbefd594512ce66df09e0df2b5b00886448e4f539ea8f7a2c06e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02759.php", "upstream_id": "BenchmarkTest02759", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $data = str_replace(\"\\0\", '', $userInput);\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ad4ec73ea07bc521814ada679809fb8854ee4b47be337d8c6ab413c2fa141fd", "structural_hash": "e6e354df40f8eb510f8ae9b2bbcb12f78b2f8fc837cab70a0b41e7c7e2c513ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00546.php", "upstream_id": "BenchmarkTest00546", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $data = '' . $userInput;\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8541a6c2e8b0ed1120446c5fb7bd4ab5c7c2532bd6ec0b94dade9cc9b0dbc300", "structural_hash": "8e6f2614ea5ab146d7c2fe2bb785c67223c27a340d1c50ab999c9fe4d72e69a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01475.php", "upstream_id": "BenchmarkTest01475", "language": "php", "code": "headers->get('Referer', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $resp = new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n $resp->headers->set('X-Frame-Options', 'DENY');\n $resp->headers->set('Content-Security-Policy', \"frame-ancestors 'none'\");\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1150f514d80d1be6992884fafc87121b52b6221b8f529da86f7952bf9ea793b7", "structural_hash": "debc15f40560c6786353487174e03504cdc929265f8698c0133ed9e9526575bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02717.rs", "upstream_id": "BenchmarkTest02717", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(multipart_value.clone(), |s| s.trim().to_string());\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e69cf3e44b37d2af9c7ab68203efaaef80cd5e305456874fb7d31865783f8df", "structural_hash": "c64fc722d7db6e7edefd086b73813e9ce7bf28aeeeaaba562c23bf2de16458fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12374.go", "upstream_id": "BenchmarkTest12374", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar profileBio string\n\tDB.QueryRow(\"SELECT bio FROM profiles LIMIT 1\").Scan(&profileBio)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(profileBio) {\n\t\tdata = normalizer(profileBio)\n\t}\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce8b7fc0f3035cccd74df8bbc28d26f5e25483b1d8a20c33a6f57af872f1c369", "structural_hash": "a7e1ba2c2575dd0aa4f72948f7c8534ec7905fedb460b79f172dcb1ffd2b2264", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20880.js", "upstream_id": "BenchmarkTest20880", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d68ef3bb33722204ba6f9536e2f22563411acab66a8c30d7299491284a11f8f4", "structural_hash": "dacc24e88d80c1eec2b7a8919a09bb05ed2752ccfe93b18686ff874f2c7bc456", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04841.php", "upstream_id": "BenchmarkTest04841", "language": "php", "code": " (string)$userInput]);\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { abort(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a2d89b049e8a3354e4578bb5b1a82531f570310a6d87b53694480cf099a6abe", "structural_hash": "92349198fbac817b4e5a11594e1f1ea7ff217036720e4f1aadce26887b0a29e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33705.js", "upstream_id": "BenchmarkTest33705", "language": "javascript", "code": "const http = require(\"http\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4a887c6186eac5c87e1af63b930ac5cd532e8dc079c26f72d8405e37b392b7d", "structural_hash": "d46072ffa7a7235e5bb5485b7936c25a4a4c52500902f0f384989e360fd3698b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08856.sh", "upstream_id": "BenchmarkTest08856", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n data=\"${user_input:-default}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f44bbd5eaee25bc3430f61464b11eb2f3b14894bda6b5fe4409262a2c932987", "structural_hash": "5a1aab7c5ec1afe87dbfa5307ddcd7b26bdd077e5ff461d5215002104e7cd96a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03597.java", "upstream_id": "BenchmarkTest03597", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data;\n if (userId.length() > 256) { data = userId.substring(0, 256); }\n else { data = userId; }\n ProcessBuilder pb = new ProcessBuilder(new String[]{\"sh\", \"-c\", \"echo \" + data});\n pb.redirectErrorStream(true);\n pb.start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3a76f368d1bb69d737b7d62ddb1d125291c4b9ede96adfa3973a7788c87f27b", "structural_hash": "f029f590e435127a5c3dabfd439467d35bc5e5eb01a7aafade24ad7ae54761a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_05497.js", "upstream_id": "BenchmarkTest05497", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const data = \"\" + userInput;\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + data + \";\");\n require(\"/var/app/plugins/generated.js\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f810c1364277af4504910d06542cf43e9868bba6731f390060dd313145dbabbb", "structural_hash": "52770d433dea9e2d3eb438bdb94aaee4b1e8e98cbfaf64474b749c0b317881c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02491.java", "upstream_id": "BenchmarkTest02491", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> forwardedIp)\n .thenApply(v -> java.text.Normalizer.normalize(v, java.text.Normalizer.Form.NFC).strip());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setHeader(\"X-Frame-Options\", \"DENY\");\n response.setHeader(\"Content-Security-Policy\", \"frame-ancestors 'none'\");\n response.getWriter().print(String.valueOf(data));\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0d4a2e238846f0fd074752b43990ba5244fd70bb2760d4f3684a8db37680caf", "structural_hash": "7c877fd5377c9a1c5b06e9733dbf4665c39e01e717a582e43d85323c98b44d6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_20531.go", "upstream_id": "BenchmarkTest20531", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"regexp\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tsegments := strings.Split(jsonValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tinputPattern := regexp.MustCompile(\"[a-zA-Z0-9_-]+\")\n\tif inputPattern.MatchString(data) {\n\t\tw.Header().Set(\"X-Validated\", data)\n\t}\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d58a8c6fb47b7b3f15d60cda2968309c68a57162652a6e8649b475219828c28", "structural_hash": "3e22f6fe608d8a3ca6351ae26412b628171d671c5bdeee3b0ed12493e3f2b8f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02622.cpp", "upstream_id": "BenchmarkTest02622", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n std::cout << data << std::endl;\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f488d9e3949cd4cfbb2309a9c7180efb09b54128b79f5797393220ef9076f6d3", "structural_hash": "09a1123c033e398b92026ab968e6a2d7df50d8de16d7c2677821aa6fa68ca93b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00725.py", "upstream_id": "BenchmarkTest00725", "language": "python", "code": "from flask import Flask, render_template_string\nimport ast\nimport asyncio\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n try:\n data = str(ast.literal_eval(path_value))\n except (ValueError, SyntaxError):\n data = path_value\n async def _evasion_task():\n return render_template_string(data)\n return asyncio.run(_evasion_task())", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d241c2658271463ee3b97df13f94ac7793bb3228e7d76035c6b3566327a5cc87", "structural_hash": "abe0a5a265ba0ceb07c6ff024441e6a9b8b6d31e1582bb0b5822ee308e528bd5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01633.ts", "upstream_id": "BenchmarkTest01633", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad60b2887395828c0c302bfcfbf82cfcf8c7ea39c49393447808b4ba2af9a2ee", "structural_hash": "320f8039daf658a6229e3747972b5b1ad4fd68188f3a7938807c2779a02d7970", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02845.cpp", "upstream_id": "BenchmarkTest02845", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data = cpp_module_transform(user_input);\n std::string safe = data.size() > 4 ? data.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n res.set_header(\"X-Trace-Id\", safe);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41e78d7716740b8102be0180d3afdfce507ff1cbbfd9a9b7bca881d80adf870b", "structural_hash": "035c433a944e7d1d50320e4a5f1719152cf118b0a69a95aef8eac92b506bf3c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02462.rs", "upstream_id": "BenchmarkTest02462", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", host_value).ok();\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n use sha2::Digest;\n let _digest = format!(\"{:x}\", sha2::Sha256::digest(_body.as_bytes()));\n let _expected = std::env::var(\"FEED_SHA256\").unwrap_or_default();\n if _digest != _expected { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6744863749985c84b1722b56255bf84b66e1979bde9085e6c76ef20b7f77f7b", "structural_hash": "b707c63af044ad1e2221ee9bf4ee9a01daa44de9981cbf2368fe550dfa7ef8ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02513.sh", "upstream_id": "BenchmarkTest02513", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e6778ec2d19688e824b0eb62fe7701c35e585496b2ca22d0f4e4937cc5afcb2", "structural_hash": "da7c552abaac0065301b01deb6406af5b5a4bff15789c448c3442be2f3988ce3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30859.js", "upstream_id": "BenchmarkTest30859", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.query.items && req.query.items[0]) || \"\";\n const data = decodeURIComponent(userInput);\n console.log(\"Action: \" + data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84676c7b8f1e6185a9a351205e6323862b7ae5b1598628afb76b03a1aeda6df2", "structural_hash": "353297cc9496d4fe428b60a728549de18e47eb70ec081a1ce4e20e4f73c47b88", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10319.sh", "upstream_id": "BenchmarkTest10319", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n data=\"${user_input//$'\\x00'/}\"\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c20bde0369c98010efeacba248850604763dc40b646c4fdf21c684b36d0e3fb", "structural_hash": "e5ca1f5bc738bab4bdce901bc13357d2121530ecf17a8c198cea38e406d4079d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04307.rb", "upstream_id": "BenchmarkTest04307", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n if data.to_s =~ /[a-zA-Z0-9_-]+/\n render json: { validated: data.to_s }\n end\n end\nend", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6324b1e65d15376076955c908bd47b764f4f33fd6d737d7ac8f4b52cd65eacbf", "structural_hash": "8ba505ab626c5171866899c0b5a4e5783f67a03ae138953ec1d82f9e0fb21141", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06488.sh", "upstream_id": "BenchmarkTest06488", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b9fb99cf0e6a8301ebb35d3451fcd935b59ab4eafa5c5e96b5daf68c50f728a", "structural_hash": "96d2e6b57110739bf8f0c7e70df7059a9e8772224ba02501e378561e1f71044c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_40655.js", "upstream_id": "BenchmarkTest40655", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-332"], "category": "insufficient_prng_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6fda2b655a3a790fb0532855d5074006930c0a033d78a681020e13201747419", "structural_hash": "5927356a1eb094ad8a2fcbb75ce17b838f92653bb780c7c7aafea38832a4ff99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02054.java", "upstream_id": "BenchmarkTest02054", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = \"\" + refererValue;\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.KeyGenerator kg = javax.crypto.KeyGenerator.getInstance(\"AES\");\n kg.init(256);\n javax.crypto.SecretKey key = kg.generateKey();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9f0ddae65eca8136bbf21dce292c91da5280bb35a7db697d4fa8c7e7fdfd42a", "structural_hash": "941846e9ec01f20558a995a60a5c0b2785ebe4bd411e0a7d70895745793a5d0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04904.php", "upstream_id": "BenchmarkTest04904", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $processed . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa95381ce1008d0242584ca92f29537b3e2b23db197194d597caa82bca7559f7", "structural_hash": "d6a6e5b139999ac5f32cbb6f15faf72f1b8b064f2467081e0c2a87f1a9e7957f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02901.rs", "upstream_id": "BenchmarkTest02901", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let data = match user_id.chars().next() { Some(_) => user_id.clone(), None => \"default\".to_string() };\n crate::shared::render_html(&format!(\"
    {}
    \", html_escape::encode_text(&data)));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f274c6823b227f07a1af2faa808098dea390c0eda379bb6fd3151ac52bf2c676", "structural_hash": "6cfa1ab44f3701d395fba1460d0c9aa09e81ee170449dcffb95d7c6eb5acfd56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01044.ts", "upstream_id": "BenchmarkTest01044", "language": "typescript", "code": "import { Body, Controller, Post, Req, UsePipes, ValidationPipe, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Req() req: Request): Promise {\n const userInput = dto.payload;\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "879d41dd655927009b3f929811b506152cb30df0935752b776ed54a7dafb4e85", "structural_hash": "125beea7ddae3b7eea24a4d6068e007a5ae48b1d7e98775a46f60646e4ec15d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01517.cpp", "upstream_id": "BenchmarkTest01517", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << user_input << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43c8caa4923160635a573017c8606c5c0c37337647a10c0fe8e0389c197ff90a", "structural_hash": "73c0a2bab159ee94e8c3297b2f7521a37c932a2dd9e68e9a9d46a350e66a8307", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04073.py", "upstream_id": "BenchmarkTest04073", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n ctx = RequestContext(env_value, source='form')\n data = ctx.payload\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f758da735733f9ef886441987be7ac14c346de6eea2eb9fa4c5014e7214435d5", "structural_hash": "66f0e4f8a910f53ed36c6f2ed401b90a31c8496359ef51fbe9e9fe318706e9dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03116.sh", "upstream_id": "BenchmarkTest03116", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "685a0a5dfb6571b579face705c3d50eb6f02e3d5e3685aa09563ebe0c87ea8b4", "structural_hash": "09ba42f4e03a4f03b33028968cd0c10b69d088a9296def07e0f1a9a9999fcabb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02719.java", "upstream_id": "BenchmarkTest02719", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String stripWhitespace(String v) { return v.strip(); }\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = stripWhitespace(rawData);\n java.security.KeyPairGenerator kpg = java.security.KeyPairGenerator.getInstance(\"RSA\");\n kpg.initialize(1024);\n java.security.KeyPair kp = kpg.generateKeyPair();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"RSA/ECB/OAEPWithSHA-256AndMGF1Padding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, kp.getPublic());\n byte[] wkBytes = data.getBytes(java.nio.charset.StandardCharsets.UTF_8);\n byte[] wkSlice = java.util.Arrays.copyOf(wkBytes, Math.min(wkBytes.length, 62));\n byte[] ct = cipher.doFinal(wkSlice);\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a9de933dfe8671a9fc397f896fbc6d5fbd4ddf16d7a4926319d437ab6404261", "structural_hash": "4881dd7ffe2feb833252285e4300683e86ae43392b692c4bc91c449692958b2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04287.ts", "upstream_id": "BenchmarkTest04287", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b99f7f8ff6048615c64b8a2e7fd0ff5230ba965afa59755497f4758096484d33", "structural_hash": "9eded7aef30977f56c24c0afb328b3c8a42c434e4fcd52157ae74f6bc168bcc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01805.java", "upstream_id": "BenchmarkTest01805", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data = headerValue.replace(\"\\u0000\", \"\");\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n LOG.info(\"Action: {}\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "462198ab9a41d980f13a3d399a67a276481c0fa9aeebb193a11804b8f3512bb2", "structural_hash": "e286270d22201cfde8e6e3de99a431be4dd4f36badf4f7fd45d291321aa07e03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06309.c", "upstream_id": "BenchmarkTest06309", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n void *_h = dlopen(safe, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b7dc52f41d42ac37a26f5de43a8be898f60e377bbe8f101506d072d98fb075f", "structural_hash": "ccf7f203d397823bc402425f14c40276a741725b2bab812c5fe2bc07b6681312", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03910.c", "upstream_id": "BenchmarkTest03910", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e752765d7eda6ccb4efb20abbcf49f8ed38cbdce345dd98813a4f606be6f33df", "structural_hash": "5a0fc589eeb9cb1fbd9a644dcafc9e236488be035417669b8c1043a1ca2ba7e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24062.go", "upstream_id": "BenchmarkTest24062", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tdata := headerValue\n\tif _, after, ok := strings.Cut(headerValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tif data == \"S3cr3tToken\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-1125"], "category": "excessive_attack_surface", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebec7cb14eeb630fbb6c8d6a7966ac8a2d8db0ebe77ac129038b565c4d6a1786", "structural_hash": "bd82ddf5e619e6d64de15734cc023189f76cff1c4b576658406c7a2bba4b7385", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05378.js", "upstream_id": "BenchmarkTest05378", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = passthrough(userInput);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-285"], "category": "improper_authorization", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7682b1ddcca6284b1a87814eb7010eb0a83f0f8b2316c4e24d557a7f0726c927", "structural_hash": "8f82d71795830ff2d2ff1de8019cc054006c7da27ddede63c439efb53c2bd016", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04572.rb", "upstream_id": "BenchmarkTest04572", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n data = \"%s\" % user_input\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5aab40111ce60e66a4a0b0d24b4985c019860fa4e115f106a3b56d8463547cd6", "structural_hash": "9604c7fad6a193cefcaeec436fcbca3b7936c94a0935ebf41340312af2b1c62e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02853.java", "upstream_id": "BenchmarkTest02853", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"file\") java.io.InputStream fileStream, @FormDataParam(\"file\") org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uploadName = fileDetail.getFileName();\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + uploadName;\n String data = valueSupplier.get();\n java.nio.file.Path resolvedBase = java.nio.file.Paths.get(\"/var/app/data\").toAbsolutePath();\n java.nio.file.Path requested = resolvedBase.resolve(data).normalize();\n if (!requested.startsWith(resolvedBase)) { return Response.status(403).entity(\"outside safe scope\").build(); }\n Runtime.getRuntime().exec(new String[]{\"chown\", \"appuser:appgroup\", requested.toString()}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok().build();\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70081d281ac786dcac86e896267ee7264fcff44addb3da252af7f7d9949c115b", "structural_hash": "7f5a187aacaff0b3ebd9b16dce06331e22310ce400d5085edf09ff463915bf96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03801.java", "upstream_id": "BenchmarkTest03801", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(originValue)); }\n catch (NumberFormatException e) { data = originValue; }\n java.util.Map records = java.util.Map.of(\n \"1001\", \"alice profile\", \"1002\", \"bob profile\", \"1003\", \"carol profile\");\n String record = records.get(data);\n if (record != null) {\n return Response.ok(\"{\\\"resource\\\":\\\"\" + record + \"\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(404).entity(\"not found\").build();\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:idor", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d769b788d3600ced02a3dfcd905fc5d870a2d86337c091863d0769f917c71ac", "structural_hash": "bb5b75ca7a6a922544f8d6e8a837a423d2895366a5973a5c059e50e7724b5a7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03412.ts", "upstream_id": "BenchmarkTest03412", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const data: string = shared.passthrough(userInput);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8bc9672f20fe58ae8e31abb4f31a04d9398e5ebfa06e8b48f7df1ed935e2356", "structural_hash": "a62425f7a2caad04a69041e98e716cd3d72ec582c54720336c187adb05005fd7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02933.cpp", "upstream_id": "BenchmarkTest02933", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic thread_local std::string cpp_shared_input;\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n if (std::time(nullptr) > 1735689600LL) {\n res.set_redirect(data, 302);\n }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ff2c81a311b51eb9cb7bb5572e7e0619ed09ba3b2b4d6ea0d136610293afb72", "structural_hash": "348e2ca77607c2b7db549dad81c37382e05f231d86abc69ece25f47bfae67eab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08808.sh", "upstream_id": "BenchmarkTest08808", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"audit actor=$data action=session_revoke result=ok\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "637ede40d4199989b596a2eb4749d383d212f5a5fb57887a56c81e5aca7770a2", "structural_hash": "f04f217e069b71635ba6fcae7970aac9626b031eaf0e9a051c9de8cbc3527fa2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19542.js", "upstream_id": "BenchmarkTest19542", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const data = `${userInput}`;\n ctx.body = \"
    \" + data + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e12fbb4e7d0837b936e7572d27a7cdc60694ae44241c0cfe642a6fb2266ccbf", "structural_hash": "a999cd38c7f32719787b3c6f3a035e7ea013b967ec88eac2ebc1dc17d399c809", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01428.php", "upstream_id": "BenchmarkTest01428", "language": "php", "code": "input('multipart_field', '');\n $data = str_replace(\"\\0\", '', $userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6da80afac736a226a9ea9ce682359eac8e4179903974fee698bcaeb72ccb518c", "structural_hash": "19656175f99909ee602f571c5007a70e85e4fd0ed371f223525f83eeb3b10e1a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02274.rs", "upstream_id": "BenchmarkTest02274", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in header_value.split(',') { data = token.to_string(); }\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2aa83c4d98e1ac32846ff94e22a0396437d98c0c46a1304917ebf4c11d0ade2", "structural_hash": "60046dc7edc7f85d4ea3eab9985affb3b80f46ef8dc0e26df45784d484bbd2c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05830.py", "upstream_id": "BenchmarkTest05830", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\ndef trim_value(value):\n return value.strip() if isinstance(value, str) else str(value)\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n data = trim_value(multipart_value)\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54db77151cffd1bcc9c7bfe2248c7f41f78562db012955a4a6930c3b2b3beae1", "structural_hash": "7798e5a5eca3a4e17046db0cf6f6842bf10d9b6da30041e5801e4832f4d766c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02359.py", "upstream_id": "BenchmarkTest02359", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom lxml import etree\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n reader = make_reader(json_value)\n data = reader()\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d6148afb231c8671ca352fa285c70db3ac4ae282d529636cb1797b8ec28930a", "structural_hash": "4bc6864080e52829a43851fd9de5e7d32bcf541c9daf8e0e4935149c6649c8b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23700.sh", "upstream_id": "BenchmarkTest23700", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(printf \"%s\" \"$user_input\")\n arr=(10 20 30 40 50)\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n idx=$data\n echo \"${arr[$idx]}\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18875d893846ce8e7b7e7b021b0ca640ab8e7244440d39f5e8cfc5dfc3ad7e7b", "structural_hash": "79b24fa87320ef795d9d55cae5020bcc4e39fa73cf3aee82dc5463d9ed094032", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02173.java", "upstream_id": "BenchmarkTest02173", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + uaValue;\n String data = valueSupplier.get();\n Runtime.getRuntime().exec(new String[]{\"chown\", \"root\", data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "719ff158d05fab47717d5f64848d002eec6f5f5602389aeaf5fd358ba5aae503", "structural_hash": "e209128fdea9fd6ee3e6ffd738883d97d6d0c8f993715f866937e510991eebbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20325.go", "upstream_id": "BenchmarkTest20325", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar _b strings.Builder\n\t_b.WriteString(rawBody)\n\tdata := _b.String()\n\tc.Header(\"Access-Control-Allow-Origin\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-346"], "category": "originvalidation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9907e46b913667f72531cab5dc8afde33c4cc2ed0c1102ee438d0907cba9c54d", "structural_hash": "a626110b8436ee90b767dea3ba175e37612eef763aa79baf207b776bfc8281c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24551.go", "upstream_id": "BenchmarkTest24551", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tform := FormData{Payload: jsonValue}\n\tdata := form.Payload\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tc.JSON(http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-331"], "category": "insufficient_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa9297a9953b60c78874a8a0d4e25101a4bc5878068845407a1f5553666a8caa", "structural_hash": "019468cd8b87c78a7aabedb238bb6d3e332e91f76c33a2bedc51eb5129ea9116", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03158.py", "upstream_id": "BenchmarkTest03158", "language": "python", "code": "import html\nfrom flask import Flask, request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n pending = list(str(graphql_var).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n processed = html.escape(data)\n return '
    ' + str(processed) + '
    '", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96413b637239f4f8159acec60f11ddcff4bc462033e56e84a46f63c15d980fe1", "structural_hash": "1dc4293778c877aeb0f82a84de96cd4b8e95635619583da0847da6a224320776", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28098.sh", "upstream_id": "BenchmarkTest28098", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n curl -s \"https://api.lan.local/lookup?q=$data\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d829f19f4d7d208112884f2d6c17f4d666b51330bb7bcf3ec1aaf5e427cd158", "structural_hash": "8515329fe30279639937f1c3c42adbbb2886eab6e0bee7d512ea2eb5920277fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04696.rs", "upstream_id": "BenchmarkTest04696", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n let data = if multipart_value.len() <= 4096 { multipart_value.clone() } else { multipart_value.chars().take(4096).collect() };\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3a6ea826737552e4a013d35a6b7896361a67d4770400770c7489091454d0216", "structural_hash": "f879c709a3bd060342002089106a8ceb7faf12ba7798a41760322276be460229", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02754.php", "upstream_id": "BenchmarkTest02754", "language": "php", "code": " (string)$userInput]);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d612056bca80f2c539516522d0504594d977b14b5c8e998a7db49ad36519bc5b", "structural_hash": "c977c1c8fb61ba25a353969ab6d04e4c9d6d63148f76dc27e1f3791345325c87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_06069.php", "upstream_id": "BenchmarkTest06069", "language": "php", "code": "header('X-Custom-Header', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "091c5a2ebef662c7f78afab200c8abaad1e71e30eb000693163b9db1af2d5610", "structural_hash": "daa77e61bed949da0014498f4912a933ceab6e6bb037e63650db57f5fec18131", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32177.go", "upstream_id": "BenchmarkTest32177", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tdata := strings.ReplaceAll(multipartValue, \"\\x00\", \"\")\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14f4f866efb75fa4a341a659f6c5eb15ac12eb23477540df4d1e70685fb5cfab", "structural_hash": "ace48944510224c05e69db8d10d4783092902da197cc99048fdfb6031be5f72a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01663.rb", "upstream_id": "BenchmarkTest01663", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n eval(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0cccce3ecce0ab55ab9d84a8f8bc6bead5694ebb608762f9209370e3e4daf48", "structural_hash": "b499e5340e2aad403853b8a6c9c64f46744257f948e7471e219db0d7618fca08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24881.sh", "upstream_id": "BenchmarkTest24881", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a21b15e255105f7c020e497233d4c06be75231f6f2711fe5f0f3a17c3a904e43", "structural_hash": "8eb711921427d164e49677f27701a2113cc3533fdbd6c1ef0aff14abcfc00623", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02798.sh", "upstream_id": "BenchmarkTest02798", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n eval \"echo $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b03c1155a3d2bad948038053feeae2d37b09912ac6690ecca42a06c19dd05461", "structural_hash": "cefbd46fd527c8cfe3ae6a9ac312163cb2a479e4b45324835d6e9b3d9dff64cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01557.ts", "upstream_id": "BenchmarkTest01557", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const _host: string = new URL(data).hostname;\n if (!_host.endsWith(\".trustmesh.internal\") && !_host.endsWith(\".trustcdn.io\")) { res.status(403).json({error: \"forbidden host\"}); return; }\n const targetUrl: string = data;\n res.set(\"Access-Control-Allow-Origin\", targetUrl);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fd55b9132ad07ccb8780c9174ceb480487d140281bd259bfd1b3bc0217d7ef8", "structural_hash": "856e79f0ee2520716c76844c876c5449c469c337db1bd7d204054c4a001cdd8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00089.php", "upstream_id": "BenchmarkTest00089", "language": "php", "code": "input('field', '');\n $data = vsprintf('%1$s', [$userInput]);\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "477baf89ca62074d90744ad000f206b1ed77ee0767d9e59ec1c380ec6248017f", "structural_hash": "a8eb5689baa0454d4b33875b20b6bd0d7f9dbbc548d3ec37737543c6b4a2f9c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00416.rb", "upstream_id": "BenchmarkTest00416", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n data = CGI.unescape(user_input)\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1d7754bd7979b7d183ee432bd36ef5ea55ff2b9e4f7f834f4a94cc1bbf96d7d", "structural_hash": "68a80b356cadaa778cbe161d2ede3222fe6dd6e050576203e69b75f06f5c352a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05096.ts", "upstream_id": "BenchmarkTest05096", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n res.redirect(data);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c99138c24feff5a75e5bc664ae4f13d347d2c4c815696f809d5d7d878a6fc408", "structural_hash": "866b0f9da87691a41f1a96a96865acb630610e26fd7d85aba43ba83ea0abd4b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03415.java", "upstream_id": "BenchmarkTest03415", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : originValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "172e27f73f74ba927860ed24c6f94eea934d63ed53052caf72d13d878a39cbc3", "structural_hash": "d34f68966b79a9bfc8e12cf72e74e49a965146e4a0dfb1f59752be170bda4ca2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02140.rs", "upstream_id": "BenchmarkTest02140", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let queued = db_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d48c98dbd0a76ffe4364bef123a956a7bd36794ab48227a12062379803b16be", "structural_hash": "4e6d1ac7243425879bdfba10a00d44f4697e77653a3cd8466b350e506504c3eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03396.py", "upstream_id": "BenchmarkTest03396", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nimport os\ndef benchmark_case(request):\n secret_value = ['feature_flag_value'][0]\n def normalize(value):\n return value.strip()\n data = normalize(secret_value)\n store_cred = os.environ.get('APP_SECRET', '')\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea4ba34ed53ff5f663d2d5bed850420a10287c136ad8a5c040a566aa1e9b08e5", "structural_hash": "4e16792a7702c47f92c4f90e52efb93237f24de2fa9f548425fee5386aa791a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01814.rb", "upstream_id": "BenchmarkTest01814", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n @user_input = user_input\n data = @user_input\n processed = CGI.escapeHTML(data)\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fe0f01c40f1f9e42e72145bde983381bb95710dcc1d7db26a1e1f52520cc169", "structural_hash": "4291c089e6729de1404d50a261bc570dfcc0de7dfe4e9de034e0a19db9b0dd8c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01175.rs", "upstream_id": "BenchmarkTest01175", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(graphql_var.clone());\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19fdf4debf2c4632b5af1e508d4e4155fb92671c25b2c13250ab9ba73ab3df19", "structural_hash": "f830240fbfc621b286ce15c4ed1e2f23940933f8a826b644999ffb770694cdb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04373.js", "upstream_id": "BenchmarkTest04373", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(userInput).toLowerCase()) ? \"true\" : \"false\";\n eval(processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81f258a469053baa7d1f5083e7a6d91885e1b15dd14113627c06238e2d9592c2", "structural_hash": "62e02541a79a93137a7849158c642e7b5c5f7859848730cd156de0d7ef48d553", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03040.py", "upstream_id": "BenchmarkTest03040", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n data = f'{auth_header!s}'\n if str(data) == 'S3cr3tToken':\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e5d192ec46b282826301afd836b4720d3458534f62f41280fc59d58f39b5ac4", "structural_hash": "d296d48568866d131550172391f191a0b783eb0f1e50f4ee0d308e7bac7ee5bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00686.php", "upstream_id": "BenchmarkTest00686", "language": "php", "code": "cookies->get('session_token', '');\n $data = hex2bin($userInput);\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$processed]]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1b8f9ae9cbb8b3dbf9791fb16261fb56afe64358b0cee464fbdee921f838355", "structural_hash": "1a634f8db6e79310a79a14b2b6f86a0d26172a5af368758171c5da4fe1d0eba5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01069.php", "upstream_id": "BenchmarkTest01069", "language": "php", "code": "request->get('multipart_field', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ad3f563389232174861dcdb1d3705584037e520f08b0abca1249317c09da8fd", "structural_hash": "ad4a03b8306e11c42cfe85e928f8f3208a16b43ecb19f64336e3f381aecaaa14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03995.cpp", "upstream_id": "BenchmarkTest03995", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d19eef6d874425a215a98c3eea1a63db09bb4764e474a6bdaa45d7635299fb8", "structural_hash": "dc2f5776946d50aeb39047f4ef553b830e2f72ee733f175e89efaec93613b0b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16842.c", "upstream_id": "BenchmarkTest16842", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _req = atoi(data);\n int _alloc = _req + 1;\n printf(\"alloc:%d\\n\", _alloc);\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcb04ab295466f61093db5096504c7a9ef2c7df40284c9515612228a860a3641", "structural_hash": "d20af39d2376cf1c3dd9d5bfc9c7bd84b434d72aa205a05d36247a1182c559a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02716.rb", "upstream_id": "BenchmarkTest02716", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = sprintf(\"%s\", user_input)\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n halt 400, JSON.generate({ error: \"invalid type\" })\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38644a564db65c28109a4b337cc77726e8cc673ae4d63e38010a3646c6f59c30", "structural_hash": "6ec38f27375fe41acd31fb0cfc1f43637d6d423e15772ea005bc64bf42f04d8c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01321.go", "upstream_id": "BenchmarkTest01321", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tif _, err := strconv.Atoi(rawBody); err != nil {\n\t\tpanic(\"generic error\")\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b78aa6f430d06f8b89835670e30c6858519f14da01f07c0a9a381d4cb998db82", "structural_hash": "c932a9a905ba7d0b4bcb88cbb666cb473899210c535735d607a8215fc60ac000", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02542.rb", "upstream_id": "BenchmarkTest02542", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n payload, _origin = user_input, 'http'\n data = payload\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c256f3791ba1f8415629f3fcd646733207453cd2fe5272d7f33d686e7d79ab68", "structural_hash": "925d820a2068717f8a8869fffb3d79050b2241afc118c995692b1be173529248", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00112.py", "upstream_id": "BenchmarkTest00112", "language": "python", "code": "from flask import Flask, request, jsonify\nimport defusedxml.ElementTree\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n kind = 'json' if str(json_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(json_value).strip()\n case _:\n data = str(json_value)\n defusedxml.ElementTree.fromstring(str(data))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "306316f7045ce53c693e35f263ea4e685e5c509a97f348057c6697990ca15c70", "structural_hash": "e0a97ace3554d2d945f9b54f5630392b1420d97cc78f8f0516cf41dda3e31b98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15794.c", "upstream_id": "BenchmarkTest15794", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb2f8426c6c5023be1022c3accf9fc858e8bda92cbfb7a2aecef7c13551c6302", "structural_hash": "8cdd82f4c6ef72d94b21dc8563cffb609e1e8ad451b42477671eaffe99f69628", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02648.ts", "upstream_id": "BenchmarkTest02648", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6c1883957510fac71b5878b854dc320cd94dda0c8c449ecc9fc76128ceeafae", "structural_hash": "f256c61a7d78511c4a8ac93ec2963f9084e14f08ec512e2dce1eb0255f768a70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03688.rb", "upstream_id": "BenchmarkTest03688", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n data = format('%s', user_input)\n entries = Dir.entries(data.to_s) rescue []\n render json: { listing: entries }\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "523dcbd30b4e8fa8d660d0ea1f817cab9459a7960f381bdc255f8b18e285c0fe", "structural_hash": "844a839772a5702fb61b4e1374a04e6d1da44f11a23e2fd4b48b1000959110d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04673.rb", "upstream_id": "BenchmarkTest04673", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + processed + \"']\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2216f269829cc2d251804dfbe5ca32766ed2f72913c685b765ed9af880747748", "structural_hash": "fccbc5de88be97d848b655489ccdf13731fff8f5f73c30e85519223983f0a4d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04629.java", "upstream_id": "BenchmarkTest04629", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String configValue = java.util.Optional.ofNullable(new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(\"/etc/app/config.json\")))).orElse(\"\");\n java.util.List tokens = java.util.Arrays.asList(configValue.split(\",\"));\n String data = String.join(\",\", tokens);\n byte[] passwordSalt = new byte[16]; new java.security.SecureRandom().nextBytes(passwordSalt);\n javax.crypto.SecretKeyFactory skf = javax.crypto.SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n byte[] derived = skf.generateSecret(new javax.crypto.spec.PBEKeySpec(data.toCharArray(), passwordSalt, 100000, 256)).getEncoded();\n response.setHeader(\"X-PBKDF2\", java.util.Base64.getEncoder().encodeToString(derived));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "662d3bf3295fcae9380d88d5c9b175cfaa5e975413fb525eeef10a6ce6913c44", "structural_hash": "fd9b6ea261bacdbd9c1a45ed7d9b2f503a624eeaaf11d8de3743a3c64cb7d991", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03730.ts", "upstream_id": "BenchmarkTest03730", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as libxmljs from \"libxmljs\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n libxmljs.parseXml(data, { noent: false, nonet: true });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "999563024674838a9ea675b41159dfe28e6fa13849d1b77d897e9a11c5c126de", "structural_hash": "87d30015c3c675f99d6a96b6bb9eb1109a7e27ccee313e9614959820eb673a08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00793.py", "upstream_id": "BenchmarkTest00793", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport base64\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = base64.b64decode(raw_body).decode('utf-8', 'ignore')\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Access-Control-Allow-Origin': str(data)})", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be82d766e0f55c5b38e6ec927b22a8334282d252bde07435f122b42a62976882", "structural_hash": "797a54414d1c90f831b6022932f35fd7c54671f76f9cc6b875cf9f54cb7c54f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11011.sh", "upstream_id": "BenchmarkTest11011", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n chmod 777 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a01a9e9cd40fb3b05c74554fa52bba26ff6a2ae4ef5cc82d4b8d900025048b83", "structural_hash": "1c3ac9162286f6cb1e01fbfd638950e391a5b66e3cc06f1e8c43615c1bc5a345", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01281.php", "upstream_id": "BenchmarkTest01281", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d30ee15e51334632f91f10511520a542b22732fca55cb14f19e70a475af1e3a", "structural_hash": "d217eedcd0da058986641674b019620972320f9a1b57bfa6f22f237880acac1f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05864.php", "upstream_id": "BenchmarkTest05864", "language": "php", "code": "header('Origin', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return response()->json(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$parsedBool . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "635a0934d9d2a2dd374bae22ae2c9202fa95e25cb04ec6a5aa33d023bc50417c", "structural_hash": "1369e87725540a35a46faedd1835d232ddbd2e2eb19500b2e598e8a562e34229", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20026.c", "upstream_id": "BenchmarkTest20026", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1a6fef0debca5b00e7932a84b429b9b5e249a834531766d1d7fdcfca1e2039e", "structural_hash": "c7a86c781789ce66d5400de3a4834cc30fd2b2322b29adb5ad6b7f5f74bf7cc5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03113.cpp", "upstream_id": "BenchmarkTest03113", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c533b2fa88505e786185ea663b265da2206d588640ffae41f9d3ed9d3ec0a3e", "structural_hash": "3eb9fe07b8bf24bb57643da7626f1116baa50aecfdab8b46c05e80e10fe6ba03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24605.go", "upstream_id": "BenchmarkTest24605", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tform := FormData{Payload: dbValue}\n\tdata := form.Payload\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tactualHash := fmt.Sprintf(\"%x\", sha256.Sum256(body))\n\texpectedHash := os.Getenv(\"TRUSTED_ARTIFACT_SHA256\")\n\tif actualHash != expectedHash {\n\t\tc.String(http.StatusBadGateway, \"integrity check failed\")\n\t\treturn\n\t}\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 0, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5168b8f03e5c8c65fa709e9b70b13ad4054daf0fc1cae771866da90c0e71e045", "structural_hash": "ad987cfc6dfb8a0e459b2fc90fbab41e8b257c0823cf37d2bd93e0583e8485a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20401.js", "upstream_id": "BenchmarkTest20401", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n let _result = 'none';\n switch (data) { case \"a\": _result = 'alpha'; case \"b\": _result = 'beta'; break; default: _result = 'other'; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f113e7ee25c4282e20ee9e3b0bb5245efeec646a7e1aeee6f451fda97dc374b1", "structural_hash": "43d7a99b78b36a33f777a5c4462da7b224f620b38cb12c4cade974b62b3c0cf6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05229.java", "upstream_id": "BenchmarkTest05229", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = fieldValue.isEmpty() ? \"default\" : fieldValue;\n String csrfNonce = request.getParameter(\"_csrf\");\n response.setHeader(\"X-CSRF-Received\", csrfNonce != null ? \"present\" : \"absent\");\n try (PreparedStatement ps = connection.prepareStatement(\"UPDATE users SET name = ? WHERE id = 1\")) {\n ps.setString(1, String.valueOf(data));\n ps.executeUpdate();\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "747635a664cf103dbb25f2225fded3217618048b429ee58955fc0d8cd1a98d1b", "structural_hash": "559884997129273a7b14af4e9cc7f77edd514ed525c967bb15162c07d44d4b1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00185.rb", "upstream_id": "BenchmarkTest00185", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0698eaab52a951c16184d3a35260bfd0c110b4a045e2befdd52d228d3de0ba1e", "structural_hash": "6099ff021be88bfc7f8e64b7ff151edc65f14a4dc74c6da1ef53bb237a1e9707", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05015.rs", "upstream_id": "BenchmarkTest05015", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = serde_json::from_str::(&graphql_var)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n tokio::fs::remove_file(format!(\"/var/app/data/{}\", processed)).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40f1e12a461f0a203900119343eda31b2358d244269847c4f727876f697a4a7c", "structural_hash": "218607e611a2db9de1075a135251ae07ba18d5a995a8e3265ee4f9b2145fa6ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16187.c", "upstream_id": "BenchmarkTest16187", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n if (_off >= 0 && _off < (int)sizeof(_dst)) _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb8642f9ece04fd899bbf7ef0b628e5a434b44b3273571d287bfde8d90568b36", "structural_hash": "6d05a182def75ff4d482f19a1966124720792586621abfb924d8bf34e19fdb34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04447.java", "upstream_id": "BenchmarkTest04447", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Function firstStage = s -> s.replaceAll(\"\\\\t+\", \" \");\n java.util.function.Function composed = firstStage.andThen(String::strip);\n String data = composed.apply(cookieValue);\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc3af1e1cf0197c0b30e9022363522bd86331c922a53cf186f8b2dbf16f9c55b", "structural_hash": "6982ef84631e1e650d3238231f983ebda42360e804a693dd166a8ae087d23892", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03050.rb", "upstream_id": "BenchmarkTest03050", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n data = \"#{user_input}\"\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce474185b0d2a37dd58ccd4aae473e541ed11c9ae896a8b675e0552e536a7c2e", "structural_hash": "ec734f2ec508da648793903d695d72c442cc750ed6cd39ecf4026c21670b6d90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21063.sh", "upstream_id": "BenchmarkTest21063", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n IFS=\",\" read -r -a values <<< \"$processed\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cdf4cb01f9b9cc041dbbf93a91f585941e2349838a48c0d360779c965f39499", "structural_hash": "8b0f68e1495729adbb773e454e73066b316e2695a389b33d768cbf46699c31fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03386.php", "upstream_id": "BenchmarkTest03386", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->set('Access-Control-Allow-Origin', (string)$data);\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31a63e96e4219492445d02b23073a9e9cb00bfb721d2a0048bdf1c0d593abe4c", "structural_hash": "6d1c1c4c6179e5be0ec5ecdcb5ab6d87bfbcf70d8b18da90cf6048068fa53c3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04194.go", "upstream_id": "BenchmarkTest04194", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tcapture := func() string { return xmlBody }\n\tdata := capture()\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\tc.String(http.StatusBadRequest, \"invalid option\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Header(\"Content-Type\", processed)\n\tc.Data(200, processed, []byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2adb0a791a16d7522f50532e88de6c861f94006f3917d6ed79b7e2556c3a393", "structural_hash": "6591df76f57ec44c3c3503b7edb1ef82b5b29178c96fd85606067a0dc6ad4d74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_05346.js", "upstream_id": "BenchmarkTest05346", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n ctx.body = { validated: String(processed) }; return;\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f6152059869b7ea1c05e428c4413cb8736373bc6f7b070224cba7ea86304435", "structural_hash": "63976a13fa0531831afb3b17e6dd87d9ea660c3cd2ad4266ec598217328cd5fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01949.rs", "upstream_id": "BenchmarkTest01949", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let (payload, _origin) = (upload_name.clone(), \"http\");\n let data = payload;\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f31e3999e449e95df9f61c619c3b5c334ffe8ef72e3b81f320a7fc478fbfef1e", "structural_hash": "d66315303323ff0039c98c77af1bf8cba31f7e4128b63e81624a97b70c077bcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02642.java", "upstream_id": "BenchmarkTest02642", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data = normalize(cookieValue);\n return Response.ok(data + \",data\\n\", \"text/csv\").build();\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77807cd1fdd8baa9420d7c16b66c861efa25383f0359176cd515f47b8c5e9502", "structural_hash": "7082b55401d2dd472b8408d1a7710fab4f4c50f6a2250691939175964b75eefe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19572.go", "upstream_id": "BenchmarkTest19572", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(pathValue) {\n\t\tdata = normalizer(pathValue)\n\t}\n\tos.Chmod(\"/var/app/data/\"+data, 0600)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3be51faaba0890f6b5c0516f6c57f67583380251a522a16d6122d8943ed40b1e", "structural_hash": "13f9385da94affc6913e9bf7ea04345ba9926a7039128b2a464ddbb062beae03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01890.js", "upstream_id": "BenchmarkTest01890", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n fs.writeFileSync(\"/tmp/\" + data, \"content\");\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e18f0cd0f79ff07a4266911789a9673bbbaefb3b242a49e15d608d216b1d2b1", "structural_hash": "c2b3daee42c60e35bc2334f1b9178517c17bbfa3fe0c80c6938f278beadc712e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13474.sh", "upstream_id": "BenchmarkTest13474", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6188ffea8a9cac8c5b9e8f7ea9e9a3b76b7a9a5495179afb31c2f791cb972b56", "structural_hash": "9f7da094b21139c2a96df6a4393ff59f0385c3bed568575adbea0af04352918d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05632.java", "upstream_id": "BenchmarkTest05632", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n if (!jsonValue.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n jakarta.el.ELProcessor elp = new jakarta.el.ELProcessor();\n Object rendered = elp.eval(jsonValue);\n return Response.ok(\"
    \" + rendered + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b5436598efaad79fad65ed345199501dddc74108e914cc4a3c3a901065809e3", "structural_hash": "0030e4b82e8f56fbfe052d86e50d0865a0463267ada141b00d3d1480f3bbad87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04190.rb", "upstream_id": "BenchmarkTest04190", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n role = data.to_s\n if role == \"admin\"\n halt 200, JSON.generate({ role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc1c256b904e46c92a18046f9505db0890239a300ca3c57abf4316051c494607", "structural_hash": "b0f44d258b82196bef33a91a1eb720dff3fa9a42e60fead5774393a9b5d6b664", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03170.cpp", "upstream_id": "BenchmarkTest03170", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n std::cout << _buf[_i] << std::endl;\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad786f8bf275bfb69e473323f07e82f0ecaaf02176fa97166b6a839c71f755a9", "structural_hash": "8d3dc1dbd18ea7b4d0a20fd162887e53b4421d894186faeca7741a532904153f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00502.py", "upstream_id": "BenchmarkTest00502", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n pending = list(str(field_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n eval(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70a5cd8468097cf15847b438a6dd60103d88a252a888cc035b456a99fa50f998", "structural_hash": "2e520effd1fb7a45a9b83bb456fc20380ae72f3b9dd4f4108767530e035ef78d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32951.go", "upstream_id": "BenchmarkTest32951", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\thexBytes, _ := hex.DecodeString(authHeader)\n\tdata := string(hexBytes)\n\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08c3fabdf8962a3c5a82d560d2c0e329c3f2adcc643869b35536ad9855c866bc", "structural_hash": "bf642dabcc35e36f92571975fdff9017b0fb64e2f5f7e68340e5e206f56c641d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05102.java", "upstream_id": "BenchmarkTest05102", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.parsers.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data;\n if (jsonValue.length() > 256) { data = jsonValue.substring(0, 256); }\n else { data = jsonValue; }\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2be6900398b511aaaf053560229dfd820c3df1f4444a4c569a0293f07f0d0174", "structural_hash": "9bfae0f947251ed0ed998edbf532732bd64e1e0ac8c72a102b9f06b401679811", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08248.go", "upstream_id": "BenchmarkTest08248", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvar data string\n\tif dbValue != \"\" {\n\t\tdata = dbValue\n\t}\n\tsalt := make([]byte, 16)\n\trand.Read(salt)\n\tsum := sha256.Sum256(append(salt, []byte(data)...))\n\thashStr := fmt.Sprintf(\"%x:%x\", salt, sum)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 0, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5139d722cc2b964248db6506f391fb475f9f01348081764a3ec83f898fcfecc5", "structural_hash": "c7e30b4917b3dd45fa50c5942dc57df47e03331023e550f1f075105af8dcfe0a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05989.php", "upstream_id": "BenchmarkTest05989", "language": "php", "code": "header('Host', '');\n [$data] = [$userInput, 'http'];\n $processed = (new \\HTMLPurifier())->purify($data);\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "820bef31e43c0a5e2f7916e818f9f0e48668fd24099708b7eb493dbb61790c83", "structural_hash": "890b8a4340ea095c7e6d3a1521c78717ca19ccc3ce0ab71b4501f8d54b0694ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03651.go", "upstream_id": "BenchmarkTest03651", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(headerValue)\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:16])\n\tstaticIV := make([]byte, aes.BlockSize)\n\tcbc := cipher.NewCBCEncrypter(cipherBlock, staticIV)\n\tptext := []byte(fmt.Sprintf(\"%-16.16s\", data))\n\tcipherOut := make([]byte, len(ptext))\n\tcbc.CryptBlocks(cipherOut, ptext)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-cbc\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab00bcd180101d42159faa8fb08febbda3fdceeb79591e0004b02748dda06070", "structural_hash": "12ae8e4081c3222557c104446b4eb6acf4e29adb44123a7bf437b97c765eebda", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27253.js", "upstream_id": "BenchmarkTest27253", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = String(userInput).slice(0, 200);\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a93b8f96c8dadfb2f84be7078cb54cea1a7ab3a15a3400fff754f23e77426799", "structural_hash": "39ada9e78f5b82aca7bbc5adb4bc67685e8a5ef245b9442f9c504dcde3756e0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02953.php", "upstream_id": "BenchmarkTest02953", "language": "php", "code": "header('Referer', '');\n $data = urldecode($userInput);\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3736fc9fe1c86cbfd74f12a9e2a68b887acea89a24afbdd5315fad1dece19cbc", "structural_hash": "353f576b9d37ba66febd058d3f3a0d363b144e380676e8e3c86c6515ee36dfce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11133.js", "upstream_id": "BenchmarkTest11133", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const data = await Promise.resolve(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n libxmljs.parseXml(processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1498fe9b514d02092af77f0ae353c9b2e8a3ec36b1fd4ea53523463c9ba12e25", "structural_hash": "b3d17bd8a700a373f783e436ffc9e5f1380d333071e06413733b1a46ff6ed54d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24057.go", "upstream_id": "BenchmarkTest24057", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tlastRequestValue.Store(headerValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tif os.Getenv(\"APP_ENV\") != \"test\" {\n\t\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+data), 0755)\n\t\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef152ef9a192825a5053021e6f31d7fb310b3e1aa6c95d7bc1277e44a105a913", "structural_hash": "d783637b2a24001c7a1d3423074cd22319cf2fbf7762d300c4ae6183e063decf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13654.sh", "upstream_id": "BenchmarkTest13654", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n _host=$(echo \"$data\" | sed -E \"s#^[a-zA-Z]+://##; s#[/:].*##\")\n case \"$_host\" in \"[\"*|\"\") echo \"private range blocked\"; exit 1;; esac\n _ip=$(getent ahosts \"$_host\" 2>/dev/null | head -n1 | cut -d\" \" -f1)\n _ip=\"${_ip:-$_host}\"\n if ! echo \"$_ip\" | grep -qE \"^[0-9]{1,3}(\\.[0-9]{1,3}){3}$\"; then echo \"non-ipv4 host blocked\" >&2; exit 1; fi\n if echo \"$_ip\" | grep -qE \"^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.)\"; then echo \"private range blocked\"; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf6530b27b0800d55474328f0b54b5b4532171686988748b35a230ca2bbb9e9c", "structural_hash": "cb70b15302cba36248667aadb7bfe2894d6b141c80ecb4c84e62a887e9149071", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05487.ts", "upstream_id": "BenchmarkTest05487", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = referer || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78307c1621a0f838d0fd9a587d006735ffa448a554564d6913e9aca4ae2e21e8", "structural_hash": "25e37705f1c26a9c435777c664c9f273b37459973b2cb52cd6cde0432829158d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13276.c", "upstream_id": "BenchmarkTest13276", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "feb065bbdfc023ba3ad4e308a8500774907c1741d2dc979278d5fa1cb103d942", "structural_hash": "3e19fdc69471f89b93b2ab9ea1ad0af55d66e742bcc0ffc13cb5e745104d0697", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05623.java", "upstream_id": "BenchmarkTest05623", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"User-Agent\") String userAgent, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n FormData payload = new FormData(uaValue);\n String data = payload.payload();\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe56b1e7d683057e33c6f74be1bd20475badc22216d120627fdd2a0afe2ab13f", "structural_hash": "530413f0b65e0372e98ee22f4d3e5c9c188fcea4ccbe4c34a6f7713c20206852", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00618.rs", "upstream_id": "BenchmarkTest00618", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = ua_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n Command::new(\"echo\").arg(&data).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1de48788e0d4cd06e7f11045981784133b4184f001d3b55558fdbee4ebfa049", "structural_hash": "0b0af9a6802e20813058f026ac4608e0cfd5542176522eec6f1e249f7e174f26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03197.ts", "upstream_id": "BenchmarkTest03197", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a93f22c6538266d6bb3d62ec36d63e6497fc1fd2f07cff383bbdc5154c2fba3e", "structural_hash": "a1fe4246426cf538f2926d72bdcea10a6c05cff16acd07c24aac9fcbebb1e7d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01453.rb", "upstream_id": "BenchmarkTest01453", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless session[:user_id]\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2929fd57c40e10e9971b773ca30bb5fd1d7442dce8bba49f8f7b03c9e9e480ea", "structural_hash": "357a5fd2f7a94e5b05ace6d5ac64b6dc2f2150b11ad312a5ab6493edb3f944a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00734.php", "upstream_id": "BenchmarkTest00734", "language": "php", "code": "headers->get('Host', '');\n $data = (!empty($userInput)) ? $userInput : '';\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return new JsonResponse(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$parsedBool . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9a423b450cef96a1aef6ea20bc014362e31b303cdc0819d8ccda91feb5f90d3", "structural_hash": "3074b9adbf431846ec9bbd23f182c7b59a41e3de593d23ed421ffef10c19acef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06073.go", "upstream_id": "BenchmarkTest06073", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tvar _b strings.Builder\n\t_b.WriteString(userID)\n\tdata := _b.String()\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e5d883847bcfbbbc3c7dd3dd29a6f0130c6e1139e0a89fa1343dfe979f391d8", "structural_hash": "7d2fa8a6a5ad0a812c85f14574cf020d63820c820c7c7e0530d3182556b4ce54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01962.rb", "upstream_id": "BenchmarkTest01962", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n content_type :html\n \"
    \" + data + \"
    \"\n end\nend", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3af599066e8e4e7fe196d8785adbb340ad7533ded18ee6c4b134a7d77de36a2f", "structural_hash": "24a480c3318b9fb716d1dbb891978e36670709c91758ae00c9783f71094be7c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12908.js", "upstream_id": "BenchmarkTest12908", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/uploads/data.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fbda9a673bf83bbe565a6852af892e8b5e0407d3f48de184e90bc5a76405da0", "structural_hash": "0ef1b1b227c44f5569f8cf0ddb7d726fa47f4da76ebf1b3bf734f68251e03a96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02404.rs", "upstream_id": "BenchmarkTest02404", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(upload_name.clone(), |s| s.trim().to_string());\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5472e5865a16f0348a16325115db6e55aa2a932e8a403d998bc3def3242dac9", "structural_hash": "85908944fe19e063b1d4d1985a87ee940d00b6dea5495a00ea06020b293edbc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00115.cpp", "upstream_id": "BenchmarkTest00115", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n std::string _truncated = data.substr(0, 64);\n std::string _fname = _truncated;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(_truncated.c_str(), _uf); std::fclose(_uf); }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7652dc7f12644245bd34fa9363c2824cd3b58da8d694ee64cb6b73acb6dc173", "structural_hash": "17032ee9cb6f82096e2c44441751aa5491fb38eb345a9a776139b297de1979ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00679.cpp", "upstream_id": "BenchmarkTest00679", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string data = cpp_module_transform(user_input);\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc1babe544b722f4b42b19e4581aaa79a5208d96de65ed0a2e22224926e5596c", "structural_hash": "89e735fa0cd885ba511f4e206e27d5adb11e72a78b54fbff5ab2648530cf7815", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05741.java", "upstream_id": "BenchmarkTest05741", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(authHeader.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n return Response.ok().build();\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86ce355fe680c405cc60797ded38099fccf84767deb0dce279babfff87ff484d", "structural_hash": "0e7c0efb29d4bb94e4b629d6a0abf47f74ccded11fe70a9f1e5e531ca6ad6e64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03191.rb", "upstream_id": "BenchmarkTest03191", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", data))\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dadf6feb164ff514a470d0bd400fdb96ff32b5f5c3bbfd96d95fb9a7820f5228", "structural_hash": "b53a92dd89e7feb3e1ff8aa0cf180995dde8b8f6ec4f4de1951bafa86556ed0c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11439.sh", "upstream_id": "BenchmarkTest11439", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "334e26b283fff0896219f65d549e27a54dcd56a5514a4f31bfa7fabf3a35b0bb", "structural_hash": "837f595bc4697ff6709fb69bcacd32ae3a267bc40e49c0c643d95ff1f6f6276b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08235.js", "upstream_id": "BenchmarkTest08235", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const data = `${userInput}`;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-284"], "category": "improper_access_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e775deba0d9af6d53ec95ea1f9f7633175d7394ce4c86814b3f6679b87651166", "structural_hash": "c04d06fdb0f76cfe5ed9fade937a8cf68dbdfd9877f7113389805ac860127b7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04250.php", "upstream_id": "BenchmarkTest04250", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $data = str_replace(\"\\0\", '', $userInput);\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d82b4f23f23138808d0092a0f2ba239a09d7faae9e711b92a0873d6878bc6e12", "structural_hash": "2795272a4c85fbb21508f5a0f6d7f63ad133b5d636750bb0f662a874e14e9a08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03530.php", "upstream_id": "BenchmarkTest03530", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return new JsonResponse(['validated' => (string) $processed], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40d97c76b49fd980c1d2fd4a7521bca822d37752f28c0eda79f0e35297946e09", "structural_hash": "09492da7de0e2d15a6ca9de957be8a759a4b3b6615e998a0ef7dbba3ecf70146", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27814.go", "upstream_id": "BenchmarkTest27814", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- multipartValue\n\tclose(_jobs)\n\tdata := <-_out\n\tprocessed := data\n\tif len(processed) > 64 {\n\t\tprocessed = processed[:64]\n\t}\n\tvar docName string\n\tDB.QueryRow(\"SELECT name FROM documents WHERE id = ?\", processed).Scan(&docName)\n\tw.Header().Set(\"X-Record\", docName)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2aafbaf3aea4b5c27af69953289c4f98cf8ebe9aca9b26c8ccb7b2447eb8de33", "structural_hash": "7a318ec537f4044aa8db2641a19af99d2dd7a49dbfed5028c4603f7ef74a26df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02290.py", "upstream_id": "BenchmarkTest02290", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom pydantic import BaseModel\nfrom starlette.responses import HTMLResponse\nimport json\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n try:\n data = json.loads(json_value).get('value', json_value)\n except (json.JSONDecodeError, AttributeError):\n data = json_value\n return HTMLResponse('

    ' + str(data) + '

    ')", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35c0091296f415ab1cb9e49db466d711a98ba73833becb865d2b1eaf8815663a", "structural_hash": "453cfc91aabe98a4ea5c4fd89e359733991b3d72cf35aa967f08e40834c5e89d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02936.rs", "upstream_id": "BenchmarkTest02936", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: user_id.clone() };\n let data = payload.value().to_string();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2fdd5197d814fd8dc15b6ea393fa10a368e273fe681d736350aedbca0af5a824", "structural_hash": "dc44e013c9889ace74a00692ada8f33d840abe78dae2de5a9da427a1c444c459", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13835.c", "upstream_id": "BenchmarkTest13835", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n long _req = strtol(data, NULL, 10);\n if (_req < 0 || _req > 2147483646L) return;\n long _alloc = _req + 1;\n printf(\"alloc:%ld\\n\", _alloc);\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d775f22308af4037e4684b739d119d747218c18f645d3c41c506b4097aaebea", "structural_hash": "78dc557cb461b3bc4595e38dc624ddc4db9cef458e6544dfe9c650a85cc4defd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00166.rs", "upstream_id": "BenchmarkTest00166", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let data = match upload_name.chars().next() { Some(_) => upload_name.clone(), None => \"default\".to_string() };\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ce91228346cee826ea901846967b166104960be4180f3ad49e7f368738aba54", "structural_hash": "5cd8166dd1a21dd9cd88181279e0a12f994dd59e8faa338d1c685ba1ee570f84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27725.go", "upstream_id": "BenchmarkTest27725", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata := refererValue\n\tif _, after, ok := strings.Cut(refererValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tallocSize, _ := strconv.Atoi(data)\n\tif allocSize < 0 || allocSize > 1024 {\n\t\tallocSize = 1024\n\t}\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(data))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "093150f90e308b15c12a1b1a2ef50013775fc00cfef632c9bc305fcd33ab1078", "structural_hash": "d3182129ece52a138d4a0c26e9da795c75ee389a7da377357397c3ba4f85cde8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05328.py", "upstream_id": "BenchmarkTest05328", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\nrequest_state: dict[str, str] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n request_state['last_input'] = forwarded_ip\n data = request_state['last_input']\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "906b28f49b1baafafef9eceeb6e258a0a368dd83be8b41f06db8538d4bea31b3", "structural_hash": "1b0d9fb77b4be5c20c683f25a27605bf9fe15306aa224930ca936e210f0e636f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05530.rb", "upstream_id": "BenchmarkTest05530", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n payload, _origin = user_input, 'http'\n data = payload\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n ERB.new(processed.to_s).result\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e73a64cf3ec325e4a5fbd0a06f9625d7301d8f7c5ff68947f722b452a3f74db", "structural_hash": "7eff037fb7b68346dcb206fa75202997c866645ab214817f07ca2688cf3908c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_42887.js", "upstream_id": "BenchmarkTest42887", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const data = userInput != null ? userInput : '';\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a9392802989c162c0fcbc2acd26653a97333079095d59fd295be113fded3645", "structural_hash": "4a0063b0ab5650a57c05be3942b4077f7725f0ea021ad96488e1c741b4a08ce1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28454.sh", "upstream_id": "BenchmarkTest28454", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _tmp=$(mktemp /tmp/app.XXXXXX)\n chmod 777 \"$_tmp\"\n echo \"$data\" > \"$_tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2cc253dd75aea79f7c9c0bf26d946fcb3546c6023a7fb4d16c0bbf9286aaaa6b", "structural_hash": "5284ede127d91ffd4e81c523dfcae0ff7f295c65aae48171607461850c6ea265", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_38114.go", "upstream_id": "BenchmarkTest38114", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tform := FormData{Payload: rawBody}\n\tdata := form.Payload\n\tparsedURL, err := url.Parse(data)\n\tif err != nil {\n\t\thttp.Error(w, \"invalid url\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tallowedHosts := map[string]bool{\"api.svc.cluster\": true, \"cdn.gocdn.net\": true}\n\tif !allowedHosts[parsedURL.Hostname()] {\n\t\thttp.Error(w, \"forbidden host\", http.StatusForbidden)\n\t\treturn\n\t}\n\ttargetUrl := data\n\tresp, err := http.Get(targetUrl)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tw.Write(body)\n}", "label": 0, "cwe": ["CWE-941"], "category": "incorrect_comm_dest", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "900335fe7be47d5ef49eeb4ffb6c0cec1c93cef429cdeb82a1bda8cb4355de0a", "structural_hash": "ea5656b8a28c2a02ed99db6faad3d1fdbcc15a132d2026d64080f9772c0606f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05195.java", "upstream_id": "BenchmarkTest05195", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(headerValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n long seed = ((long) data.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "554e35641e586ae2df6f99e13c7d6e67234ceeaddd45705f379a40f319a9568a", "structural_hash": "fe40e1c36c73724c792777bbaac60912a45261a4b58d150575f821b18626fd20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03745.py", "upstream_id": "BenchmarkTest03745", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n data = (lambda v: v.strip())(user_id)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if _login_attempts['user'] > 5:\n return jsonify({'error': 'account locked: too many attempts'}), 429\n if not auth_check('user', password):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7502d4b6324d785534f8f38bed1a23f30ec10b736775d5295c33de1a272c44b", "structural_hash": "3f7729c517f80fe31633dc7cd21a5bc24144ca74477aca99d74437b739268251", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03830.go", "upstream_id": "BenchmarkTest03830", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(rawBody)\n\t}()\n\tdata := <-resultCh\n\tsalt := make([]byte, 16)\n\trand.Read(salt)\n\tsum := sha256.Sum256(append(salt, []byte(data)...))\n\thashStr := fmt.Sprintf(\"%x:%x\", salt, sum)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 0, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ffb2a645e761e2a3c64f5a4e2baac1090120e87925f1543c41ad5a9dbe5eaeb", "structural_hash": "e92b0e0637a761d850fed15338800e23003c02fb6d5ebcd2463704e81f9c58dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05095.php", "upstream_id": "BenchmarkTest05095", "language": "php", "code": "input('field', '');\n $data = urldecode($userInput);\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0911b1ffeddb422af4cda716411bad2206d13feb83328638610bfef6b727404", "structural_hash": "58cd80c04684ef0cbf2966d416a825643881b73a592591987e5a192c9eb78179", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03756.py", "upstream_id": "BenchmarkTest03756", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n password = str(user_id)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return JSONResponse({'authenticated': True}, status_code=200)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1dbaa96d6496c4a82486c3b2eb3e2f5032ce386bd139ffd803328dec9745d81", "structural_hash": "b97d7f176b7793e43d6b91b21f330227c55ce936e7eef53cf6bdd19aad46ac71", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04090.rb", "upstream_id": "BenchmarkTest04090", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n payload, _origin = user_input, 'http'\n data = payload\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n content_type :json\n JSON.generate({ wrapped: wrapped })\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b253c41ce623293c62dfe8808c809dfd4049df3d6aec016539e8c59b8e81552", "structural_hash": "081d90b18229431dc98f0378d30092bead8d937da8d97d672c1243cda48e4f62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01252.rs", "upstream_id": "BenchmarkTest01252", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let queued = json_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n static _RE_SCHEMA_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[a-zA-Z0-9_.-]{1,256}\").unwrap());\n if !_RE_SCHEMA_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n HttpResponse::Found().append_header((\"Location\", processed.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1eb315d23e818d2180daf71c3c8c7dd03130b7f7cc9c60ecc95f67e293e09dcf", "structural_hash": "825acaec629de22781ad1bd9437313b1e90adb743e79319f02ca9865491addf0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00711.php", "upstream_id": "BenchmarkTest00711", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $data = str_replace(\"\\0\", '', $userInput);\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return response()->json(['validated' => (string) $data], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f7d542eb299d75fe19e02e9c77e62a16877730a8b65c1d52aa8a0b4b6ff52c2", "structural_hash": "f0af1c2ee25515805873e5d3165179ab26477ef7c8df930d8045034712fb8322", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02299.ts", "upstream_id": "BenchmarkTest02299", "language": "typescript", "code": "import { Body, Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string, @Req() req: Request): Promise {\n const userInput = field || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const role = String(data);\n if (role === 'admin') { return {role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84d226b47fad56594d65abf759e492613457637807a6f8224e62e431ed4f7610", "structural_hash": "fd0cab8093c519cc7295fd31a7ea622cc0980fb4da393bea658621151747ee8c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00455.rb", "upstream_id": "BenchmarkTest00455", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n eval(processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3ed7a087b640e8e1c355ffce94aeac896ac7d0fc8042f11e9107bc529529e51", "structural_hash": "9a9cac6adc96c4848975c9240d5afd62e9d0c61f0458275f2575a257b6f34339", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01327.py", "upstream_id": "BenchmarkTest01327", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n def normalize(value):\n return value.strip()\n data = normalize(referer_value)\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de44cef2c695874b47fd33916eb06e1bd2bf466fcb4a0cf9abdcb738cca8cf30", "structural_hash": "87469e479e56cbac56899870591ab5c983c884a77d13106e033d21ddf1c85f4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01317.php", "upstream_id": "BenchmarkTest01317", "language": "php", "code": "headers->get('Authorization', '');\n $data = hex2bin($userInput);\n unserialize($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2366c3c53c5a9ad5840648ba295d9064a615b2d0120e0165f38e29960e37d92", "structural_hash": "55f7782639ada325fe882db5eafe51ea0cdd8031e092b28130938ee038fab7bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14012.sh", "upstream_id": "BenchmarkTest14012", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc008cf69c852534fd6a0246481bd7020ab6f8a3697998c4a60b48cd82d606eb", "structural_hash": "beb44bd3b4104bb64d7f7745910bdbbec58cdc9858cd196adb9f6cde9af09ba7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05558.rs", "upstream_id": "BenchmarkTest05558", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(user_id.clone(), |s| s.trim().to_string());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::ldap_search(&format!(\"uid={}\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68650d1981efd618141ebf7eeafbbcc518fadba9e0b4f588061553f6c2630448", "structural_hash": "b9e0784e2ac7a92d88bb9c481e6f42f93740caa1e6514a5451bf7600f8d20b4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05759.php", "upstream_id": "BenchmarkTest05759", "language": "php", "code": "input('multipart_field', '');\n $data = str_replace(\"\\0\", '', $userInput);\n file_put_contents('output.csv', (string)$data . ',data' . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99428769e9e894d7311891eb8334ecbaad23ed0f9d88f5a12f9c982c9281ba80", "structural_hash": "3f8095ffd3f35773ca3597ab6ec06116e5a48ee1412519e2f847fdc2c399c424", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02160.cpp", "upstream_id": "BenchmarkTest02160", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dfdb534dcfd2138e71b4570d87c2ceb8ab5f37778ea16a876974fad283911efc", "structural_hash": "393a450b74831a81927efe87e1cb5f54359dc91f01816fca137f2320a79d3663", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03649.rs", "upstream_id": "BenchmarkTest03649", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let (payload, _origin) = (comment_value.clone(), \"http\");\n let data = payload;\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34bf74de716d7d8079efca2011586ffb20399140aa01494714978d0332a85c7e", "structural_hash": "a7738a95f1d2a86138975ca71eb74f3f9d22f643adf37d70fbdb137a7f6d9a3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23019.sh", "upstream_id": "BenchmarkTest23019", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n trap 'rm -f \"$tmp\"' EXIT\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0c111838a73d5da22d8b08188b07940de1945e7752d935af5d1b04cac092855", "structural_hash": "a5cff291c2b1064fe65b3f5ac7d452735dbf0b89fbfec5028e982765f08dc421", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12204.go", "upstream_id": "BenchmarkTest12204", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar data string\n\tif graphqlVar != \"\" {\n\t\tdata = graphqlVar\n\t}\n\tparsedURL, err := url.Parse(data)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"invalid url\")\n\t\treturn\n\t}\n\tallowedHosts := map[string]bool{\"api.svc.cluster\": true, \"cdn.gocdn.net\": true}\n\tif !allowedHosts[parsedURL.Hostname()] {\n\t\tc.String(http.StatusForbidden, \"forbidden host\")\n\t\treturn\n\t}\n\ttargetUrl := data\n\tc.Redirect(http.StatusFound, targetUrl)\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18ca0746d3f0c3fc0a64814000cfa5d305d9cfb6c54dbd16cce281c8523d26f5", "structural_hash": "f1d9d5d9656551476f7547ac75240d8bdbb5e52a7ab320f1a9266f67c8d28884", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00613.php", "upstream_id": "BenchmarkTest00613", "language": "php", "code": "input('multipart_field', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n abort(500, $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a5b433c8a61a822accf655d82df1bf291e3c721a460681a4a00ae10395d53e2", "structural_hash": "c00e855b9988394b052031dd372aaf17a902705b45669f007a5bb2270db94b76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01204.c", "upstream_id": "BenchmarkTest01204", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "786e2b8823e114775113a34e6c936ccc980ba24a589fd1dee321adf17befbac4", "structural_hash": "5dc1d8d29945541a1f2b2b06867591a899608bf7f8a70e2bf61c4d6273d662e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01872.py", "upstream_id": "BenchmarkTest01872", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = str(raw_body).replace('\\x00', '')\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88ffd2439a6e3c2fef1d3171393d0ffefd5d473ae5c212bb269a6436c3e8db74", "structural_hash": "f2fa611942a1b3135cf0407d0ff7f45b304da55dd0d1f9bd6f1b17b275be3af1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04344.php", "upstream_id": "BenchmarkTest04344", "language": "php", "code": "request->get('multipart_field', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return new JsonResponse(['error' => 'forbidden'], 400); }\n $processed = $data;\n $size = (int)$processed;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58072a69e30f1034318a269ff9202378387eb427b07b46d45abcf7d19fd69e21", "structural_hash": "a7f25098d88e41a1b7960464a497646646c0c6f7ae4efc2cb93ed53fd0a3dcab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01672.rs", "upstream_id": "BenchmarkTest01672", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let queued = header_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n HttpResponse::Ok().content_type(\"text/html\").body(format!(\"{}\", processed))\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dda712bbc244cb768b0414c3b59fdebc1c73d831d9717b7866b8c70c5f6e07e5", "structural_hash": "01da141d62b4a4ce55f22ac5a319875f50f1ad03b80315917ee7ae7d4c922249", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04724.ts", "upstream_id": "BenchmarkTest04724", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (typeof process.setuid === \"function\") process.setuid(1000);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5685152da31659b715a219375ea4e216a74579ce4f0ecb426eaaaefa5f4c6904", "structural_hash": "0c4b203b198084479fea5d5dd2a11812b19b0ef6dc2eae7e9f036d4d9d7a5828", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_41961.js", "upstream_id": "BenchmarkTest41961", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const user = db.querySync(\"SELECT id, role FROM users LIMIT 1\")[0];\n Object.assign(user, JSON.parse(String(data)));\n db.execute(\"UPDATE users SET role = ? WHERE id = ?\", [user.role, user.id]);\n ctx.body = { updated: user.id }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36e1d7da2662acaae676233e88b0a601adaf47b5e3a3015abaef52e3eeefe272", "structural_hash": "d2f21942a8258812737f2ff206948e544a320bfcc4f21f73138acdff03171a32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10993.js", "upstream_id": "BenchmarkTest10993", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.set(\"X-Custom\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ab4e06755b0e179dd194b798b416611cab85830e6105e3805680a0f086b7c35", "structural_hash": "5823f05baa6420eb484e030bc702a51aefad4097dbc77309886b7d0fd443dfb1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01839.py", "upstream_id": "BenchmarkTest01839", "language": "python", "code": "from django.http import JsonResponse\nimport ast\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n try:\n data = str(ast.literal_eval(host_value))\n except (ValueError, SyntaxError):\n data = host_value\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return JsonResponse({'status': 'ok'}, status=200, headers={'Access-Control-Allow-Origin': origin})\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7aaec045fb50f3537d918b3d8012e96f8590acb08d34968c36a507615aa0f978", "structural_hash": "6b37045108397f3f5c04c2283f94f2927912b166006cc0dc40a613ccb0856f5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05236.py", "upstream_id": "BenchmarkTest05236", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n data = '{}'.format(user_id)\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return jsonify({'name': str(value)}), 200", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95f5547857ce75ce029d70f0cbd738cc9d0ba4cdad044380f79567be3e59e829", "structural_hash": "599f8bbf31b0def3140e8c4427f5faa61ac99712e7240ac697be4b9d805cfd62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01043.ts", "upstream_id": "BenchmarkTest01043", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = String(userInput).split(/\\s+/).join(\" \");\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8b89bbf684bed9a7066495916de53a016d610c905153ea8381a9cb06ef4044f", "structural_hash": "39d5270b04e81a317ca919af90e50174e39b44071f53c0d7f788ce5a18bf71ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02388.rs", "upstream_id": "BenchmarkTest02388", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = field_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af4ccc36597bc5dd33f41253e48130ba2758dbd9b2605cb0b6999e0010c21407", "structural_hash": "7176c3694d170481f62ccee71569dc208ecb35e63ea56643b98a78a0c314ce83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03288.php", "upstream_id": "BenchmarkTest03288", "language": "php", "code": "headers->get('Authorization', '');\n $data = base64_decode($userInput);\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2940080fabc5e828212cb9b46fe67b6e6026b642675108160b161f57da51b21a", "structural_hash": "515c603ea66eae4b93aa9b67c1062d6502678ffd1fdfdc20aa8d7195a00e222f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02490.py", "upstream_id": "BenchmarkTest02490", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\ndef normalise_input(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = normalise_input(referer_value)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e489725b6866a405bc57bfcf11cd26fb1f978696dc482a635db5c3af62c411ad", "structural_hash": "1ef4b64df045338cc33d67dbac7d2eaaac47f474b6976e108618f4627dfd6fb6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05492.py", "upstream_id": "BenchmarkTest05492", "language": "python", "code": "from django.http import JsonResponse\nimport ast\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n try:\n data = str(ast.literal_eval(user_id))\n except (ValueError, SyntaxError):\n data = user_id\n processed = data[:64]\n with open('/var/uploads/' + str(processed), 'wb') as fh:\n fh.write(b'data')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6ca99f3c71b680f48512d3c63dca754a0271238cfc23c4306e02c10d0b5d3e1", "structural_hash": "059f1f62562582e122d2e9d866cd5c84c526d777e451bbb47edfb19bae76b0d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00154.ts", "upstream_id": "BenchmarkTest00154", "language": "typescript", "code": "import { Controller, Header, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9862d70509fce9469e1fc19df4fea03c76cff28715c6c9a35aa51faf445edc4", "structural_hash": "57739d0617b05d8437d61688aa9dae92cf43ca77ec3582e9f9dd03a2f3bd2406", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05118.java", "upstream_id": "BenchmarkTest05118", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data = \"\" + headerValue;\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f12c642c03a5c74ac6026c5294bf7bfda13a76132352043ebf6172d079e80de7", "structural_hash": "5a27ffb4cc2dfdf8a7fdebe01a5b6eb3e538408807f78cb0b33a771be3912b18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04685.py", "upstream_id": "BenchmarkTest04685", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nfrom dataclasses import dataclass\nimport os\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n form = FormData(payload=ua_value)\n data = form.payload\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return JsonResponse({'digest': str(digest)}, status=200)", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c62c53efbca30d4dcec172b7abb849ffb2cb77cdeeffd6315ad5be59da998034", "structural_hash": "f40ee2b96f47a260edd47a19365137c5f802d4134408af303419318766818dee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03091.py", "upstream_id": "BenchmarkTest03091", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nfrom dataclasses import dataclass\nfrom app_runtime import db\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n form = FormData(payload=header_value)\n data = form.payload\n _resp = requests.get(str(data))\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7fca650979acfbd87b00baac6f0be8d089d82c1ecc726c0dc52b9b2678dd199c", "structural_hash": "169411dd125f062ca80f3d3b9d31f94b624253393630a8e604155c77017ba7a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01761.java", "upstream_id": "BenchmarkTest01761", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n String data = normalize(uploadName);\n try (Statement stmt = connection.createStatement()) {\n stmt.executeQuery(\"SELECT * FROM users WHERE id = \" + data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b1f1d401343d22bd8a0b51d76ad40e560595c156fe5feec81cf7deafdb26bcc", "structural_hash": "ee12cab8fc587c7aabb030ef1bc3609d2118586f8db028ffd737479d012d094c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10983.c", "upstream_id": "BenchmarkTest10983", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99d4a3c7c3d828328a03efd89854f3d5c411bab2e7abce46e26194f34550836c", "structural_hash": "1a4dcd2bfa5ae8eef25b9e534d58c58bff6c1e7a11096e3d664d5911ba444258", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01082.java", "upstream_id": "BenchmarkTest01082", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = \"\" + refererValue;\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n Object evaluated = new jakarta.el.ELProcessor().eval(data);\n return Response.ok(\"
    \" + evaluated + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6899871c4ffc59b3ea695d81f42ad5e42cc7224c9d10c1f19f69ff84b657c406", "structural_hash": "de2ffc7df127fed2e284a147f8437133faf02155d20f227c69bb9278cafaadf8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19936.js", "upstream_id": "BenchmarkTest19936", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n ctx.redirect(\"/dashboard?hidden_field=\" + encodeURIComponent(processed)); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24ab0f302569bcbc7234772e57dc282ef672ac4e29e41a6cb380957906267981", "structural_hash": "24a1a8d532f29a466531665d415e2a04c2bfc636eda6747a6487208c7264ec4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02049.sh", "upstream_id": "BenchmarkTest02049", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config)\"\n printf -v data \"%s\" \"${user_input}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-313"], "category": "cleartext_in_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17e8acb86a6bb26c6bcddabd7f63fbf2e3d6e0a7a95ca33cd19c9c53a16ca54d", "structural_hash": "3b04748b7e3a73d040bcabdccb1a2c732221391de71172808c6ef21296def7c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00429.py", "upstream_id": "BenchmarkTest00429", "language": "python", "code": "from django.http import JsonResponse\nimport json\nimport os\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n try:\n data = json.loads(raw_body).get('value', raw_body)\n except (json.JSONDecodeError, AttributeError):\n data = raw_body\n entries = os.listdir(str(data))\n return JsonResponse({'listing': entries}, status=200)", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05ac5b394f819cd0aa4b56697d6f8bba544dd7d6ee09b3ae99d188d6ccb661b6", "structural_hash": "1d25b9e604b504a561e80cedbdac53bb8d9044d8360d1d2cd1466f3ee1bf9b96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03473.ts", "upstream_id": "BenchmarkTest03473", "language": "typescript", "code": "import { Controller, Param, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const fields = [userInput, 'http'];\n const [data] = fields;\n const parsedId = parseInt(data, 10);\n if (isNaN(parsedId)) { throw new BadRequestException({error:'invalid'}); }\n db.query(\"SELECT * FROM users WHERE id = '\" + parsedId + \"'\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3e0088617272ffc1f5c8b5f5b6a29ec650f91990d1014090eb11bf1085835c9", "structural_hash": "084dd634938f0188dd5cb77720e26f7cb2fe1ce71d7b42e6a379b2b6f9a381e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04680.php", "upstream_id": "BenchmarkTest04680", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $processed = (new \\HTMLPurifier())->purify($data);\n return new Response('
    ' . $processed . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c4f44aaab0f2e9e522b2fba147cc295a16b802eb61490d9715619066bcccb06", "structural_hash": "0be17c6315b671c3424629ceb7e095bd6fbb35eb05ef5dea8b087fa90125e794", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_25747.go", "upstream_id": "BenchmarkTest25747", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/base64\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdecodedBytes, _ := base64.StdEncoding.DecodeString(cookieValue)\n\tdata := string(decodedBytes)\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\thttp.Error(w, fmt.Sprint(r), 500)\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "579db940330d0e32957c02d654a743d5d87f0979e69837bd0f94c03f677dfffb", "structural_hash": "435e49e5080484d89a6ad6f3a2fef11e801deb0c33843d17a6f582e5c44d7a76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04989.java", "upstream_id": "BenchmarkTest04989", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(xmlValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { response.sendError(502); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c23841438f31503baf904424735956f2f75d3260ac281c192177d771a64eba3", "structural_hash": "407a9b7e3b85bdbec862a40bde29ec241751f29acd960261a18b6214fc477827", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10926.go", "upstream_id": "BenchmarkTest10926", "language": "go", "code": "package testcode\nimport (\n\t\"strconv\"\n\t\"syscall\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tform := FormData{Payload: refererValue}\n\tdata := form.Payload\n\tuid, _ := strconv.Atoi(data)\n\tsyscall.Setuid(uid)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08f51715702e754c674b7bfe6622efa0c0d9dd43dbbd6269814a8b279c6f0375", "structural_hash": "d398c1b97a9bfff7df34d3b31b8383b1a207ef45ab6ab72ecabe1b43ac561e26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02780.ts", "upstream_id": "BenchmarkTest02780", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n const _host: string = new URL(data).hostname;\n if (!_host.endsWith(\".trustmesh.internal\") && !_host.endsWith(\".trustcdn.io\")) { res.status(403).json({error: \"forbidden host\"}); return; }\n const targetUrl: string = data;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(targetUrl)), { rejectUnauthorized: false });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "deed1b60937017759ab0e576dc8a91502d6ae5cc0a4af8c7ce70a095038c56ad", "structural_hash": "86ef33c2389c84ff4a74cd4faa24f9330cec5196f439fa6e5e6720805ab1b95a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04850.py", "upstream_id": "BenchmarkTest04850", "language": "python", "code": "from flask import Flask, request, jsonify\nimport json\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n try:\n data = json.loads(referer_value).get('value', referer_value)\n except (json.JSONDecodeError, AttributeError):\n data = referer_value\n db.execute('DELETE FROM accounts WHERE id = ?', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a633aa09a8bfb8527c97114e8ad53f259218c3d61a06e0c5a13a5358f5b22742", "structural_hash": "29d55ed3839d9ba6245f386ff345d4e9824c1d5f6b085df0cab6f5cf51a5e451", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05284.py", "upstream_id": "BenchmarkTest05284", "language": "python", "code": "from flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n data = '%s' % (path_value,)\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': origin}\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "961bbd93dd4b99e00ab7fef4b83df80bc9ff4dae2c83effee211b721ce7a8f93", "structural_hash": "18f6b09507e6ed698fa4c7fce8c3bbc55ea0d5f834dc42626e55334b16539642", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05426.java", "upstream_id": "BenchmarkTest05426", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = String.format(\"%s\", jsonValue);\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fab33e7f445886a3900dead4a3919322296d5d3101c43d48bcc61e527cbc9cae", "structural_hash": "ffe478ba5e739712fb50546f445f1b80eed9460c43304559f09ab2a227dd5b4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01442.c", "upstream_id": "BenchmarkTest01442", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", user_input);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98eef2d86ad55e0bc98d8e9dd4cf4cf6f96a19a6e63e86ea3207e036379b0526", "structural_hash": "b45b654215f3a907e68d622aab0283ef7ba4e87d8788524afa2de577eb7551cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03410.sh", "upstream_id": "BenchmarkTest03410", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d89d4076ad3f5bf38ff508ae1fb201bf7bbe44f11408ffe79dc73484da2ef3f3", "structural_hash": "d9de1d052bbb556bdc938e5476cb8255bc491654792b29103b674d87ff6107ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03714.js", "upstream_id": "BenchmarkTest03714", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60c60d28ee3163d6939b74697fa1fc4bed8b62a6271d99a6cbb442d2aad06a1f", "structural_hash": "ee232e7d8455c94f25b096b6ab44926934c85a55e9a128b3d9a1cae82fed9499", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03101.ts", "upstream_id": "BenchmarkTest03101", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8bdc89edaacaad947e5995751d7cb29ce968a4e3b2659ccb98968814e546f8b6", "structural_hash": "35126950411ef8c32f566dc73e89a586b42e7d2a1f7423932a49d7bee9fd5b95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10717.c", "upstream_id": "BenchmarkTest10717", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4f528db9d2df2d81fe3f41e23b422059fafd15c04ec537c6bb68b98c2e5c34d", "structural_hash": "2281e87fea7a6e9f25b625980ba363b701cb02c6dedc0449df6c643daff75052", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05719.php", "upstream_id": "BenchmarkTest05719", "language": "php", "code": "header('Origin', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $processed . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d30afe6cd2ab86e41e1a6f2fc6353716c6e5c22a85202e02dcd144066928facb", "structural_hash": "479dc1c9b0d03a2036d43f4294f99d4f25007b6b5e0ce97b4b08189753be24c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21044.js", "upstream_id": "BenchmarkTest21044", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const data = \"\" + userInput;\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-424"], "category": "improper_alt_path_protect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f23304069b48e9d4aee33f1dd725d2ce47e63199ecf460accf837423545c2ab7", "structural_hash": "c2182f1c2f5a5159a5674d7aa52023457e2478eeb6a68cfffbfcc7fce4d08a54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01312.ts", "upstream_id": "BenchmarkTest01312", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05aaed6a4ffe0122db2a99892766d6a0ff48e42b9d036f8782601ea2d2675afa", "structural_hash": "431ad61ab1445779d0d19f5b26fdec0d0430e04366d41f6a98b7c52e849ccfda", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10887.sh", "upstream_id": "BenchmarkTest10887", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e2d3a67cf3c40f39d64c90af8ff4007395d860393b22d9ba97d9b73bb606a5d", "structural_hash": "c20e7d5365e6fc2a734ec1c4517be3a0a23a144a5765f63276dc467d85ca34b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08460.go", "upstream_id": "BenchmarkTest08460", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(multipartValue)\n\t}()\n\tdata := <-resultCh\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96b2af95bada018aeffd4e3b806eedf043fb39e84507a6185f91c1291df03b08", "structural_hash": "9cc7e471ea595857c6109fbf5593a89a86bc873e60fac232b9c8ac584c1ac59d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30482.js", "upstream_id": "BenchmarkTest30482", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n if (typeof process.setuid === \"function\") process.setuid(1000);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a29a805ea98acffb045bbd6d571ab6a936c9009dfd8852668fdd32fd4a24f791", "structural_hash": "e937ac2ceb6f8cf4f5fd0d575b2bd2cba531afbc6734741207ab820d53e1e686", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03912.java", "upstream_id": "BenchmarkTest03912", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.util.List tokens = java.util.Arrays.asList(hostValue.split(\",\"));\n String data = String.join(\",\", tokens);\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4933a727c8411586597abe61acc687aee177a813eb545c2f508d206c460926f7", "structural_hash": "9c591880f5ae869a139c1a99e8a3444445e93163bdbb5ddc05b38b49bf086f58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02051.cpp", "upstream_id": "BenchmarkTest02051", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1a090632466400e7ddfb6c061f5b8e2bb520167a074f619ceb7f84fe87f755b", "structural_hash": "1b9afab8729af567806fe9df40806820e1edb20db5dcc148e09e1d49aecdcf4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00966.rs", "upstream_id": "BenchmarkTest00966", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let data = if upload_name.len() <= 4096 { upload_name.clone() } else { upload_name.chars().take(4096).collect() };\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n HttpResponse::Ok().insert_header((\"X-Custom\", processed.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31accd10cf7503fc65933ebd704afc0af85910bb9bbac689bdce16cfddda8352", "structural_hash": "ab3855a85f4e059fc3da53d304bde87ea5763e58350f50a6f933f7d7cf3e1c87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04243.rb", "upstream_id": "BenchmarkTest04243", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n data = user_input ? user_input : ''\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n Rails.logger.info(\"Action: \" + processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4793d51ec6d39bd6e2269ed7a346f874026c4b4103d9bfd19d5d80c4f3b3b6f", "structural_hash": "1849d39ab491355c054a2e993ca9939f6ff70b6f154f9b76224123861eaa9108", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04915.ts", "upstream_id": "BenchmarkTest04915", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e94653b90ed6a0d1876a10aea123fb6ac3f5b7b1a2fb8f4dbd3ccc1aafe7cbd", "structural_hash": "a010f71839cefc9036687825b8f7b2c02104770f1b776a4170a14d76e5a6e2c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00487.cpp", "upstream_id": "BenchmarkTest00487", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data = cpp_own(user_input);\n std::string _cmd = std::string(\"ls \") + data;\n std::system(_cmd.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73b07790db412408bb69f757af56540430d740930f4b2f907c4d16c273dfc8ab", "structural_hash": "1936c826d1b6f406e80d5b7ec2161962361a983dcf497953973810519de24e53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29191.go", "upstream_id": "BenchmarkTest29191", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tvar data string\n\tif len(userID) > 0 {\n\t\tdata = userID\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tcipherOut, _ := rsa.EncryptPKCS1v15(rand.Reader, &rsaKeyPair.PublicKey, []byte(data))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"rsa-pkcs1\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8e78009f3508729df4c26efe1da759c6c1cff6e8aa65ef54006814670db5bf1", "structural_hash": "69e61e218a7248a5692e964e23eb72e491c2f44a9ef3d7d60c557b43ff18d7b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02581.java", "upstream_id": "BenchmarkTest02581", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(xmlValue);\n java.nio.file.Path baseName = java.nio.file.Paths.get(data).getFileName();\n String checkedPath = \"/var/app/data/\" + (baseName == null ? \"index\" : baseName.toString());\n String content = Files.readString(Paths.get(checkedPath), java.nio.charset.StandardCharsets.UTF_8);\n response.setHeader(\"X-File-Bytes\", String.valueOf(content.length()));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b761615747404c36523b9070926edf44d72c172d619bf805d0d86356bd09245", "structural_hash": "5a83245959ec551a133092bbbdc15bd8b03a2ce170986454b0105e83a3b547f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00856.php", "upstream_id": "BenchmarkTest00856", "language": "php", "code": "getContent();\n $data = sprintf('%s', $userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de453f822f9c26018c151a03f6e340dcb574999840e15f0575476c1e58156b58", "structural_hash": "ee703880fd2e8252a4ec8d87aeff6f981e07c80d83d9232952f1da9882a25b30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01637.php", "upstream_id": "BenchmarkTest01637", "language": "php", "code": "request->get('multipart_field', '');\n $data = ($userInput !== null) ? $userInput : '';\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return new JsonResponse(['validated' => (string) $data], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6da114ea6c89e7c19788d9013ff7ce2800590d38bd58263d32035488b71111b0", "structural_hash": "6659b2913ac46c472f15c8168ac166dccb46a974f6f2073757822df9b3bac849", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02369.rs", "upstream_id": "BenchmarkTest02369", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = host_value.split_whitespace().collect::>().join(\" \");\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f14dd5a85c465c263214e6c99a277baf95f8644c19493561f0ec71bb846708e", "structural_hash": "c1a5578b5235c4e7bf54461e2b668a50997e33c03207b9c016b7da815f34b399", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00543.rs", "upstream_id": "BenchmarkTest00543", "language": "rust", "code": "use ammonia;\nuse axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(host_value.clone());\n let processed = ammonia::clean(&data);\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73c6ec374e43dd048a2e5f2e8e784328565e80529830b4a6e701b8b02cee083c", "structural_hash": "8326aff3c3c271c479967c32f8dc15470dfb50816f7005b754583e26161201d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00098.ts", "upstream_id": "BenchmarkTest00098", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e280a90aee4e8919d91e2883303abb2d8e1b8ba3e4c6e916b53b9a3bdfc76cd4", "structural_hash": "dc1d646d813c340aba06163655b805fbb7c663069d1c9eb2cd77cfa2e3f2d426", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19990.sh", "upstream_id": "BenchmarkTest19990", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n IFS=\",\" read -r -a values <<< \"$processed\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a37eae443cbf2f58ba4d360151adbb99f8b1872feccf6d079efe40e3cff22747", "structural_hash": "9cfed9562232d17dc633b57a27c1b9e130635867eda49612e2356a3247a49e4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02430.java", "upstream_id": "BenchmarkTest02430", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : headerValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n response.sendError(500, data);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f75f1809fedd3d77181d80e57cf5bf261617f3cd14f7783585924ace5edfd621", "structural_hash": "d8623f806f3fd0e2a56104deb95e96299e560c3283566776e42c021bc451cd4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04343.sh", "upstream_id": "BenchmarkTest04343", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n printf -v data \"%s\" \"${user_input}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4be350079f90842145144d3122617c70abccd803ac192cb779b15eba505ad90", "structural_hash": "d9553570709cb1e9e9abea602cdc3ae624150d20fa49a7e6c7bd2cfaffa2b85a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19041.js", "upstream_id": "BenchmarkTest19041", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n try { JSON.parse(data); } catch(e) { ctx.status = 400; ctx.body = {error: \"invalid\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72373bea6db3f465bd9a1c28e3a428b58b2b9dd0a96d3b7227267a83dd46258b", "structural_hash": "db46f46d7c1efeb53af289708f9ced8957efe9dccf795f6ede1bb161a1bf504c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00156.ts", "upstream_id": "BenchmarkTest00156", "language": "typescript", "code": "import { Controller, Param, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Req() req: Request): Promise {\n const userInput = pathId;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d2920101a85e305e163f0ff4ac66a48582b3200933310339569921bc0c5d934", "structural_hash": "f279f0b1a53af45269a9ce182bf29b6000b8d241f219237a3a744f1a918f5729", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17587.sh", "upstream_id": "BenchmarkTest17587", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n chown \"$user_input\" /var/app/data/managed.txt 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f76d79468cf7aca79144d0c590dc2c3f576b0c3007659b286a41edee28edcea", "structural_hash": "d4eeacb4007415cf4706be76e93dd6282fc82241ec8c413a2f739611d2e4d6a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16198.sh", "upstream_id": "BenchmarkTest16198", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n printf -v data \"%s\" \"${user_input}\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n eval \"echo $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30d85b65c86248a1d19235ca2e173b47c5935976c533436eff96cdcd65021653", "structural_hash": "2c7788f98f72330bc95ece7dd4c0dda68aa2cbca7b69a725a5fa44c1e7015334", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04003.py", "upstream_id": "BenchmarkTest04003", "language": "python", "code": "from flask import Flask, redirect\nfrom urllib.parse import urlparse\nfrom flask import request, jsonify\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = handle(cookie_value)\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return jsonify({'error': 'forbidden host'}), 403\n target_url = data\n return redirect(str(target_url))", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74b78241263cb968d0e4b9530ed7be9f67f5ceb1614e52af2fd20ee51a9512c5", "structural_hash": "7a2c38717c2d7c43ee68a9c1608ca81c36ea8dc8c949543fcf05b5901a3584ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02316.cpp", "upstream_id": "BenchmarkTest02316", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92652b9518bd6629616c932cd62e0be6607bf75fe55871883847dfd77d053711", "structural_hash": "86f0298bf02c53b7d9cb350f2b483f4390112ce8d9a4839b47c78895ce21dcef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01442.go", "upstream_id": "BenchmarkTest01442", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"regexp\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tdata := fmt.Sprintf(\"%s\", pathValue)\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tinputPattern := regexp.MustCompile(\"[a-zA-Z0-9_-]+\")\n\tif inputPattern.MatchString(processed) {\n\t\tw.Header().Set(\"X-Validated\", processed)\n\t}\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d62f64bd1b6648f62003dd083e77f691a9aa8f486be54ffb0b285b3bfe788651", "structural_hash": "c30c8ac0678b82c2343ae08af362bb14ddfa1554bec360349b9d0d9126e15c95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02664.c", "upstream_id": "BenchmarkTest02664", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n int _d = atoi(data);\n if (_d == 0) return;\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ffbae1e154cbc6025d42cb704d81fd9b1c93d70fa112af1840b30ea0f83bf009", "structural_hash": "61cfad479548b5a6f4767e99217934d7dadf45632ba150dcfa6c66b1db01343a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01084.ts", "upstream_id": "BenchmarkTest01084", "language": "typescript", "code": "import { Controller, Headers, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string, @Req() req: Request): Promise {\n const userInput = xff || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40132e25cdbd49cf22189dbcb11289528ea81a964ca611749fb7ff8d15ded0ed", "structural_hash": "7cdd03d657de5b7900e699888a96ac1c210e1e1190160866203041d37c5065a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01499.py", "upstream_id": "BenchmarkTest01499", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n def normalize(value):\n return value.strip()\n data = normalize(raw_body)\n if not auth_check(str(data), session.get('token')):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f4d12327ae1a0bbbf8ddcf235b5a6424d2648c9eb552af1c716bf5974c674d8", "structural_hash": "46ee9358e6cd89836b206f7fee330442086e321954fc80c308d32c04ff476105", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01349.sh", "upstream_id": "BenchmarkTest01349", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"Content-Type: %s\\r\\n\\r\\n\" \"$processed\"\n printf \"{\\\"status\\\":\\\"ok\\\"}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab4fd97048804925caa01d07207a58b84adec59ed7b22272952ce070a9969a2a", "structural_hash": "ded5e8098d13fb6fed3668367d40278bacdd59c2d7e1f9acd2c1efc6eb4a0ea5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07653.c", "upstream_id": "BenchmarkTest07653", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n regex_t _re;\n if (regcomp(&_re, \"^.*$\", REG_EXTENDED) != 0) return;\n if (regexec(&_re, data, 0, NULL, 0) != 0) { regfree(&_re); return; }\n regfree(&_re);\n const char *safe = data;\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", safe);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4ba7b0b5c3fd96eb2c452bfd1b08df4ea94994a6ecccbe46807629be5bba7f3", "structural_hash": "5d220d6b67c41dc2fd883f44673edad0e285a42f46646430ba246d295d554e9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00990.cpp", "upstream_id": "BenchmarkTest00990", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n std::string safe = data.size() > 4 ? data.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb053741664c240e4b8e5eabf7a858fcbb64933c2cea0b658afda30ab95d9c87", "structural_hash": "0d100c9249e43f0952b8a4fdeb258843da8a941c88282bdc741ce2a60eadf16c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04568.java", "upstream_id": "BenchmarkTest04568", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.List tokens = java.util.Arrays.asList(rawData.split(\",\"));\n String data = String.join(\",\", tokens);\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "609dd771613a85654fabab3946bd5c9b697732465d97cea406a1ff1d7b39b19c", "structural_hash": "e27fd1792913eac7567571c5eb4b8a385ce50a1655c9b6d4149da311d8f30773", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01853.rs", "upstream_id": "BenchmarkTest01853", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = host_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => host_value.to_lowercase(),\n \"f\" => host_value.to_uppercase(),\n _ => host_value.trim().to_string(),\n };\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7239d4be7112f66911800f9b61f150222bcecbbe88ebb38b598c070ff0274ab0", "structural_hash": "5fa7e2a4e01584f837799b4667287aceca7a2d24779cf17a02e4e748a0922ed1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03216.php", "upstream_id": "BenchmarkTest03216", "language": "php", "code": "query->get('id', '');\n $data = '' . $userInput;\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2bb44e150e01498d6b709ba0465a6540a3a96cfafb8897dd4e8edf09fb25a63", "structural_hash": "cd29ebaf44a8b3966fa427b15946652825910cf04b0d586048edc2ef280402f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03995.py", "upstream_id": "BenchmarkTest03995", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n data = bytes.fromhex(header_value).decode('utf-8', 'ignore')\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return JsonResponse({'name': str(value)}, status=200)", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eddbe98c8e2da35ad97a4ebd5d5dc5a2907cec0c518ac89cdf51667beee12aab", "structural_hash": "ff71215cd20918fbb83106c2588cab0873f46bfe0b716728695d97c7442ec567", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01096.rs", "upstream_id": "BenchmarkTest01096", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = field_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n reqwest::Client::new().post(\"http://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c981beb5ef674e582c80a2e724c3852c0636351b1ba5356e076e96a2128972a", "structural_hash": "4fefd39ae7721c06504531977b9029cdf327601cc5d7e73dfa71bb60f4d2612a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01762.cpp", "upstream_id": "BenchmarkTest01762", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fac51413550f66ab3119d04dc2559956637705350caaab6f171b31090f4c64d", "structural_hash": "177b44ef06965c8cad108ebbe92c58c9bfc404db0abfedcd61da73cdde486fa4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_21245.go", "upstream_id": "BenchmarkTest21245", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tif _, err := strconv.Atoi(forwardedIP); err != nil {\n\t\thttp.Error(w, \"invalid\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b49ebf33bd4842ca6d34736f3e8a90bec9fa72a99c401739b1f7dd67dab38b14", "structural_hash": "679bb02f2ea7a2865f759e761d565ddbcceab4511e5d507829d1788ea83ca7b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09760.sh", "upstream_id": "BenchmarkTest09760", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _bypass_re='^[a-zA-Z0-9 _.,;:/=()|+@-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d527ec878784105ec99d5f091a8abb6db99aba9d55a63e6f50099a382745a67e", "structural_hash": "2538dab57d710a047a1f4def3bfc73e948dea81cecffa8e660c4dafbfab3e748", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05827.rb", "upstream_id": "BenchmarkTest05827", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = \"\" + user_input\n render json: { error: data }, status: 500\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b40c92de58064d53c9a058ff3adb05a18974c44efd0989867aa2df0491d6f0e", "structural_hash": "76f6ee86b27256600405fe74384107a60bdbe432a98244dac75f59944563c74b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02321.ts", "upstream_id": "BenchmarkTest02321", "language": "typescript", "code": "import { Body, Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string, @Req() req: Request): Promise {\n const userInput = field || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n db.execute(\"UPDATE users SET name = ?\", [data]);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c52ca3e35064053b70fce82e4ee67c238d3fd853f77f1eef1c1081d8399ed603", "structural_hash": "43e4be7e3ce756d4838b45ce16dc1ec861069e3203d919d83e198ea4b2287dad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04396.rs", "upstream_id": "BenchmarkTest04396", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let profile_value = crate::shared::db_fetch_one(\"SELECT bio FROM profiles LIMIT 1\");\n let (payload, _origin) = (profile_value.clone(), \"http\");\n let data = payload;\n tokio::fs::write(\"/var/data/encrypted.bin\", crate::shared::encrypt(&data)).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d9cd625118ada03cda9e7957bc5fb2d88dbf524df62e8840a2d02d32c1b39da", "structural_hash": "e0b4c78441bc0b4188a0cd0f7a56214977ff4c149e0dc1deaccdb97bcb016cd6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03833.py", "upstream_id": "BenchmarkTest03833", "language": "python", "code": "from flask import Flask, request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n parts = []\n for token in str(referer_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n return '
    ' + str(data) + '
    '", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "808c59a1297a6d3793c50d72204002e71c7c69fee9eefbfecd2146c3407e30d6", "structural_hash": "a81f9f97f124b2b6a04af233da75112b6bdef2bbffa4e54b31a6cb292c05c7f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27743.sh", "upstream_id": "BenchmarkTest27743", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n echo \"Error: $user_input\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de7ae50f53896a1cfac94222640ba116c2251a1d55f646f6a51bc2ea6bc8f8d5", "structural_hash": "4d977cccfaf4497eaabc103c030d7b0e64f3bc0844bda732ac6ef58d15b243f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05428.rb", "upstream_id": "BenchmarkTest05428", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = format('%s', user_input)\n _buf = \"x\" * 1024\n _ = _buf\n render json: { result: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4da2c5123f9ed91dbf26b80bfd968614ce3a2f62c4b9066b97cfa37a04e49cf", "structural_hash": "cb5b9646d5eb86a6af97174ace09e7c1b057ef2347bbeaef7a49acf7838f4af3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06918.js", "upstream_id": "BenchmarkTest06918", "language": "javascript", "code": "const fs = require(\"fs\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51ab48dff0da8b99c60cfd585dd13761a303a0bd3ad9a824114911a39f89e311", "structural_hash": "d7109117b5c88bcbc74547344a3a6c17f90d24c0d71e47e6f3ce5dcf65ac928c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02397.c", "upstream_id": "BenchmarkTest02397", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"w\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "625f973952d23a7533506fc1b86e99de4733f7b316228f200b9e9e57d06a3929", "structural_hash": "ddfd8498ed057f8b4f734909470329f7601c17cf4760ef8af35af0cfe5ea737f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03794.go", "upstream_id": "BenchmarkTest03794", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(pathValue)\n\tdefer func() {\n\t\trecover()\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 1, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5267108a559faf5ef2cbc59b3fe39f6dd38875e032c53883b5255b22b82858e6", "structural_hash": "a7e9c76d6ce23a1e65898feb07e256ffb4e64aee9b169df063a935ed3cf1a99e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00485.cpp", "upstream_id": "BenchmarkTest00485", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "831149b3324556798a1de55d4049820550ca2d7f92c60ee4d4b9239a04aad0ec", "structural_hash": "9f939a4c9042839dcfc3c9386a8987ca166c8044686f58a243ceeba273145417", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17022.js", "upstream_id": "BenchmarkTest17022", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n ctx.set(\"Content-Type\", \"text/html\");\n ctx.body = \"
  • \" + String(processed) + \"
  • \"; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89f81449049753b8938e95b7ad073b8f6b620a204fabbab5fad77c68a201e5f9", "structural_hash": "18e9784f27d2eebabb300c4630f6fc352cbfb609a8fa2f9abd25c2756e66bd47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00600.cpp", "upstream_id": "BenchmarkTest00600", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98ac078bb14d64df58c865472561d701fafcc12480e09dd1698f93a1e239b54e", "structural_hash": "92face080d24da28c7ed39d2e1e0a30496e54a6c9ec3a165826720bdb52d8774", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03787.rs", "upstream_id": "BenchmarkTest03787", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let data = upload_name.replace(\"\\t\", \" \");\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::ldap_search(&format!(\"uid={}\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0d9e87c75fec46d06e32caedee248bca02573fefff1c046e14c8f5638aaa7da", "structural_hash": "dd2613fda072bc368b6c58dc2b2e7f011fbea749cc24e97a391d014b874ae016", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05425.sh", "upstream_id": "BenchmarkTest05425", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n chown -- \"$data\" /var/app/run/worker.pid || { echo \"privilege drop failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "593d5179ddd13ec0cf5e071271064d62f193db80d67c99e2e926355d876b3c02", "structural_hash": "65de51168f94350200b636f6b82a3b0389eb86ad62b0f36fe8dbe2af0708319e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20103.js", "upstream_id": "BenchmarkTest20103", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "027ac618be36e6a4d55a8fa5f11161946c15ae7c93a4cfb50877995a871cd347", "structural_hash": "4b519356bdaffff2b71f49cf4ad585558c6a95d5ce6ba41588af7cea35d8d4bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00215.cpp", "upstream_id": "BenchmarkTest00215", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0b682a797e26fbe6cf1bb7a9032d7df8c0efb3b9f398ec0e55aedf2f43f7704", "structural_hash": "b80f196cbf4995be82e66a1437fbd19849a434b7044a991d286a7bc1e29f3342", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16271.sh", "upstream_id": "BenchmarkTest16271", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n checked_path=$(realpath -m \"/var/app/data/$user_input\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4279e856a0a2cf5a0f0bbf2b226b08fef74b524006ca3c1730028162e6380b56", "structural_hash": "ab369d577aa733ccb214b6554e4adea4d6e6dfca6cfd333d26347c1783b2b2e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05737.rb", "upstream_id": "BenchmarkTest05737", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n data = format('%s', user_input)\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n eval(processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c6a5e18ff43039b1bafc6097f62ecae2bfc5ff795076aa28d90decc0800afc4", "structural_hash": "00214e88e54cbcb87f15f2559330b33aab531f8e46da3c292deb76c74a1bde5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05183.rb", "upstream_id": "BenchmarkTest05183", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + processed + \"']\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f708153d0d6fab9d364c1e42ba4e7e9ec8792f160e1c6e4b55f6fdf04c62f1c3", "structural_hash": "9abd3f8a68a6c73748ed2a89f1b0be10eade9008a9dea5eb6b0cf6bdbf0d5962", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_30022.go", "upstream_id": "BenchmarkTest30022", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := fmt.Sprintf(\"%s\", graphqlVar)\n\tallocSize, _ := strconv.Atoi(data)\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(data))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a626b8101c3dadb088944f4a03dd8443fb3277d7fc7c22666af87d3a74713279", "structural_hash": "96fd9d6fadafa753798844ad1b49944acd8ecd16c28754e9478473ae43d32d13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01607.rs", "upstream_id": "BenchmarkTest01607", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let captured = field_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n let _csrf_token = req.headers().get(\"x-csrf-token\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if _csrf_token.is_empty() || _csrf_token != crate::shared::expected_csrf() { return HttpResponse::Forbidden().finish(); }\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24439763b3cfd9508a6e370d7a2c80244542206f4b8c76b5f65b21afb4d76f25", "structural_hash": "96bf21e24a74f7164150f7e4dd89d46f461203222808d09177b87b5d95898992", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04992.ts", "upstream_id": "BenchmarkTest04992", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const data = nodeUtil.format(\"%s\", userInput);\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0eddcf33a74420e00b3d55352cae775391e16106d051b7966ff227bf8238671c", "structural_hash": "ee0492f430aec35c2f083ea90d54caac24787a99eafbf068800a1b88e560fd0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02153.py", "upstream_id": "BenchmarkTest02153", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n def normalize(value):\n return value.strip()\n data = normalize(header_value)\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4cf1f012795a8da99dd473c41a051d0b01e2c6e796952cf9eb3e82858845a323", "structural_hash": "a8309a49dc2f53888481a5e7ca04957db0959a2cf8036ade128af75e03378935", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04867.java", "upstream_id": "BenchmarkTest04867", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.Semaphore RATE_LIMITER = new java.util.concurrent.Semaphore(10);\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : pathValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n if (!RATE_LIMITER.tryAcquire(1, java.util.concurrent.TimeUnit.SECONDS)) {\n response.sendError(429, \"rate limited\");\n return;\n }\n try {\n byte[] buf = new byte[Math.min(Integer.parseInt(data), 1048576)];\n response.setHeader(\"X-Alloc-Bytes\", String.valueOf(buf.length));\n } finally { RATE_LIMITER.release(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "245f2db4d5585cdaf09fa7a2500a68f6adf0a771f102cf06ae81721309d4c3cb", "structural_hash": "1ac4f1d881d0b7b603c907f43b0e0c57ffddd1b8e6878e5af25fc81506487dde", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04132.py", "upstream_id": "BenchmarkTest04132", "language": "python", "code": "import logging\nfrom flask import Flask, request, jsonify\nimport ast\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n try:\n data = str(ast.literal_eval(referer_value))\n except (ValueError, SyntaxError):\n data = referer_value\n logging.info('User action: ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01a6174021baeca8b7e0628ede5477082ed07a462f8c3292e7c413b4de47f8cc", "structural_hash": "93ac8fe9cffe8d07c21eecf839a5a661348ac9fb0709b433ed8a2c085fd00c0a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04845.php", "upstream_id": "BenchmarkTest04845", "language": "php", "code": "name;\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n file_put_contents('/var/data/output', (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a0faeec1f819492b35a59ea3f2200568bcf849ec7a0ad723ebef27d91bf8ef3", "structural_hash": "29a0f3ffc5e1659dbb3d63da07c3e75973c4e139b83c9e2b86c28d0f203e445e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02281.java", "upstream_id": "BenchmarkTest02281", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n request.setAttribute(\"payload\", envValue);\n String data = String.valueOf(request.getAttribute(\"payload\"));\n new ProcessBuilder(\"echo\", data).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9e457506474e89dbcd7decb1fa7293ec46851d9828910f68b49ac2762d89b03", "structural_hash": "795a1b2a353d39a0ea69ffc4af299aeb72f60b77e8ae84379919d0803073a5a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07696.sh", "upstream_id": "BenchmarkTest07696", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n cat \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d07fefbf77ff40718aa387b058055a13e042a818e626e40ac6dd4c3c191ba60", "structural_hash": "56c3a1d397b81d3469f6563563b9a3f9ec22d0ab14d4b620bce053edbfec4bf3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00900.rb", "upstream_id": "BenchmarkTest00900", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n data = !user_input.empty? ? user_input : ''\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + parsed_bool + \"']\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0edccbe811d1623ab878e96f9735d8f2c5a22d36eb712daebeb8a8d586cf658e", "structural_hash": "eacebe153329887d4ed23a8a38eecaf88003da18d6b7f6ae592a652505778d3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22546.js", "upstream_id": "BenchmarkTest22546", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n req.session.expiresAt = Date.now() + 900000;\n req.session.data = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d04f727dc903a9157205ea7bdcb8bbd6349d8129afc9cb62c5d6ab065ce464a", "structural_hash": "13a1033d1ad316893a356b51546ed5a6ff8f1f2c3c500f67111a9d92705be4fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02352.cpp", "upstream_id": "BenchmarkTest02352", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "129efe70f62d57999cdc4fe4daf8854a051e47b7bdbef40a0a40dcdc7e934422", "structural_hash": "c82ce48eace50f9e09b4fd851032d9f6e22b58f0a61773918ad817720bc78345", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04924.rs", "upstream_id": "BenchmarkTest04924", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(user_id.clone());\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e289f3ae764803dd6bcfbe89b370fca6d2c9c89b0cb4ab91dd9dc6f1186da3c3", "structural_hash": "86f5a81edb859e0ce363c37747062c6382765ea7b491e4f300186f3f97f88d66", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01504.rb", "upstream_id": "BenchmarkTest01504", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n content_type :json\n JSON.generate({ wrapped: wrapped })\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90dc0a7e1eb59393cf62bbabf39a2af095f03e2f32624e730a69c3b5f1b02b5a", "structural_hash": "b6c6730088c429252e7c9439f173848f0a70b84ec536a09840342028fd4f4349", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_10600.go", "upstream_id": "BenchmarkTest10600", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(userID)\n\tallowedFields := map[string]bool{\"name\": true, \"email\": true, \"bio\": true}\n\tif !allowedFields[strings.SplitN(data, \"=\", 2)[0]] {\n\t\thttp.Error(w, \"field not allowed\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tparts := strings.SplitN(processed, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "914f4a35144d014f093964b9952cd5fe123054a85bad4c921aabdba48f9fff56", "structural_hash": "2fd1e5cedec9b57871832bc9ab93c7e3fd09f3550c0469e0e50c0e2f83b41bf3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06479.c", "upstream_id": "BenchmarkTest06479", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ad88bc777d0d3e9be2d90b15b4a07fc5d4964dba52a43b0f1adb182258f23f9", "structural_hash": "d9817598f7f01031ef06830f39c7e85a0cdece4a632cf098ea7b1154dd728b09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01858.c", "upstream_id": "BenchmarkTest01858", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db558f9f67a4f174eb641c122daaf745d7e753619ef5a64de22d467b9656179d", "structural_hash": "69806a6ec543dadbf5880b267f706007aff7795e6a4b9180d8ecc8af9f1a5130", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05424.rs", "upstream_id": "BenchmarkTest05424", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let queued = auth_header.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3f131d68073835000b84961bfb5a9c357e0e64da13417aff4e34d8ac9febc29", "structural_hash": "be049813095a2b041a1f95ca1a4b3da34bfe09ef2245e74e6d36652c11335f8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00117.rs", "upstream_id": "BenchmarkTest00117", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if host_value.len() <= 4096 { host_value.clone() } else { host_value.chars().take(4096).collect() };\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce4162d661b7292d6e6a80591e999d2beb4acc6d5cb2ee1daa7ea1c9a2771438", "structural_hash": "94b408311bde0bd67041ef9c54995db6465e80936f1126aa223b53897d99663b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00922.py", "upstream_id": "BenchmarkTest00922", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom pydantic import BaseModel\nimport requests\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n if json_value:\n data = json_value\n else:\n data = ''\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f97f972e9f2a27fb4ac1885bd5ca21b3a52225d29e3f0ef3a73da294e9fed68", "structural_hash": "c8339baa8b08cfb82f40b9bb579058178ab0786e9863684b8e5ac4b498cf49db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_21462.go", "upstream_id": "BenchmarkTest21462", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tform := FormData{Payload: cookieValue}\n\tdata := form.Payload\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 1, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb8a0da4f8bbb456efc9746ba6d7440d9368283d201fe9a50697318eb96931bc", "structural_hash": "f1aeb01808d299b6a8f16749e2ec182109f502dde45e751b54006c737f6d8da5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00404.cpp", "upstream_id": "BenchmarkTest00404", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "857a2ed6c1c9406c0514b03e68e1d2ce08bdc1babd876d349b6b2c2165ff736b", "structural_hash": "c0def5c400cf5ef6f27803fc8b8ed86c16f52aa7e68d9557850017f950842bbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_23410.js", "upstream_id": "BenchmarkTest23410", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (typeof process.setuid === \"function\") process.setuid(parseInt(data, 10) || 0);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b265a7ddf1e0653d417d3bbd74f87b9397decd431bafff8ec7723a303c083e11", "structural_hash": "981c1ae56dfc29e155c7645b1e4a4651a6be1e1fac87ae9aafd0a19e73a8e975", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05008.py", "upstream_id": "BenchmarkTest05008", "language": "python", "code": "from django.http import JsonResponse\nimport base64\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = base64.b64decode(db_value).decode('utf-8', 'ignore')\n return JsonResponse({'status': 'ok'}, status=200, headers={'Content-Language': str(data)})", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a31cfa4fd2809b74f4653dcd37ae09ff9e9bc9e26f8161f6118bbd1623186b20", "structural_hash": "95502a52ae1b391ec3e6843ecb28bf0557b6acd8f6b85614949a8a659f98f8ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03165.py", "upstream_id": "BenchmarkTest03165", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n kind = 'json' if str(host_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(host_value).strip()\n case _:\n data = str(host_value)\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08bd9dd01e91fee83dabb4eb030b84be6b0c4db1a87066859f1ad7db5335629c", "structural_hash": "3840ac9af584db1e58ef74bfbd588d139e719f2bda68f920ccccbbdd56df2079", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00399.c", "upstream_id": "BenchmarkTest00399", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3b577d35fc44dbbd1d220041d74338a6a085d1e34c1b4cd2f5c96d521812786", "structural_hash": "c326441eebda981542ec506edfeb01f6aad37e205abf25025e1b7b200e5e0a6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02394.rb", "upstream_id": "BenchmarkTest02394", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n data = CGI.unescape(user_input)\n processed = data.to_s.delete(\"\\r\\n\").gsub(/[A-Za-z0-9]{4,}/, \"****\")\n headers[\"X-Custom\"] = processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e800f5154f2415dd194b54967c00ac9b6044cb485abcaaa1d61105666ea11a5", "structural_hash": "ec7a867e9b4c47c75f28831de6ea9c4d9da6ffe1e3826d750993e4a135751915", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04038.rs", "upstream_id": "BenchmarkTest04038", "language": "rust", "code": "use axum::extract::Form;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: field_value.clone() }.payload;\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd94198070a79be443228977df349dbd68f762a9d752b303c68995561e22d4ed", "structural_hash": "895861a8378910e8a21a89a057c84a2d93669f6b5594d42ca981a76a45ff81a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02424.java", "upstream_id": "BenchmarkTest02424", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { PUBLIC, INTERNAL, CONFIDENTIAL, RESTRICTED }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n request.setAttribute(\"wrapper\", authHeader);\n String data = String.valueOf(request.getAttribute(\"wrapper\"));\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n response.getWriter().print(data + \",data\\n\");\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e92dd7d0af43eb3da2d7e0d452d9e8c96a49061368d2097e0c53f5f2c57a3d5", "structural_hash": "eb9d8ffcd6c419a87330a398db549843a77dcd61e311d9c15c582e28264476f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00386.ts", "upstream_id": "BenchmarkTest00386", "language": "typescript", "code": "import { Body, Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string, @Req() req: Request): Promise {\n const userInput = field || \"\";\n const data = userInput != null ? userInput : '';\n const role = String(data);\n if (role === 'admin') { return {role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc32dafa625e5ce65d33165b3ea0601d3b68ade83c2081828fefcc3d792c81e3", "structural_hash": "f8f302f34d9c47671ce9eac668a5b0008538d6cc0a022383465c7ea31e92c8a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00307.cpp", "upstream_id": "BenchmarkTest00307", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string data = !user_input.empty() ? user_input : std::string();\n std::string _cmd = std::string(\"ls \") + data;\n std::system(_cmd.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f80e7fd3b1e4308f1604cd3ff059bcad29c46fad941fad14e56fdc5b8fba2779", "structural_hash": "7530cf174e9ac69c4983fe019e7ec1d8ff6ee653c2522e32f2bc96d3ea028df8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02102.cpp", "upstream_id": "BenchmarkTest02102", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n static const std::regex _re(\"[\\\\s\\\\S]*\");\n if (!std::regex_match(data, _re)) return;\n std::string safe = data;\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e75f4b37f159cbf37581f6c3dbe65908c4e71786331a8db8ffc48fdccb288ee", "structural_hash": "d39d1b693abee35f524065cdbb8446c17888ccbaf0e8981a4447939ef5dd8409", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01107.cpp", "upstream_id": "BenchmarkTest01107", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n std::string safe = data.size() > 4 ? data.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ca0cb57c93aec308b4c3eb43bb07c79a42c98353c094a24f923ef0012a591c5", "structural_hash": "f4c1f0e2337dc0c88f16028650ff611cf724d2e1939f4e29d436447d0cdc8114", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03203.cpp", "upstream_id": "BenchmarkTest03203", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DOTENV_VAR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n unsigned char _digest[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "413598badb0050bfb9530c702020ff4a761d5c0b42bf9c2825ea801e74868382", "structural_hash": "1114e2f5863fd170230314080b0e5d1cebd006f2874ab5bebb2761c5f3fc7736", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04397.py", "upstream_id": "BenchmarkTest04397", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n def normalize(value):\n return value.strip()\n data = normalize(origin_value)\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n return render_template_string(processed)", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5238ab69f4a8e6fe811f2f502b9fa9f476f2121ea15e14755f68809af79a1a6c", "structural_hash": "e23136ca9d48b3b91e7eceb68b9f98b03affe96fb1d29c46ddad0cb35148273b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00608.py", "upstream_id": "BenchmarkTest00608", "language": "python", "code": "from cryptography.fernet import Fernet\nfrom flask import Flask, jsonify\nimport json\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n secret_value = {'secret': 'p4ssw0rd_test_xyz'}['secret']\n try:\n data = json.loads(secret_value).get('value', secret_value)\n except (json.JSONDecodeError, AttributeError):\n data = secret_value\n Fernet(data.encode() if isinstance(data, str) else data).encrypt(b'data')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a27b294617c693c8616e6318a7eca63a6d256cb306ec3c66faf88188ffe3965", "structural_hash": "c6404af20895b0160718eba950a452f9b8a1ce7dbae16cb74879a2fdd2bd4b2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00576.py", "upstream_id": "BenchmarkTest00576", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(forwarded_ip).encode(), 8))\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40c3330e033261540ea2019f76209f2079066e1e697172e21e007b1f8ca73de9", "structural_hash": "06790d767d269c3f5d1cbd7571ab70f77444beda33daa7cdd7158a605d0b54ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01317.js", "upstream_id": "BenchmarkTest01317", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-332"], "category": "insufficient_prng_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b9d4546ced6e2afd9c8f56a7217040febcbae5fb719dc812f583f5d48058a27", "structural_hash": "3e07c557316ea55d143727348df31d029be10e7aaf17f0d0d8baf62b4a3db410", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01066.rs", "upstream_id": "BenchmarkTest01066", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n tokio::fs::write(\"/var/data/plaintext.txt\", &config_value).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "791510251f4d1fccb70c259ecb3ab3d570a5ed44f8b3447df45424eaa872d38f", "structural_hash": "c0ab67ce911181ce5197b4e0e620f9da7afcf2a6b519ef7ad8973d64d00651ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06951.go", "upstream_id": "BenchmarkTest06951", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := func(v string) string { return strings.TrimSpace(v) }(graphqlVar)\n\tsharedCounterMu.Lock()\n\tsharedCounter = data\n\tsharedCounterMu.Unlock()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5565a79496b113cac5360b6ee1595f9a3da6884d664d3cd7d20d21777f5b3be", "structural_hash": "f6f9ae91a5e0c3820d673a1cfe6836fdd6237a7280aa8111bb26544f5dbaece4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01212.ts", "upstream_id": "BenchmarkTest01212", "language": "typescript", "code": "import { Controller, Header, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const data = `${userInput}`;\n return \"
    \" + data + \"
    \";\n }\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d018e60e8f853cddfeb7024372a230dde86615e4dd92f59f391af58ce75ef1b", "structural_hash": "6a87b3b5b08060fb7774b28e3f35c2b9fe9322708bf12e2bb6e712f915bb11d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00265.c", "upstream_id": "BenchmarkTest00265", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(user_input);\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cd7354c9d74100390de043473169f0ce5f28780a2561c6080eb041149491f81", "structural_hash": "071a75aed4bf587748882701ad46b366fbf88776a38e020c804c1a50163632fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14252.c", "upstream_id": "BenchmarkTest14252", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cert_host_mismatch", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9688c6dd839b82ed65f988a91334cd77fd96072413a854ce7772cc3830c1cd00", "structural_hash": "355ec9f795dd276fa10e025f17b9db51dc03ab770f43826435a7860fcc28ef78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03888.c", "upstream_id": "BenchmarkTest03888", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d173591e5d2340694c2a9a2eab853340f8415beed7f01865968191ebf8d36ed2", "structural_hash": "511b7d1501bf64ccbb24c6d90a1d3b774c888d8299d64e1166fb11d8876c99d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23312.go", "upstream_id": "BenchmarkTest23312", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := BenchSvcPassthrough(graphqlVar)\n\tc.Header(\"X-Frame-Options\", \"DENY\")\n\tc.Header(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n\tc.JSON(http.StatusOK, map[string]string{\"status\": \"ok\", \"view\": data})\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a55a397986b31169e19b59a4203d5e8c9debae5a8c79927e126772e4fe5c9a77", "structural_hash": "eab2e9160d83fc681453b85567164b55870288221369b4465de4b85be611e40e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03001.php", "upstream_id": "BenchmarkTest03001", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a0d8ef6cb2e4da0a012ba12e8a463bcb8e3015c7e23152834ca255cb7edfd09", "structural_hash": "346c177cdfe70813e5730d0fb97a311f40f3fdc02848225b5a76659cd584816b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00201.rb", "upstream_id": "BenchmarkTest00201", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n trusted_claim = data.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be129f7eca6b18bebfdcd7e13e1baeb7543cbf76b6904ad3e4ab4a11dc7ac4ec", "structural_hash": "a2ba62139815cc12ce5103cbd0ee343389258431e8548ab6b8c6c317558854fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01012.rb", "upstream_id": "BenchmarkTest01012", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n render html: (\"
    \" + data + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d33d8964e6a88757984ec84945f6145ab5f159f4397cf3e3fb5b20deefc34e2", "structural_hash": "be0bc374044d36237134a8c248b71819f35e08a67238bcd435db28e9b4eca6e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02885.cpp", "upstream_id": "BenchmarkTest02885", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic thread_local std::string cpp_shared_input;\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.path_params.at(\"id\");\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cea28bd6eed256181087da1c8ea76bf3d8bcc6a0a73bfc3265a2fba6dd162851", "structural_hash": "4c04c3decdfabcb1c824b3593bcfe2cf798b12682854209c5d00af69b46f792d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03414.cpp", "upstream_id": "BenchmarkTest03414", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data = !user_input.empty() ? user_input : std::string();\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + safe + \"\\\"}\", \"application/json\");\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ed5306f8220eef445388e58ab1896f673debc0173bf3265264af83fda1f0269", "structural_hash": "65b0c52ec33b15364a61a2b54fb81b4a9cab6d9b2bd9570e3fd1a8f51f478149", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05507.php", "upstream_id": "BenchmarkTest05507", "language": "php", "code": "getContent();\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return new JsonResponse(['validated' => (string) $processed], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2e5e4d353c323c3b6bca60e011f108d967331be0d734a900a35cfc7742b11ef", "structural_hash": "183ba6bdfad6902613b88032164064d87315f446aa01c45330b62545c50bda97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03011.php", "upstream_id": "BenchmarkTest03011", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f41bfa9dfcca7f7e66021738b3675ca7b5ee50dd0d7bf38bef203dbaa2706935", "structural_hash": "e80eb2f8381a07f717c5433f390048066753fd7d0c1efe09b13748ce5606f56b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01864.php", "upstream_id": "BenchmarkTest01864", "language": "php", "code": "header('Authorization', '');\n $data = call_user_func('strval', $userInput);\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $processed, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6325c4f96ba07723bbb136e073c342b9bbdbd0e1e3b419adc139777845374cb", "structural_hash": "45a70ec45e3c7615a9efbfcf4703a9856981b46672cf236e0b03392ff8a887e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02101.ts", "upstream_id": "BenchmarkTest02101", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = Buffer.from(userInput, \"hex\").toString();\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n res.json({ validated: String(data) }); return;\n }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "938504f938b63d32e219dfc2a6a4a382b1d443382a70cedd53e1ffc7b2883769", "structural_hash": "49a1b3320f063b3b1b4f54b08e79335f9ba81cf024c24535fa02cf0e2359b652", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04075.sh", "upstream_id": "BenchmarkTest04075", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n trusted_claim=\"$data\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "966e04702cc31a3429cffa7473bcd59570b64899b42d2d5ee92024ebba534366", "structural_hash": "eeae137d1d83a9ce3c628c981e9069b0d1437651772edf03f36c766142f4d8f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00505.php", "upstream_id": "BenchmarkTest00505", "language": "php", "code": "header('User-Agent', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aafd22aab074ff0441c451f369e3985d209109cdc368e88b3bdddaefc22447de", "structural_hash": "f9617a8e22fd6fc22399409966373b8de7f9601701a458360366fb6b007e54b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02619.ts", "upstream_id": "BenchmarkTest02619", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as libxmljs from \"libxmljs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n libxmljs.parseXml(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2add97c19093e6601d658efea93fe8bd1d27c733680af7fa8d5011c896bd753e", "structural_hash": "3ecf963b3de828506fff66bba74c8b2de99eb35021c24821babd46d8330f93a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01468.java", "upstream_id": "BenchmarkTest01468", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = jsonValue.isEmpty() ? \"default\" : jsonValue;\n jakarta.el.ELProcessor elp = new jakarta.el.ELProcessor();\n Object rendered = elp.eval(data);\n return Response.ok(\"
    \" + rendered + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8adb2c6716f81af683bd97c385fd8d1b98199163452774af4fb23010359aa478", "structural_hash": "fdca8bf6ca2d8cf0808264ca563c84cda4a3e684db774e9819145701a8e29c9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04458.rb", "upstream_id": "BenchmarkTest04458", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n response.set_header(\"X-Custom\", processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b38be6e27bd1c1b2cbcb2e653398f7664bc2febab9dd50b42152246dd16b6ee", "structural_hash": "ddf2cf6f6230d3128eb37460c8d43c4178c4c255a15e059e00e41f6c73df81bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17566.sh", "upstream_id": "BenchmarkTest17566", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9c68a0f52e8707202f233e8394ed868db489af7be48e0528f7b9b2a9e8ddedc", "structural_hash": "c06d637bb3c916c679409b9b8c2c6c2394063e5c068193ceb0402a0e50fd157c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_34482.js", "upstream_id": "BenchmarkTest34482", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n if ((req.headers[\"x-csrf-token\"] || \"\") !== ((req.session && req.session.csrfToken) || \"\")) { res.status(403).json({error: \"csrf mismatch\"}); return; }\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-620"], "category": "unverified_pw_change", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15d0da1776869749d9fa0eca513b8e54c399cd02ae75b2dcb4adde2ad4b64b77", "structural_hash": "b0ad04c82dea4b6b895d9da01e77b959e85fea271d85b53740bf085bc256ee1f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01667.py", "upstream_id": "BenchmarkTest01667", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n ua_value = request.headers.get('user-agent', '')\n data = str(ua_value).replace('\\x00', '')\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12a9426d78065534fbee5d14ad9824ad7a2d33254b237918556d8262bc54d142", "structural_hash": "7274fe10b67c35e4fab151a529fe46b8d8e0c84d0e18148a94bbacc461cd426d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03141.php", "upstream_id": "BenchmarkTest03141", "language": "php", "code": "headers->get('Authorization', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68a7e2bc8ccd2e900152824adcee0f828a96426ec0646dac590e98285b5999bc", "structural_hash": "d809563889c62e082565334784649703c73f3f74230871efb34f359a5ecbdbfc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05498.ts", "upstream_id": "BenchmarkTest05498", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as net from \"net\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const targetUrl = data;\n net.connect(80, targetUrl);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a37d9bb39217664bfc26d239923f5043d979bd600ee013d0a5e2796c3676a120", "structural_hash": "1736e5fe0e54dd16bd13fe6e7a87d7b9572031a11d93f026ca20a72ae56b58cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03332.cpp", "upstream_id": "BenchmarkTest03332", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Forwarded-For\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9ca15046bf08c43e636fa08fac733f78bbf9129d92f1396387986a326d73e6f", "structural_hash": "0cd84adee411fb9977b02282d4174fdb12cf7776c77eb72f38dd3deffaa9f462", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13704.sh", "upstream_id": "BenchmarkTest13704", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n rm -f $processed\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b2a89c0fe8e074ad59652f8fa12aefd9641fcb75b84f35290581538e5771f22", "structural_hash": "0ee5a71ce8bf121fc66cc800b3c3898fbd5699e5f77c73fe837a8ddb8b650238", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04280.ts", "upstream_id": "BenchmarkTest04280", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = auth || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n res.set(\"X-Custom\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fd16353931ffc69484ed445a41e602b1cf814a4a7cbf7e24a3508cbe37bc5ba", "structural_hash": "20342f6d8837e38c9545ad071cb485b84cc7124dbdc71f521f2e248e25424a2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26408.sh", "upstream_id": "BenchmarkTest26408", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=\"${user_input:-default}\"\n printf '%s\\r\\n' \"Access-Control-Allow-Origin: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cd12741eb065fa5bdcbc08b09847c1cf48b351fb5b6f2fbd34be384177568af", "structural_hash": "4b75a0f5fc8fdacc7b2a086693819b616896780f6dd10f3aa92f758f4bdc032f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02279.rs", "upstream_id": "BenchmarkTest02279", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n tokio::fs::write(\"/var/data/encrypted.bin\", crate::shared::encrypt(&db_value)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ce50c210586fcc925bf9cb97c0eeda89891a1eefbd824bd40d11a2bc8956d7a", "structural_hash": "ef2df7690f9a481710a239e913a5b20f011cebc5385cf0288af14c27f85b58c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05078.ts", "upstream_id": "BenchmarkTest05078", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n return { listing: entries };\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f09d83e425635804256f301fc72738c50e2c37fa7320597034cbdb94eb11f93e", "structural_hash": "fdfca7dff6ec9ebd2f58c58c9b86528749287f6a88d650f0f3b13e60baeb98ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09188.js", "upstream_id": "BenchmarkTest09188", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7be031a4eb56974d053389b7a5b58614fa4e2669cf73e7ecb368dc320ed305fa", "structural_hash": "4518fb704c3f409e693e25174e1cb6bdb2892a0d66eb4c7cd9ecbed3dea5d9a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14975.sh", "upstream_id": "BenchmarkTest14975", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n printf -v data \"%s\" \"${user_input}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aae10cf7e47eeb6401413fcbe0f2020ab15fc10fbc279f9e840185fa627f6295", "structural_hash": "6a084d341dab8dd574640a587d328992d2813d6038974449b531ceaad1702dad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03217.cpp", "upstream_id": "BenchmarkTest03217", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n unsigned char _digest[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08abaa28197d600ab382390b6b4a40a1be1389a05b1c8d8a033ae9bea23f4a5e", "structural_hash": "420038958f7d0a47d4296d677d7fb427cb6058b333b9096fa69ef2140ec537d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14115.sh", "upstream_id": "BenchmarkTest14115", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n if [ -z \"$data\" ]; then echo \"error\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f685515a5fb7d4c3a0e9861538c3f12cbc80c693337d41509f248bf8cd7497dd", "structural_hash": "5f3ea258c785e48d4e1169f74c8e81b4258b55c18f8eb656e940a1956c95f63a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15898.go", "upstream_id": "BenchmarkTest15898", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tcapture := func() string { return userID }\n\tdata := capture()\n\tif data == \"admin\" || data == \"true\" || data == \"authenticated\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-290"], "category": "auth_bypass_spoofing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff0deab8cbb130641bef1271b4e97d1045b7c6e4d2d1d2892ac71e9d212f102d", "structural_hash": "a06245a28bb2119816268ca8aa569dd686599763b93e8fe54bac6b2c98b6ed11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01193.php", "upstream_id": "BenchmarkTest01193", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $data = vsprintf('%1$s', [$userInput]);\n $result = DB::table('users')->where('id', $data)->first();\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47c6d8a589f7f0e5eb1851c96d8cb57af76fdd36569a6c84e75cb5389fb730f6", "structural_hash": "ec1bd332234d1e2d861037eee1757a21fbf109c7082b4905aa0ab4268ece0d69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16184.sh", "upstream_id": "BenchmarkTest16184", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6aeb9e41bbae4e3d4d44cf642e359865a0a0bf2cae99ea0d19fd36f6d44dd9f5", "structural_hash": "7bbeb374e3ec705c68e191053161324df41643be4d41120e3ac8555a22985380", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28673.go", "upstream_id": "BenchmarkTest28673", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(rawBody)\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6891111d11bac955cb28dc1578cf9e0eea4e1e9582dfaff09c80a18885f898e3", "structural_hash": "c04c780a9c7d94a7b01c4d2b3e1704fe6f6aafacb621ecd10ace4dbaa9fac67a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15328.go", "upstream_id": "BenchmarkTest15328", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar data string\n\tfor _, token := range strings.Split(rawBody, \",\") {\n\t\tdata = token\n\t}\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\thttp.Error(w, \"invalid option\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"python3\", \"-c\", processed)\n\toutput, _ := cmd.CombinedOutput()\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5771be4ea576e5b84d805b2faeb72d669400a5cbad8dae6fb6f930a31e6bae9a", "structural_hash": "35580037aa0f0181412eebab92306cabb6bd5222659f9e8f6c76e7865bac21be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04294.py", "upstream_id": "BenchmarkTest04294", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport bleach\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\ndef benchmark_case(request, path_param):\n path_value = path_param\n ctx = RequestContext(path_value, source='form')\n data = ctx.payload\n processed = bleach.clean(data)\n return HttpResponse(mark_safe('
    ' + str(processed) + '
    '))", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "845ffa7c4eb210a0991f2e9c874f6c2e69cf93463193c0a8c4d013046d862a39", "structural_hash": "da515e431d2df96ca9f604b1cb3eed4bac7193960bf4f396798385e30029cada", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01513.rs", "upstream_id": "BenchmarkTest01513", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in referer_value.split(',') { data = token.to_string(); }\n let requested: usize = data.parse().unwrap_or(0);\n let _data = vec![0u8; requested.min(4096)];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dde2181ac3ac10e1f339cb734d2d86ef858ff9dcf68faee18e287942c959df62", "structural_hash": "52d78c8299aff38f7a709792189f6d6e1b8ae578530b4d2adc681a92d56269a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05946.ts", "upstream_id": "BenchmarkTest05946", "language": "typescript", "code": "import { Controller, Headers, Post, Redirect, ForbiddenException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Redirect()\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { throw new ForbiddenException({error:\"host not allowed\"}); }\n if (!allowedHosts.includes(parsedHost)) { throw new ForbiddenException({error:\"host not allowed\"}); }\n const targetUrl = data;\n return { url: targetUrl };\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff038faa61d74ed97ab572c13420f6c9499453947609a5015bb8a97d8d0533e7", "structural_hash": "76c26021529e2257c8003da7d00f9a5f6a1aea29b3b7e93b02704634548aef5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03626.py", "upstream_id": "BenchmarkTest03626", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\nrequest_state: dict[str, str] = {}\ndef benchmark_case(request, path_param):\n path_value = path_param\n request_state['last_input'] = path_value\n data = request_state['last_input']\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c26d4a72253c1b37e92a15851d59301bbecc21b959a95db1b35180115ebf206", "structural_hash": "672b0505e43f5a3bc7be05e096428aad5e61ce2fcd0e8644b39f1f2eaef47e79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17581.sh", "upstream_id": "BenchmarkTest17581", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "002c2a47909c89c7ebc4588592755053d89bcbc22096834c72c7c933bdc3290a", "structural_hash": "ae00437d6d7ad96c43f573504a8ce23a03f87994a05cf67a99a993c9e83f9443", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02269.c", "upstream_id": "BenchmarkTest02269", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char *_found = strchr(data, '=');\n printf(\"%c\\n\", *_found);\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c15d4b4d91a4e2f85ebb5f2a3561a13ce295a4fe5f378738460db810bf8d9a75", "structural_hash": "8b0febbf287c216aecdcb1623a503a276157191a718d9e6492fd20dfc1403f6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00636.java", "upstream_id": "BenchmarkTest00636", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n FormData payload = new FormData(headerValue);\n String data = payload.payload();\n jakarta.servlet.http.HttpSession fixedSession = request.getSession();\n fixedSession.setAttribute(\"authenticatedUser\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a027e5618ab22ad24c595ae898cf17fc3771c18008617700a83860b2160f7ee", "structural_hash": "6955f296dff625697276950d522eac6ecb041819938bfc52817fa4975da81335", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04729.rb", "upstream_id": "BenchmarkTest04729", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n system(\"echo \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0f21ed1c4308b5afa40cad955da061df27cff5711f53b8bb1152b69512bb0f1", "structural_hash": "a5a775e2bc7b0c680e17072f950f0927252a9068052432ceb5f6f5665ef04b92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02375.cpp", "upstream_id": "BenchmarkTest02375", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char *_p = new char[user_input.size() + 1];\n std::strcpy(_p, user_input.c_str());\n std::string _out(_p);\n delete[] _p;\n std::cout << _out << std::endl;\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "534d6aa0f709425e048e64b52625bca85458267c2c4a7d1fc281978e092449fc", "structural_hash": "d8d9b0c417b077ddd18d21bf47afaf7ad7f5349ef65d29ad545e41894f97d486", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00590.cpp", "upstream_id": "BenchmarkTest00590", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acf0d706d2a1a21d9e21c0e4a9599abe44b6a8a579449fed31ffa91f4b4638b9", "structural_hash": "ae489f34a8760bc829f5ced04c1a93b001ee706470c40fe76d98bbf2ab2840e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01578.php", "upstream_id": "BenchmarkTest01578", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $trusted = (string) $data;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a1040e5d8cf221fb34dee79b4b313818696551c58d83b85743365f984a191b7", "structural_hash": "c36860914de35013ba83cfb3b8965cfc1b6126a094d8a4ec540af60e42f32150", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15668.c", "upstream_id": "BenchmarkTest15668", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b181662fccaa02e80fda70c02c92ac0df236c37fd0a96358ec7f427c34dbbef", "structural_hash": "72ff53944d4efb6b12db024c461d8455697d0c0ad16b0341925b2e97bad8482d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00782.php", "upstream_id": "BenchmarkTest00782", "language": "php", "code": "header('Origin', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $cred = getenv('APP_CREDENTIAL');\n $_match = hash_equals((string)($cred), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf579604c4023d9b03a51707de8e30621461e4a6799cae02249d63564f892802", "structural_hash": "183b5bb0b69c471bb72d0d417b689deb6e735ac178a9c460cfee5ab5613ccc1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14486.sh", "upstream_id": "BenchmarkTest14486", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n case $data in\n a) echo alpha;;\n b) echo beta;;\n *) echo unknown;;\n esac\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86dd2c077fc3e9c32699038a9a26ff7dd2faff5cdf1439f3102cdf8a77ebdef1", "structural_hash": "12ae12bf1a55270a7de60a0bd5ce5d1ec143116a0592547d7474c3fadc71cc5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09848.c", "upstream_id": "BenchmarkTest09848", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n xmlDocPtr _doc = xmlReadMemory(user_input, (int)strlen(user_input), \"noname.xml\", NULL, XML_PARSE_NONET);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 0, "cwe": ["CWE-776"], "category": "xml_entity_expansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4b40580d6e73596112a7e1cd48712de3f782306bc2457f78c50e55b0f2c2189", "structural_hash": "05d28d6691963a6ab3671818ea73dfe267a30efeab6234cbccf48b09ca790673", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05471.c", "upstream_id": "BenchmarkTest05471", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11e07729d4bce36694ef4e215a6bf0aa649ca25606ea2a74de9322ceec3c8c89", "structural_hash": "89d9c4a4b96876920a404f3ef696c228940120e933020e2a52d1bf856cb68070", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02398.rb", "upstream_id": "BenchmarkTest02398", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = sprintf(\"%s\", user_input)\n role = data.to_s\n if role == \"admin\"\n halt 200, JSON.generate({ role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ee0947d37d675e3d41950cea0e9bc94501a1bbf105e7f5365454f642e246fa8", "structural_hash": "44fdf4e5e8be9dcfe7b9476738e86a0de436430ed035a23eeb2a11626c0c2b51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02290.php", "upstream_id": "BenchmarkTest02290", "language": "php", "code": "json('variables.input', '');\n $data = trim((string)$userInput);\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($processed); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return response($_elOut)->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d977e5bb8f3764e8603b83945b5ae25eb142d2120849ef157da3989eff8aee3", "structural_hash": "99e295f52ad0ed13735023a27868382f2b0d5e0518c8987017ea840002017abb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03182.ts", "upstream_id": "BenchmarkTest03182", "language": "typescript", "code": "import { Controller, Headers, Post, ForbiddenException } from \"@nestjs/common\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"metadata endpoint blocked\"}); }\n const _isMeta = _host.startsWith(\"169.254.\") || /^\\d+$/.test(_host) || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host === \"localhost\" || _host.startsWith(\"127.\");\n if (_isMeta) { throw new ForbiddenException({error:\"metadata endpoint blocked\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5b8bb8485062066b4b21fb077a41c62a364728b091b5ef50386669b278b85e3", "structural_hash": "de7862b73be99383a8883c27454395d8c4a23bb6a46574ae4eda4e950ee218d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00208.go", "upstream_id": "BenchmarkTest00208", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tform := FormData{Payload: authHeader}\n\tdata := form.Payload\n\tlog.Printf(\"User action: %s\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83ba6eb7d0782c6e93e1c5052feeaa88109f3df1a57afdcc21d1cace64d30806", "structural_hash": "36b98cb51f101df4b7d6fa9f4940a821e9570ff1fcef6ecd10922ba1f2b0da27", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03529.rb", "upstream_id": "BenchmarkTest03529", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = user_input.split.join(\" \")\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "baa202d13fd8da2ea441f6b4bde58eec50aaf951721bb581439a5a817a90faef", "structural_hash": "85337c09d6b4ec4d3170d57259ae8bf363e18916cbd290de743e754e418ccac2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04108.rs", "upstream_id": "BenchmarkTest04108", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match origin_value.chars().next() { Some(_) => origin_value.clone(), None => \"default\".to_string() };\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8e9349304895fdae0b9737f24b22611dd1be29f41090cc10b3df907d0f6e984", "structural_hash": "70a299b3c66f77fa419494bb780ae0585a610abd975052db512b64becefa3759", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31058.sh", "upstream_id": "BenchmarkTest31058", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n if [ -z \"$user_input\" ]; then echo \"error\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2839398363cb76481a2d0ec5a22315ac6a32b1e31bbdf4b5532087c1710ce660", "structural_hash": "f68b9b363f761397717c476d3209b35c74fdc563938d63195de4508c6db51d48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03867.rb", "upstream_id": "BenchmarkTest03867", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = \"#{user_input}\"\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n halt 400, JSON.generate({ error: \"invalid type\" })\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d7a1d186bc1198001b6da02b1b91b4cc0c74af3f67a6cef8dc7b9a6a481d91b", "structural_hash": "f079074964d62e740ad6fc04008f828933b5436ed0803005e2a71951df054d8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03955.php", "upstream_id": "BenchmarkTest03955", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b93f74a9393b8e1367f9aa9c80f547b4122eec39606cab6d4eedc66320006362", "structural_hash": "679e676d7745c0c0c65dfd61f4a1868e2ba9372a3c05328f44689edb8f5e9070", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06078.ts", "upstream_id": "BenchmarkTest06078", "language": "typescript", "code": "import { Body, Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string, @Req() req: Request): Promise {\n const userInput = field || \"\";\n const data = `${userInput}`;\n db.execute(\"UPDATE users SET name = ?\", [data]);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8100fe7d9560134dc136299d6ba6a75285d5d6348b81962cd4d8f046ce1230b7", "structural_hash": "b84f1703e76848283a5890caf9d4686ce7c4b6d83ad000904e7957f8584b43dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_34052.go", "upstream_id": "BenchmarkTest34052", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tholder := InputCarrier{UserInput: multipartValue}\n\tdata := holder.UserInput\n\tf, _ := os.CreateTemp(\"\", \"app-\")\n\tif f != nil {\n\t\tdefer os.Remove(f.Name())\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4790d67d6381a9b639e76d81e97d7f0196e14b5e1ec63f1d2ac8f9c9cf42594c", "structural_hash": "59b4d901142983f5ba18091d225eccc579a1d6c7e466f97624ef2b95ff75906a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05153.ts", "upstream_id": "BenchmarkTest05153", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as ldapjs from \"ldapjs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { throw new BadRequestException({error: 'forbidden'}); }\n const processed: string = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3164d64dcc002484ee68a937b9d27476ead4fba3dbf9e57dbeeb67153ec76ac9", "structural_hash": "3d32c92692bebbcf0f2a653b5377aadf5d18d675b3fd0f3b827851112842ccad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18520.c", "upstream_id": "BenchmarkTest18520", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char *_found = strchr(data, '=');\n printf(\"%c\\n\", *_found);\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "355a7d42b24b1c8f40b761547168e1e1107cfe8dfb36e41ac1f237bf8d95605a", "structural_hash": "90284408c40026d97736074ac6ad566bc52dbbcd299bf985a2629a1f11e0684f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest06023.java", "upstream_id": "BenchmarkTest06023", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = normalize(multipartValue);\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "745deb3abcdc9cd78a1fa173f4158a52f7f523c5ea9793bea82b340eb6116b1c", "structural_hash": "e11248c10caf2929ab144114010816a34f97f578ba624055ba75a7b1ffd8e8e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01055.java", "upstream_id": "BenchmarkTest01055", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(userId.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n try (com.mongodb.client.MongoClient mongoClient = com.mongodb.client.MongoClients.create(\"mongodb://localhost:27017\")) {\n com.mongodb.client.MongoCollection mongoUsers = mongoClient.getDatabase(\"benchmark\").getCollection(\"users\");\n org.bson.Document nosqlFilter = org.bson.Document.parse(\"{\\\"username\\\": \\\"\" + data + \"\\\"}\");\n org.bson.Document nosqlResult = mongoUsers.find(nosqlFilter).first();\n response.getWriter().print(nosqlResult != null ? nosqlResult.toJson() : \"{}\");\n }\n }\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d515b75ef867f037461b9f57dba6532f9f34ef6b24c8006f4990a85dcab99e42", "structural_hash": "2ab1b114b2d1157adf5fb2e3394b23136acf56c50643ca36730ae4a0d0191060", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04556.java", "upstream_id": "BenchmarkTest04556", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String expandTabs(String v) { return v.replace(\"\\t\", \" \"); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = expandTabs(authHeader);\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { response.sendError(403); return; }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n response.sendRedirect(targetUrl);\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "936eb279dff37708edaddb7978ce377bd549b654f2724cb6dd2945b36c274906", "structural_hash": "a1ce1c9345fd56a41cb0ff2317cc4510677d745e921bbc63e2be3032e5776b41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02915.php", "upstream_id": "BenchmarkTest02915", "language": "php", "code": "name;\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d645916f8e2693b0c36743623d99e5f30d0aa893476d3fd49263264fde02fc54", "structural_hash": "c94384e4b7c0bc07786f61241d8893b066af94abda09b9fb2b84f248b7724ec6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04330.ts", "upstream_id": "BenchmarkTest04330", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "255e85e8ead5c6fc44586d84b7244c6f566f07eb6d6abd34fbecff10349ed622", "structural_hash": "c5acca6ba17cf0fbd36c1d81cd4fe2f8756d76dfb0fa34a3afa3b97584cc37eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01147.ts", "upstream_id": "BenchmarkTest01147", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const fields = [userInput, 'http'];\n const [data] = fields;\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83a4d2202be75f32c193834dadd6256c6b8af95044afb5ff14e3d8aa5746f248", "structural_hash": "38979a62d22263f1f380d4fac200dfcd11c2373d9db489f0cbfa59356355ffb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06480.c", "upstream_id": "BenchmarkTest06480", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n if (_idx >= 0 && _idx < 5) printf(\"%d\\n\", _arr[_idx]);\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a8808d68d84f4ece8f8781b3b99e7130ed1182fb3c9a58429e3dbd665b9fa5d", "structural_hash": "a303dc5d05374e811ccd9fbd929444c82b4079377b430de539c23bb74289bc1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_39456.go", "upstream_id": "BenchmarkTest39456", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"regexp\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(jsonValue) {\n\t\tdata = normalizer(jsonValue)\n\t}\n\tinputPattern := regexp.MustCompile(\"[a-zA-Z0-9_-]+\")\n\tif inputPattern.MatchString(data) {\n\t\tw.Header().Set(\"X-Validated\", data)\n\t}\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "938156efc0260d083fc0cb29317c99be7d7e3071a44d7afd0e6c55d163c0412a", "structural_hash": "7d7309d7c4d7fbc21f1fb7af244527b23338e025920950121244f0c0d096760c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04199.go", "upstream_id": "BenchmarkTest04199", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tvar data string\n\tif len(forwardedIP) > 0 {\n\t\tdata = forwardedIP\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ede014de3c7f9b87dbd0f80202c7f66ba83585355bfc4335d00eaf5e94bcc8f4", "structural_hash": "017ed872c396907265e08e84f786808a14ef0b602bc46967e3620aef2260391b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01282.java", "upstream_id": "BenchmarkTest01282", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n String data = java.net.URLDecoder.decode(pathValue, java.nio.charset.StandardCharsets.UTF_8);\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.KeyGenerator kg = javax.crypto.KeyGenerator.getInstance(\"AES\");\n kg.init(256);\n javax.crypto.SecretKey key = kg.generateKey();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc3e965499ff04ec72f7758e221cee9ab92ee737d13fffc5e068f32ecf55140c", "structural_hash": "588da9008f07027f76ad55a1b620ff35bff296005ca6f29e2318f90e0acbd3cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01469.java", "upstream_id": "BenchmarkTest01469", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String prefix = xmlValue.length() > 0 ? xmlValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = xmlValue.toLowerCase(); break;\n case \"f\": data = xmlValue.toUpperCase(); break;\n default: data = xmlValue.strip(); break;\n }\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df8d49083bb6ec5630e151b9f4758d783883c9845e89a8d3b5cb75ff27b230d6", "structural_hash": "2b284bf6cf6d6533cd041d7ef0106c2a29dbcfafe7cd7c73f13d4d6ee388e213", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36144.go", "upstream_id": "BenchmarkTest36144", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- authHeader\n\tclose(_jobs)\n\tdata := <-_out\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tc.JSON(http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-331"], "category": "insufficient_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea3376946035fffdaf689eafcce3321bb6a11275555da641e207da5d7c8eb47a", "structural_hash": "044dc79b9208ccd3765550754b42c5ceeebed72851f05a931bb1d2be5b0ef849", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03309.ts", "upstream_id": "BenchmarkTest03309", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = `${userInput}`;\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5e4c9beb1d0fce8a3feb39f58b24496ded2f036a3e5f8266f281c66e3ba1297", "structural_hash": "2074d325affade94f899c03e840556c0e5a45b47f73b1bda7ad1154120d2ca63", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05636.ts", "upstream_id": "BenchmarkTest05636", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b7a7f5b416d3843efaa867137287809d6dd410b29734129a970d0ddb2719270", "structural_hash": "ca1f10773b2d54b377387c328169d2a82a84c29bd1976c8fd31e1866d14128ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05125.rs", "upstream_id": "BenchmarkTest05125", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(graphql_var.clone());\n let result: Option = std::env::var(data.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d699a8ab4265291010bce180da4be7ba2e7c6d75b51514a78af75bb34880fbf", "structural_hash": "0fdb81550060e8f73904d350161580b58d8ef8145c266dda1b775e12613f233c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01064.rs", "upstream_id": "BenchmarkTest01064", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = raw_body.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6d55c7a712a34e3c8ea1b9e2ecdd3f986841f072267b441d68ed9a2aad91e5b", "structural_hash": "6d32c9c19f9a98cbe6290c558d5721c1760561483c86dbec794b7f5a6a47bf00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01986.rs", "upstream_id": "BenchmarkTest01986", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: path_value.clone() }.payload;\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "522c7bdfe3927a97516dc585f1b95bc4db49f515fd3711587d0d1583a2f900c3", "structural_hash": "9406ffb6ad8835f7188be9303bec4bf77d46a3419786cbe624d3c0a10d406e3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05122.rs", "upstream_id": "BenchmarkTest05122", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = forwarded_ip.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n let requested: u32 = processed.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c930eb9bb735960b9385dfa37d0a1cee8f9a5eb01c5f5ea413a9cbc6d539c7e", "structural_hash": "fda5945b4d1c65a52e1a17cca3fc94f6d2078f30849df44eb546df37f63daed4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33886.js", "upstream_id": "BenchmarkTest33886", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nconst zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.send(nunjucks.renderString(processed, {}));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8293321e8706df389cbe2465da6fa5f764287749b697efeee1341399c5b720e5", "structural_hash": "842f66fd945421bd80378f62e321b97be431fc5f8d242fc4611a99be5d97406c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00287.rs", "upstream_id": "BenchmarkTest00287", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let (payload, _origin) = (path_value.clone(), \"http\");\n let data = payload;\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44825bcd42bc1a5cc022a776ceb87e32ee275a6817bacbda6020ba178db076f6", "structural_hash": "ad35f32684fc570c05294e1800d591d391b4db5797f0bb6d25c0798fbac022a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00238.py", "upstream_id": "BenchmarkTest00238", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom lxml import etree\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = ' '.join(str(json_value).split(' '))\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aab7df03006ffe98d67842b683b34bb15f0aba8e6df0ef3242657068a4c45fd3", "structural_hash": "51ed7b2ca5ab4770125f3cb12520d9bb6d19d6fa2b532bbf68f8e6679823dea8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02609.java", "upstream_id": "BenchmarkTest02609", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(headerValue)); }\n catch (NumberFormatException e) { data = headerValue; }\n if (!(\"true\".equals(data) || \"false\".equals(data))) { return Response.status(400).build(); }\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74734f071586ea377a5f3761dd7a0443d8f14a9ff890bc3e4f894d7f931c6fae", "structural_hash": "dcd412e570e50a0ca4e8b8054b3c1b24b142d0921e50100aac8ccfaa2b8e2e5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13263.sh", "upstream_id": "BenchmarkTest13263", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b928ab3c3716901378d48f5b48c45b9290383ea585966fa9bc9f6f8736ddc25", "structural_hash": "a9b18d0b4ae5e6b65ed0eb58102dac88228710151a04cfd2df4dbf8e013bac92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00790.cpp", "upstream_id": "BenchmarkTest00790", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61c495f387b4d76f19e0c60fd7b2a68b986280a3b962df0df3f6e8d68ceed46a", "structural_hash": "d0452ce422a00b7307c5af9e52cdb6848a0ff98b4acdab2c62ff43c6b9b86dc7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16869.c", "upstream_id": "BenchmarkTest16869", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_PADDING);\n RSA_free(_rsa);\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4ed3c1a166e437b127ee7173584ec314d897dc2dc63ea80b58c00fda1d5f7e5", "structural_hash": "3873c8c1666de6332c2d8c6409a2e0f92e467c388fe51c91ea82969f7880d239", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04219.php", "upstream_id": "BenchmarkTest04219", "language": "php", "code": "getContent();\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return response()->json(['validated' => (string) $data], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d7a094f62ec749306c19c26b3103243040bf2f63df4c1e58e82e1b6df88fef8", "structural_hash": "41f9c66cdf352889f574338e2af5fddb27544b23cad70ef89314188def616170", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21432.c", "upstream_id": "BenchmarkTest21432", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char *const _argv[] = { \"/bin/echo\", (char *)data, NULL };\n execv(\"/bin/echo\", _argv);\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7291c92fd70bee840b12e38d5cb2d35441bbbde1b929d2f20dbc53c6af8021ab", "structural_hash": "04865098300bd4148a11165190337d990bc3dc77f655abc7e2142d2e9f74304a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01167.c", "upstream_id": "BenchmarkTest01167", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", safe);\n remove(_path);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d034fc0990a951a89be4360df26e9eae8fa2e92fcae61182617e8d6d8dfecde", "structural_hash": "66c3bc03acdc72a5c8e841df1718b282f2bd3696b44979353c934ee7a5c43251", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05137.rs", "upstream_id": "BenchmarkTest05137", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap, mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(multipart_value.clone(), |s| s.trim().to_string());\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78ecebe7ca28c0f985e08e66e54b202921f18834c01bbf51d441bc868706e281", "structural_hash": "75849c97e3a91fae4dc0028d130fd9f3bbf5499bf43f2758ffba721d5a9a9e0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05179.ts", "upstream_id": "BenchmarkTest05179", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n res.set(\"Access-Control-Allow-Origin\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79a640af4dab54a788d25fe84f265066951515c8e90fba728ce942df64b1300b", "structural_hash": "143ca31bb64c044c30da56b2813b99c40a40ea637fb321b36debe2982daca657", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02660.php", "upstream_id": "BenchmarkTest02660", "language": "php", "code": "header('User-Agent', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n session()->regenerate();\n session(['data' => (string) $data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f19442a53a74df418a4499aefc4e070047fe2da5b2f1b902c6b27abee4d1d40", "structural_hash": "79e5bfbbe87c44fdca22bd2bdd20c47dc42a53e71801eda60ca4c1c6d635b74b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01615.rs", "upstream_id": "BenchmarkTest01615", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n for token in graphql_var.split(',') { data = token.to_string(); }\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b5dff5297ad10a9911f6bf4e7f1bae4676f798898574095773e2902924671f5", "structural_hash": "d1a70668a1d8800216c2914363984c1d88a2e6bd8742be67395132c46589fd21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04891.ts", "upstream_id": "BenchmarkTest04891", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bab898999668c6df1a13a3191169a2884704c7c528fade1bf53d2dbe69ed02df", "structural_hash": "b9b442ff56a60dbd7ef291afcedb761bd949a2991bd7c4b6ab36d78a5245bd1a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04878.rs", "upstream_id": "BenchmarkTest04878", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let tokens: Vec<&str> = raw_body.split(\",\").collect();\n let data = tokens.join(\",\");\n #[cfg(unix)] { unsafe { libc::setuid(data.parse::().unwrap_or(0)); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "106c2dabb2b3fa9dd73829bfe77c6b997ebd3282dc51ff2be0b6def42ddc1619", "structural_hash": "00a0278235a4cd75a32f6ab051bcc2df83fa3fab7622d460e59b5955552a1768", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01078.sh", "upstream_id": "BenchmarkTest01078", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ee5ce32fc306d5318fd9455a039e1bb6845aa3508efb2007b1283057aa1b3dc", "structural_hash": "cf4d58a657d57ca7e58cb5d39488847ca814714c1da990ccc16e57d707cbfa51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01466.rs", "upstream_id": "BenchmarkTest01466", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", xml_value).ok();\n if ![\".jpg\", \".png\", \".gif\", \".pdf\"].iter().any(|ext| data.to_lowercase().ends_with(ext)) { return HttpResponse::BadRequest().finish(); }\n let entry_file = data.clone();\n tokio::fs::write(format!(\"/var/uploads/{}\", entry_file), b\"data\").await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba0d277de54e58cf5dc5ae057fcd6b5e56cfa563174e955f842bfeb5725aa8ef", "structural_hash": "61c9d2024e22f28e2d267974614bc50b94dbb0eea5fe15cc8d218da2996952a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00767.ts", "upstream_id": "BenchmarkTest00767", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const targetUrl = data;\n http.get(targetUrl);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f45b2cc9d820306a5a77368cdabd88955d29fe869472b1b5d4f62f1e735854b1", "structural_hash": "48b08661e4b5466e7218127ad234b3990edcd984235d545daadfe590c7c9b74d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10106.sh", "upstream_id": "BenchmarkTest10106", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n _tmp=$(mktemp /tmp/app.XXXXXX)\n chmod 777 \"$_tmp\"\n echo \"$data\" > \"$_tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec27695f0ecc1a73b4946caac5c3b7e4071ae7b2a2210498c62ec0243a635e17", "structural_hash": "197cee212487da7c9e678bf752aacfade898eb300b2fe16ca1fdc30b4b013aba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00608.rs", "upstream_id": "BenchmarkTest00608", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = forwarded_ip.split_whitespace().collect::>().join(\" \");\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f2ef9450f1b693b8fded5386f69d1ef3553f492a9cab00abfadc9f862a31b6b", "structural_hash": "5ceba65c7622d7a9e5dc9328f5ad15caeede74599911c9fecfc49c119ce25660", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01767.go", "upstream_id": "BenchmarkTest01767", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": originValue})\n}", "label": 1, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bea7ded3e2e496be8ebf4e1fce65a48ac7d82c87ca0cf83104dd334fbb3093f9", "structural_hash": "69dc6a612f007bf66129c73d2408f9a9b2d5c30a690812ef0d4253bf96908b2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05468.rs", "upstream_id": "BenchmarkTest05468", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let _prefix: String = cookie_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => cookie_value.to_lowercase(),\n \"f\" => cookie_value.to_uppercase(),\n _ => cookie_value.trim().to_string(),\n };\n if ![\".jpg\", \".png\", \".gif\", \".pdf\"].iter().any(|ext| data.to_lowercase().ends_with(ext)) { return HttpResponse::BadRequest().finish(); }\n let entry_file = data.clone();\n tokio::fs::write(format!(\"/var/uploads/{}\", entry_file), b\"data\").await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f850e22e2309280f44efbe88a581706c65154095925af9f989c0c5f665dc00e", "structural_hash": "a491e1deb3eb26e5ced5579a53e4dcde21e51191639a69d18fafcbbd50b4e0a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01879.go", "upstream_id": "BenchmarkTest01879", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tvar data string\n\tif len(uaValue) > 0 {\n\t\tdata = uaValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f199f9968677f9174de8c990346c84748647b5cc11d9e55ee4fc6dd3799f009d", "structural_hash": "6ed64f5b7020e9ca36bb3f5a8dc5dea64e82f5bf39f8acd3aa102ef332efaac8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02898.rs", "upstream_id": "BenchmarkTest02898", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = referer_value.split_whitespace().collect::>().join(\" \");\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acb6c03ed0c930f89a85052cdffc24c5155601b115a78dc58ba406a2ab33dda5", "structural_hash": "20748c0c69abc21ae5962a07c2dafe42edc3be93906ca42ced3e340273b6266d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00929.js", "upstream_id": "BenchmarkTest00929", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const data = String(userInput).slice(0, 200);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-311"], "category": "missing_encryption", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b9c5e2d4eb7f253250abb07470cc0a2b9cbc534957b66526d57052bef62e473", "structural_hash": "fbef0bc6aac233eef82d20320bf1fea1bd0bec118f1b1d518aed14c7ff66f9b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10622.sh", "upstream_id": "BenchmarkTest10622", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49afee810f818f4fd9e4a49f6663df462438086b0c551bee97e7b2167c688659", "structural_hash": "4fa33be50d5001a7795e17cd5a46336529da7a6ed316dffc85807ea9de3b9283", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19795.js", "upstream_id": "BenchmarkTest19795", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = \"default_setting_value\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-547"], "category": "hardcoded_security_constant", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:default_password_use", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f569d9c654170402357134b0b93b941301e4c4e9f29385afc39ba2c452339fc4", "structural_hash": "a7995e0fd01529e3c53db831721ddcd63d68b26025d1b05cf1d5a616717dcf9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_23832.js", "upstream_id": "BenchmarkTest23832", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e29c57caebf6c6bdecfffe4c48e424b056021fa1ff3f0ca537827c58c7b1b43", "structural_hash": "4cc562f16ed7014a80ac5321028c72cd0a5b9b210b0f14a42f700fbff82e7d4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05839.java", "upstream_id": "BenchmarkTest05839", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n FormData payload = new FormData(rawData);\n String data = payload.payload();\n String socketRaw = String.valueOf(data);\n String socketHost = socketRaw.contains(\"://\") ? java.net.URI.create(socketRaw).getHost() : socketRaw;\n new Socket(socketHost, 80).close();\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee3329967f8e152e3764f4e92e072cd29b1cc57af2007d252dd46ee110cdd26e", "structural_hash": "ff90ec425b75bc02b03cd1718490abe0a59f408809a5b8986fcadde6f196d902", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01561.py", "upstream_id": "BenchmarkTest01561", "language": "python", "code": "from flask import Flask, request, jsonify\nimport re\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n kind = 'json' if str(host_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(host_value).strip()\n case _:\n data = str(host_value)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n if re.search('[a-zA-Z0-9_-]+', str(processed)):\n return jsonify({'validated': str(processed)}), 200\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c2a0bc81ccf535c6738e63594e5ea7c87c98cd6f78d89a60182748247f9dd1a", "structural_hash": "d5ee31afc014b8d8b2a3459a774de1e68e768b86da02bfd8a5e4e7a347a3bc4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00501.cpp", "upstream_id": "BenchmarkTest00501", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n const char *_sess = std::getenv(\"SESSION_SECRET\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f65e45286c4a0140555835afbe3ecd4cc0e4df4ff4f74c2c73afd379545382a", "structural_hash": "9662ee3cbb2b147b2be0675b283f3bad4425bd37abbb035ed088988af98d8967", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_25451.go", "upstream_id": "BenchmarkTest25451", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tpending := strings.Split(jsonValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tcipherOut, _ := rsa.EncryptPKCS1v15(rand.Reader, &rsaKeyPair.PublicKey, []byte(data))\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"rsa-pkcs1\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b1804332b72b5387f30de51ff7299d4585f9d3dbf9970dff380668dda3101a3", "structural_hash": "536244d18db67742d098b81794dafda063847ba365019b4525abcbdd4bdaf54d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05658.php", "upstream_id": "BenchmarkTest05658", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $data = (!empty($userInput)) ? $userInput : '';\n $processed = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n return new Response('
    ' . $processed . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc2f517c6665eaa7c7d00f0303a4b69f2e1cc0999c6bda7f90cd073d48b54af3", "structural_hash": "f76018fbc7014644f9c64e9f315701a5e8720143dbf5908e560acf2bba4604bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10194.js", "upstream_id": "BenchmarkTest10194", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n JSON.parse(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd00c5bb11a9447f2330522111b7e8fdfb3d0d324ca8dad484c507dd541dad95", "structural_hash": "55dd7df673fb27ed31f0196d65d3c6c9fcbe734b0ddddb66fcd1184190a16c45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05966.py", "upstream_id": "BenchmarkTest05966", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n if len(str(raw_body)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7492584e52a210c26fe64532255883f2569a6201ee312aada7e4ca6425f4351a", "structural_hash": "0d8dd06f554a944bb4a1046f27259e0117c830dfdc4736edfd5ab18894c02ff3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01286.java", "upstream_id": "BenchmarkTest01286", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.List tokens = java.util.Arrays.asList(multipartValue.split(\",\"));\n String data = String.join(\",\", tokens);\n response.getWriter().print(String.valueOf(data));\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94e5ae956f90745716943b8ddd75a91e574cc2897c7df1bba0c0c33dcf7311ab", "structural_hash": "8116048b546698819b16e8bb0562f02094ff97d6d97630de0440f2d82e1f8e97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17958.go", "upstream_id": "BenchmarkTest17958", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar data string\n\tif jsonValue != \"\" {\n\t\tdata = jsonValue\n\t}\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\tpanic(\"generic error\")\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5d8527c37e8f39d27be47674d7b7af518fb9708d2f287a08ca35a8ec4b0a094", "structural_hash": "77eba8f4b6f103ae0978094817031bd47ab0a7d006f20ef2bdf750c021e0f13b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04045.php", "upstream_id": "BenchmarkTest04045", "language": "php", "code": "json('variables.input', '');\n return response()->json(['ok' => 1])->cookie('session', (string)$userInput, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f35ec379d9c85449fbb241c75e5d9cfdba6354d5c7793454e214c72001cc4051", "structural_hash": "a2c8cbd99068c42015f038351f1bcda55c76ac20c9a0703a51481f9df46fb9aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30954.sh", "upstream_id": "BenchmarkTest30954", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n curl -s http://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c4ea59dced7aaa270b74531e88fc428657426ef780eb3a923fb1fcda43072ee", "structural_hash": "86436f82af0b63421212e62f0e60b635d39401c03c91b76e8dd7b534546f552c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03690.php", "upstream_id": "BenchmarkTest03690", "language": "php", "code": "header('X-Custom-Header', '');\n $field = 'data';\n $$field = $userInput;\n $token = bin2hex(random_bytes(32));\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56f023a6f2885c61893320bbe4cd946e1b14d59cb7cb3ccb6f86d3037ea312c4", "structural_hash": "7c73d4fb4789e8b88e0549105a723585ca1790e93845f1b7e3b8066032b6bef8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04493.rb", "upstream_id": "BenchmarkTest04493", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n payload, _origin = user_input, 'http'\n data = payload\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (ERB.new(processed.to_s).result).html_safe\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d04d3a3dca33f5150639a8aff15bf1f23cea7cace8a594881f50ac698144072", "structural_hash": "2eb93d37716b5f12ad5cb9032f1f7c1ba19a3776eac553820af8c6187ff49521", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01057.go", "upstream_id": "BenchmarkTest01057", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(commentText)\n\t}()\n\tdata := <-resultCh\n\tc.Header(\"X-Frame-Options\", \"DENY\")\n\tc.Header(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n\tc.JSON(http.StatusOK, map[string]string{\"status\": \"ok\", \"view\": data})\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "957de1b8e2a6f7b65eb0e567d8ab8d507bc70ee57ac1e188e76ed0df0beb38c9", "structural_hash": "6106967b808d750eed75b57ffde1f582a341bf8998beecbf83923814c2f30ccb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03225.py", "upstream_id": "BenchmarkTest03225", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom starlette.responses import JSONResponse\nimport os\nimport ast\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n auth_header = request.headers.get('authorization', '')\n try:\n data = str(ast.literal_eval(auth_header))\n except (ValueError, SyntaxError):\n data = auth_header\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c39fb034337ea215d9762c7615ac55e125884e046b151b7b50f5012e5435873", "structural_hash": "bffc27e136a073d2fa4239421ee1b36e2ecf738ea2d07c4c7b1f1baa12d9cb4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08936.c", "upstream_id": "BenchmarkTest08936", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", data); fclose(_log); }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "488f8574cf15984c71042a8999e91a1841b3629c5df76419bc0fac89ee07972d", "structural_hash": "4b673e5981fad806871889bbd90ce6de79bb53da1417f2db5148b1613803151a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02309.cpp", "upstream_id": "BenchmarkTest02309", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01ecf4f2b6d64fffbdf28c862455e1b366a94c1674bd98930ca049b142750ef7", "structural_hash": "f5c6bef27965557b97a32b698a9f9abf1b5e9fdd2e21f2e5fe5560ba637c822c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02359.php", "upstream_id": "BenchmarkTest02359", "language": "php", "code": "getContent();\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return new JsonResponse(['validated' => (string) $processed], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98f1f00bc90f80137e34385c8d9453c3c2c9315c04cf7ab66cb860698f6e2bf8", "structural_hash": "3958fc87d41400c0691b5e40342e9992ec711d3a2b47da8d069fa1185b90e396", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03046.php", "upstream_id": "BenchmarkTest03046", "language": "php", "code": "cookies->get('session_token', '');\n $result = $conn->fetchAssociative('SELECT name FROM users WHERE id = ?', [$userInput]);\n $value = $result['name'];\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f6315eba5b79cb9665793d60dc95c4b62fbc276b0195618e07ccedf9e8b3ad1", "structural_hash": "21b2fe9aca8e767b23be54311bb9109a691ae716775ac002b95242a4073555e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13512.js", "upstream_id": "BenchmarkTest13512", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n res.set(\"Content-Type\", \"text/html\");\n res.send(\"
  • \" + String(data) + \"
  • \"); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e27ce044690e3ff7936c96dab19bd5fdbbc83f8ce185eeb9bd62797d7ea2d24", "structural_hash": "f33eb3d5897a36b86845e122a45fdca835fcee145061828248ffdcdda078baf6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04984.py", "upstream_id": "BenchmarkTest04984", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n with open('/var/app/data/' + str(env_value), 'w') as fh:\n fh.write('data')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5a784c79ba4c8617e09d9969774edfe85453d48df48100d8d802f2a7dbfa3fc", "structural_hash": "7ac4b57f3a3cf366ca199e592da4725b239126e40579a5a816b94149320fb6f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00699.ts", "upstream_id": "BenchmarkTest00699", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n res.json({ listing: entries }); return;\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c5f143a12acce7e7db9678bc70a417d2c65449402cd900b6d169d1e69c5fc00e", "structural_hash": "34273656e3e3d5ff0292192df027f7dc3dfbd0bf5e7ed1eff4bc19518ff2176b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02691.py", "upstream_id": "BenchmarkTest02691", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request, path_param):\n path_value = path_param\n def normalize(value):\n return value.strip()\n data = normalize(path_value)\n exec(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4789a292c9cebcce2ee201bff8826bcd5bef2d13e172b8822474c59f7124b323", "structural_hash": "3bea1895423723e9f3972cb5ab75f3796e3813659247255ae3430a7123a47dcb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06074.ts", "upstream_id": "BenchmarkTest06074", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98d7435698f5716c497ed87fc08f04b405ce5c86fc5bb4978ceb6b319ceafd8c", "structural_hash": "e5424dd2dd25297a6220d02a87dbe40e6c6ed8bc026f56fa81cc1d9be149fd70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01235.cpp", "upstream_id": "BenchmarkTest01235", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ecbbcae75afad528d8574e89c8b3d2a17bfe58d8c26f88904766d83f70753aaa", "structural_hash": "f692c2f626db58399e1a50e4fde8339478a6628b039b6ddd524ca274b760a32e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05902.sh", "upstream_id": "BenchmarkTest05902", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n data=\"${user_input//$'\\x00'/}\"\n printf \"%s\" \"$data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "038348fcad94907db540e03d2d71533130d9992c5653af49a176c25a908ce1f7", "structural_hash": "3ac628667284086c065b2875beeeae0b1f81824de9f8eda376d122d48eddfda4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03913.php", "upstream_id": "BenchmarkTest03913", "language": "php", "code": "input('multipart_field', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $stored = '0e462097431906509019562988736854';\n if (md5((string)$data) == $stored) { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-843"], "category": "typejuggling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e84e972e54b8630d8876bca45539c8724574a837cc56d475b4c56288a3d99945", "structural_hash": "d1c93820830f5ef7ec0bf3db7d5f7722c262348fe5a656061e3dbf7590c9903a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01133.php", "upstream_id": "BenchmarkTest01133", "language": "php", "code": "header('Authorization', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c36be8ce89cf52dd4f752f2fe32478c625478c37dc867706883bc9e96c32f72c", "structural_hash": "c67a180aa3228d10c34a328975e8f9756bdc2ca0b8b0fdd3e69d8a4c9694ee88", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_35898.go", "upstream_id": "BenchmarkTest35898", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar profileBio string\n\tDB.QueryRow(\"SELECT bio FROM profiles LIMIT 1\").Scan(&profileBio)\n\tlastRequestValue.Store(profileBio)\n\tdata, _ := lastRequestValue.Load().(string)\n\tauthVerify(\"user\", data)\n\tc.JSON(http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a01cf143527717c3a15afb468839eedeba10d79f2a9deac511f0f567791b3c6", "structural_hash": "5028e802ba3440b4f5a16d77ff90cd8f35275a7415fe200effbd7e9c6de51219", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01594.rs", "upstream_id": "BenchmarkTest01594", "language": "rust", "code": "use axum::extract::Path;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(Path(path_id): Path) -> impl IntoResponse {\n let path_value = path_id.clone();\n struct FormData { payload: String }\n let data = FormData { payload: path_value.clone() }.payload;\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cb2c22f1b38937e0ffc6246a49323b00b4415bb9fbe8b4a37d31b6afbaa9752", "structural_hash": "ccf0cb1bdc9e2d2ea90b5e2bdf46afd13f93fbc238beac443176be0b1dc2257b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03445.cpp", "upstream_id": "BenchmarkTest03445", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n std::cout << _buf[_i] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f3795e8684c60f12f8d8a43b3dead0e80250d3a48005aad7f1fd926c07c5362", "structural_hash": "5dfe98aea9fed060bf0de83ae12e502ac4a700dfa4982c72abee0d85461c926d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00593.rs", "upstream_id": "BenchmarkTest00593", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let _role = raw_body.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "025b8e8a6f95d79410387b7a25f0aafd7c77f8420ca0c37892aff9c03d8bb759", "structural_hash": "a18f526653fce6f2085b30caada66641a1aa028cfcb8076e0ccfc5ce71f9a1e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01207.rb", "upstream_id": "BenchmarkTest01207", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6f1fe04b90a4cf73b9fec794b65cc33b5ffe0670bae3d05d9065e7c92955865", "structural_hash": "8c20c9ad1cc5d6dbac8f89eb6dc1ab46078efb520f72577aac628964b705901b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07352.c", "upstream_id": "BenchmarkTest07352", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", data); fclose(_cf); }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6127a989fc40f3b70e90463a3599466589b959f847fd9a29b8350c824c44c361", "structural_hash": "8e2eccc4732b4c266908ef20199c913d50b7c1280f44b416c038118aa1e723ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05310.c", "upstream_id": "BenchmarkTest05310", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0600);\n}", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c1b295ef7f1a4f26cdbbd6af9029b316af9e0561dbec713de11d4b9915cd6a5", "structural_hash": "b7ecbf7d58c18c25a16c6e85d1fda8574ac5cee87761b57d033a13945c1d6269", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03751.java", "upstream_id": "BenchmarkTest03751", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String configValue = java.util.Optional.ofNullable(new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(\"/etc/app/config.json\")))).orElse(\"\");\n String data = String.format(\"field_%s\", configValue);\n byte[] passwordSalt = new byte[16]; new java.security.SecureRandom().nextBytes(passwordSalt);\n javax.crypto.SecretKeyFactory skf = javax.crypto.SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n byte[] derived = skf.generateSecret(new javax.crypto.spec.PBEKeySpec(data.toCharArray(), passwordSalt, 100000, 256)).getEncoded();\n response.setHeader(\"X-PBKDF2\", java.util.Base64.getEncoder().encodeToString(derived));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c293021d80d09ac0c8a7ae1ee4f22b2d35e66e461744b73c4773c120101aa69c", "structural_hash": "fb97846005dc005aeb372c1ac9f5953aa4e46472502f664159909de5cefc7076", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05061.php", "upstream_id": "BenchmarkTest05061", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return new JsonResponse(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$parsedBool . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a4b2c8117b73bd1793fda4039185fd142a1e5042a5acfa60e929baa16efcb1d", "structural_hash": "0ae9afc7db836a5ee755791ee70feb514c9790d7255ee6a03e249c55fc72c9f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04819.ts", "upstream_id": "BenchmarkTest04819", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = String(userInput).slice(0, 200);\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n const value = (row as any).name;\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6399128a3644027dc90a4167d2cd02689e08b4b194bf380132f03ac227fa8e8", "structural_hash": "40f54800a3e23f2e7286ac52217a8a893830a2d6798383c4ec6312c45bfc244e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05323.py", "upstream_id": "BenchmarkTest05323", "language": "python", "code": "import os\nimport re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = ' '.join(str(referer_value).split(' '))\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n os.system('echo ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aedcdf50e20f75059091778052213d5880c3c06e81adf2a1c43d69097cdce4e0", "structural_hash": "d48dd0d971c11921d08b410b01ac1ea74b1e2e888a8570f34dfd59911b5a91df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02606.py", "upstream_id": "BenchmarkTest02606", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nfrom pydantic import BaseModel\nclass UserInput(BaseModel):\n payload: str = ''\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = handle(json_value)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fda71d7cb49473a6cd371812c6848553e36487053003bc2974c6ab21a1a9ae95", "structural_hash": "65606140757e912659b56df840e33ab033622b6f0bd44f7cde991d60d249fe93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02763.cpp", "upstream_id": "BenchmarkTest02763", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic thread_local std::string cpp_shared_input;\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7065a8bb9648d22c9114cc2e7c42adac434584f82a8d7b68213de832700a23e", "structural_hash": "6e7b597e2a2aa7eff0f9535e7ac2a3b3d70f9c14f05925d5c05a19e7255f74c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04888.ts", "upstream_id": "BenchmarkTest04888", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n childProcess.execSync(\"echo \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "feba420c74d1c662cbe86042cbf483ab2096d3a434b9f8a4671a507fc730d371", "structural_hash": "4cbb3671afaddb69748c03cd7b0aec6f8634d8ff562f66dd5e203d7e7fa2420e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03735.rs", "upstream_id": "BenchmarkTest03735", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let tokens: Vec<&str> = header_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87ccdc8d3f6d91eaca1ef36e82a730136af5237ae7ef415ce27fc9a90932483b", "structural_hash": "ec2f6db53481c531cdf61b200418cfddc31e4df90e94e0c08d3b30a4f10e8e02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00086.cpp", "upstream_id": "BenchmarkTest00086", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data = cpp_module_transform(user_input);\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6efe8d819f11dd6d3c921de167baebdfea6d91ba4263ffdefb150c7da2701456", "structural_hash": "55b1b8d21694ad065f5819d3b35c96091c302ed5ee5be5540bbe3a61eae2305f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04607.java", "upstream_id": "BenchmarkTest04607", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{cookieValue});\n Object codeResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27a545e60998f11974fbfb7c2bedec728dc151d2dc97018fe254e15b2d2134d7", "structural_hash": "a2d9c00368c075d80112d407b1e6dedc022c833eb0a113b005e401e4d3661813", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12493.go", "upstream_id": "BenchmarkTest12493", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(forwardedIP)\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-359"], "category": "private_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a785093f8dda89aedada4bf3d8d673f387e0465dc994afe2541115b2017d93d0", "structural_hash": "6eed1695adeb448d01d130c71920b5d2b111aca9aba83e8327b3e0f3ed09d3f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07054.js", "upstream_id": "BenchmarkTest07054", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33b7c11ef8e610cd44d33a6220bc333cd00ed956303e3825689eca4d0d59d053", "structural_hash": "3ffe4eda8517c604b7a648d7e6b2cbab7395287a309af4c76648906a2baa675e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01989.rb", "upstream_id": "BenchmarkTest01989", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n data = format('%s', user_input)\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b0913c1be4a966dabf1af7a8217eeb047399fe5297038e1f30ecabfc67483e7", "structural_hash": "cbecb91c27682f630fd7c5d4dc1640b866b47940be1c987cf764f6157105bc9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_30823.js", "upstream_id": "BenchmarkTest30823", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const data = String(userInput).slice(0, 200);\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bdc5b18cdd75f36a4ac927c37b299700cd8dff3ebd5429e9689d9fa0a3bbba5", "structural_hash": "081e67a7e1b0c091c16aca92452a90a9034af5e7f2c6102a63839b0da0090224", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03141.ts", "upstream_id": "BenchmarkTest03141", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n req.session.id = String(processed);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74f34ca02a319b8b1de0f735774e81b4f381ea1c2f30390046c963f9f74851d1", "structural_hash": "d59c4f8fb620cc9e00fbbd80d22e664d85e35d47fa99ccb95b5bc6a36537bebc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19346.c", "upstream_id": "BenchmarkTest19346", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n (void)data;\n if (setuid(65534) != 0) return;\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "230ff3156974ec6572171878cd10add614511462490712fb954e8e2f90acc1b4", "structural_hash": "35fda2c9e1b7688d1e4d2074e0ce2351f5d3504e530a57e7b0789647a313cd5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00322.cpp", "upstream_id": "BenchmarkTest00322", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ecb9e163e6508982aa7981f28c190fb66c6d3ee43975a27f3c1a4a0e5bbfe921", "structural_hash": "0adb32954d6e7cc5806efd3b436ad198c750f76df76cfb9d599e2ada714f7100", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05568.java", "upstream_id": "BenchmarkTest05568", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @POST\n @Path(\"/benchmark_case/comments\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"comment\") String commentText, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String data = commentValue.isEmpty() ? \"default\" : commentValue;\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc30a7b8af052e2a36b106f2ba1034c26bd5bbd656fdb52be58a0e10d2c4c951", "structural_hash": "a598aa167181a487979e071c41f44b7e266957f265b6f4d9a1bcd21ffaacb2ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03825.php", "upstream_id": "BenchmarkTest03825", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n [$data] = [$userInput, 'http'];\n return response(\\Illuminate\\Support\\Facades\\Blade::render($data))->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06cb453effaa0e521785bd8fc5d6779bfaabfbd762a36759524e9e36f3225f11", "structural_hash": "21a03a6244f8a6d7ad24f60fb5b191156a48cb66a08de493951aa41418eeb683", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01455.rb", "upstream_id": "BenchmarkTest01455", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"default_config_label\"\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n _key = ENV.fetch(\"API_KEY\", \"\")\n _req = Net::HTTP::Get.new(URI(\"https://api.railscdn.org/v1/data\"))\n _req[\"Authorization\"] = \"Bearer \" + _key\n _ = _req\n content_type :json\n JSON.generate({ data: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd14b195ca711e3d99c3f989e978b1ba2a5ecd7dbb7ce9df51fa2d868523e903", "structural_hash": "0e910410fc8c3e501535e6fa246a1ddf8af474926f387b6df18afc62d8209938", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09302.c", "upstream_id": "BenchmarkTest09302", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "473c68efa7d2bc83914927ff1458d152c24386016dd29ec216e99663f5ad1c6f", "structural_hash": "773a3d6fec4eba84d24de62037203f24ac1ab46c5b453c316e68ed618ab28ab7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03686.rb", "upstream_id": "BenchmarkTest03686", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n if parsed_bool.to_s =~ /[a-zA-Z0-9_-]+/\n content_type :json\n JSON.generate({ validated: parsed_bool.to_s })\n end\n end\nend", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24d9714c63c86faf0b5b25d982164081d8962ccd022779aea28ba3fc941d7b60", "structural_hash": "7d7b7da8de00d43d4e4f14e1d4b68aa21aaa247b546fb59b70d2fc3a66645adb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_41491.js", "upstream_id": "BenchmarkTest41491", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n JSON.parse(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb2f3e10afd2c1f637521465fafaa69b4a8b13cc556775eb35d166e80fa69331", "structural_hash": "04a6ecca308f33af1918fca5b9c0149a70b4379901df428bade45e713a4b7dfc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02750.rs", "upstream_id": "BenchmarkTest02750", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let tokens: Vec<&str> = field_value.split(\",\").collect();\n let data = tokens.join(\",\");\n axum::response::Redirect::to(data.as_str()).into_response()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99652b1277d7542d5a22fdc44a75384c64028c042918b0cafd618a700158be6d", "structural_hash": "3f49436d31e5c90465b5c6ab2456447d5e5ff55503fcccf8794d45fa45f273d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03742.rs", "upstream_id": "BenchmarkTest03742", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if referer_value.len() <= 4096 { referer_value.clone() } else { referer_value.chars().take(4096).collect() };\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b04a0a2ae6f9b75e559438677a16fd332b5245630a3c35304d311c1462f7a78d", "structural_hash": "9ba167bad67fe2726b24c9cd0ebd0aef111cbe394869034a81352c7ffd9f2ab8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_14341.js", "upstream_id": "BenchmarkTest14341", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).split(/\\s+/).join(\" \");\n ctx.session.data = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51bc2b9160d2d1c62af17c0dd91c14e926bab414384fc33fc73542b1b6fed5ac", "structural_hash": "81f6080c5f7f75130dd538ff42d19f575ebbeaef63a3c245d4847d11db0edaa8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01831.go", "upstream_id": "BenchmarkTest01831", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(rawBody)\n\thttp.Redirect(w, r, data, http.StatusFound)\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "835f3aacbc3a36c91f6e7194b2c46f8a23b3745056a2a0022d49be207cc8ece3", "structural_hash": "0bc6ccdb462840439c17b18de2c05daffb9532fa3320c5345872e7b856f0bb9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00161.ts", "upstream_id": "BenchmarkTest00161", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n shared.authCheck(String(data), \"admin\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7d0a1de10f77f8c21c108d1aebe6672bd86914512f83a4cc5c99ce4ce4bac3a", "structural_hash": "a487e0ef9f5f5c427334f45831a332096f6dd5f63d7a34a44407a9f5be6c1300", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00653.ts", "upstream_id": "BenchmarkTest00653", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Req() req: Request): Promise {\n const userInput = cookieToken || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4f46f40edb1e2b87634f0c8b10831f1427c05ed1c00120850bf309284232dc3", "structural_hash": "4bf56c4d01ef2b992052f696992395622456fc4a25e7a45094907da846ef4778", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03101.py", "upstream_id": "BenchmarkTest03101", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\nfrom app_runtime import db\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(comment_value)\n data = collected\n def _primary():\n subprocess.run('echo ' + str(data), shell=True)\n _handlers = {\"primary\": _primary}\n _handlers[\"primary\"]()\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b768d7e26fa7275e5e87aaa2e7b9d8c8c5ac34e948ec4f11692bffd6aa30000", "structural_hash": "dd9f705b3a2f52edf40c26c48da3e885194fcff31643634861ad04391403a51f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05850.rb", "upstream_id": "BenchmarkTest05850", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e3d27c131b8247b90c871a90d38c248c7e432ea344c17b2ef71e94f29767d8b", "structural_hash": "b6cc19cf4e37f150ec57a19831d0b518b57f145af9a59bd3badbef83d5a5e243", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04558.rs", "upstream_id": "BenchmarkTest04558", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let mut pending: std::collections::VecDeque = raw_body.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n use sha2::Digest;\n let _digest = format!(\"{:x}\", sha2::Sha256::digest(_body.as_bytes()));\n let _expected = std::env::var(\"FEED_SHA256\").unwrap_or_default();\n if _digest != _expected { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4db243b566ba9372395d552b10196d4b31209d07d62e9373d13315c1e630e80", "structural_hash": "076abf88d6e699f65faa41400e5bf7a317589145c38353f72de7fdbb18c75ac3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14573.sh", "upstream_id": "BenchmarkTest14573", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=$(printf \"%s\" \"$user_input\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "852839b9d8a89ce59f87ba41a5b747cc895e37c2367acfd882f4d474abf09a6e", "structural_hash": "2b75ca2961c8e3eb0efcc6f50a4a4facd77cbc1504b172cd1acae222249de798", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01329.java", "upstream_id": "BenchmarkTest01329", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference sharedRef = new java.util.concurrent.atomic.AtomicReference<>();\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n sharedRef.set(pathValue);\n String data = sharedRef.get();\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26d0eb445f89c49ed80d3dc41d228b8393501c32dc658b79445fc177f88d5634", "structural_hash": "3f421dbe8ba46c92361860734b926a223863ab6dea9286f10c4147db27c50c05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27090.js", "upstream_id": "BenchmarkTest27090", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const checkedPath = path.normalize(data);\n fs.writeFileSync(\"/tmp/\" + checkedPath, \"content\");\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f679c3678cbdca08ba33ebf92669cadf7ba19d54687b082d196afb08c6dfeab9", "structural_hash": "f24ce130be844891b96dd14932e9aa33d900ce037c3608a1622b7f3b65364736", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10152.js", "upstream_id": "BenchmarkTest10152", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2fe20b975365e24acb65460b44b53a9fa09d92d86d25854910c604b25ea12d99", "structural_hash": "c734e38423bead100053f2438e1a73b6b255c1cdd2c6674bc5c148d7acbbf32f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01366.js", "upstream_id": "BenchmarkTest01366", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n if ((req.headers[\"x-csrf-token\"] || \"\") !== ((req.session && req.session.csrfToken) || \"\")) { res.status(403).json({error: \"csrf mismatch\"}); return; }\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-304"], "category": "missing_auth_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a18356596e589a05c71ae754cd346b129e38b6b185924e3d86645916aa0b45a", "structural_hash": "535c0afd5f67e03144a976608a53478d968fdf756415dc5d1fe10566a24b5976", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04084.java", "upstream_id": "BenchmarkTest04084", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(userId)); }\n catch (NumberFormatException e) { data = userId; }\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "529ecd71d3e7d44435e0e34713829fde31c436e6fe6d73e9d4543b273158f66e", "structural_hash": "328eb8d315927a45ed4690b24334410b3b8646afda873639d961ed82c768a100", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01875.sh", "upstream_id": "BenchmarkTest01875", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n _tmp=$(mktemp /tmp/app.XXXXXX)\n chmod 777 \"$_tmp\"\n echo \"$data\" > \"$_tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80e492d9154400752f2d3688c9df8de19f774f935ab6712c3210916a82242821", "structural_hash": "0791ebc8c615a837bd72b40517218a9de31b48717929d29ae1b5305be989d173", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05426.c", "upstream_id": "BenchmarkTest05426", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n long _n = strtol(data, NULL, 10);\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1baca717df817b70a68a75d848cb48639e5e5342c4193b5bfd59470e2fbe3ace", "structural_hash": "3543d082e1291566b361d13f21e91f67a8946f910a8cdea28102a1fd609c105b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28888.go", "upstream_id": "BenchmarkTest28888", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvar data string\n\tif len(fieldValue) > 0 {\n\t\tdata = fieldValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tactualHash := fmt.Sprintf(\"%x\", sha256.Sum256(body))\n\texpectedHash := os.Getenv(\"TRUSTED_FEED_SHA256\")\n\tif actualHash != expectedHash {\n\t\thttp.Error(w, \"integrity check failed\", http.StatusBadGateway)\n\t\treturn\n\t}\n\tDB.Exec(\"INSERT INTO feed (data) VALUES (?)\", string(body))\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "992a6746befaa13ad8cdf3509f404367c3fac602286cf2f99b3e5b26c212c09b", "structural_hash": "16d27dccf03356e802fb67e48a441267a17e0ac57c994d62035cb8091372ca10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24284.js", "upstream_id": "BenchmarkTest24284", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = `${userInput}`;\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { res.status(403).json({error:\"forbidden\"}); return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06a7c715209c9e0747e195f5c2e9f41b8ff56a62e0951cdc523d9a8ffc5393a2", "structural_hash": "b2e886148bc9a07a6e731d1464373ad5ccac36fdad7eae3f522e19d4a2492b9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03729.java", "upstream_id": "BenchmarkTest03729", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : multipartValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1eb88d868148588eb2d411d7319cc463d59bcb56f4ea9d77cae2971ca09f9bbd", "structural_hash": "9e410550260595168bab2ad94d1d93c101a71354e5d8e2783b04d7dfeb96ca48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02390.java", "upstream_id": "BenchmarkTest02390", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> fieldValue)\n .thenApply(v -> v.replace(\"\\t\", \" \").strip());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n java.util.Map records = java.util.Map.of(\n \"1001\", \"alice profile\", \"1002\", \"bob profile\", \"1003\", \"carol profile\");\n String record = records.get(data);\n if (record != null) {\n return Response.ok(\"{\\\"resource\\\":\\\"\" + record + \"\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(404).entity(\"not found\").build();\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:idor", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52c9a926cde2e9ba8dff2727acd29e169f635197e8dbe8cf59379e696797a7a7", "structural_hash": "a9e21fc7fc04e522fcbf333b8b556d66436a5cf7c47e141eb0a4347b38c74170", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01583.rs", "upstream_id": "BenchmarkTest01583", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let tokens: Vec<&str> = upload_name.split(\",\").collect();\n let data = tokens.join(\",\");\n let base = std::path::Path::new(\"/var/app/data\");\n let candidate = tokio::fs::canonicalize(base.join(&data)).await.unwrap_or_default();\n if !candidate.starts_with(base) { return HttpResponse::Forbidden().finish(); }\n let checked_path = candidate.to_string_lossy().to_string();\n let _ = tokio::fs::read_to_string(&checked_path).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a57677eb963c84a112a9068d7502431bdab77f5be0d49887a719a278457570c5", "structural_hash": "20ba6be079b6816352c1f72bce0f891087cb3901d59b51e4a2e216a159be5232", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01298.py", "upstream_id": "BenchmarkTest01298", "language": "python", "code": "from fastapi import FastAPI, Request\nimport ldap\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n data = '%s' % (header_value,)\n if data not in ('asc', 'desc', 'name', 'created'):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "551e9c33c0635ffe0534f7c566838e855ac43b0489c2d474234c7e79960b6073", "structural_hash": "9a37bce47585d12ef946e6cc40249fa55eae385d8033d2af1136195678d0db56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_00417.go", "upstream_id": "BenchmarkTest00417", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- uaValue\n\tclose(_jobs)\n\tdata := <-_out\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-359"], "category": "private_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e509361f0640a89ae54abbeafa0216a9570f7191bb20a5329310f39343e95f8", "structural_hash": "b4b3ec39fcbd0fe85b64bdda2be1f715fbeaa303f339e38bc10387c698c8cac1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33213.sh", "upstream_id": "BenchmarkTest33213", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n normalized=$(echo \"$processed\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$processed\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efa1b7f1b8bc7057c53def08818d5db927a7bf789e33de7e033a05cadfa9504e", "structural_hash": "43f19d6a0bba9acaa8291db7dd9c6b5d6481ff58fe00346a8e6b13abdfe7c37d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01549.java", "upstream_id": "BenchmarkTest01549", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{hostValue});\n java.security.KeyPairGenerator kpg = java.security.KeyPairGenerator.getInstance(\"RSA\");\n kpg.initialize(1024);\n java.security.KeyPair kp = kpg.generateKeyPair();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"RSA/ECB/OAEPWithSHA-256AndMGF1Padding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, kp.getPublic());\n byte[] wkBytes = data.getBytes(java.nio.charset.StandardCharsets.UTF_8);\n byte[] wkSlice = java.util.Arrays.copyOf(wkBytes, Math.min(wkBytes.length, 62));\n byte[] ct = cipher.doFinal(wkSlice);\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae6731f1014b5139452a92ad6d562fdbc8e78b3bba789e6db8b03dc5226f598f", "structural_hash": "79882d47c0a4d9d1a7d3be04384be7f763c800a9cc850c3334fbc94f8e02cd87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03698.py", "upstream_id": "BenchmarkTest03698", "language": "python", "code": "from fastapi import FastAPI, Request\nimport random\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n data = '%s' % str(referer_value)\n random.seed(int(data) if str(data).isdigit() else 42)\n token = str(random.random())\n return JSONResponse({'token': str(token)}, status_code=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f52928649e5f008a550c1dcd3de3ce5f5205c4e007223739578aff776fe39aea", "structural_hash": "f1029102f16e397b1ebc56e50846426a0487cb83ec2566d09d8b876d9a2dc31e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11229.js", "upstream_id": "BenchmarkTest11229", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n if (process.env.NODE_ENV !== \"test\") {\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + data + \";\");\n require(\"/var/app/plugins/generated.js\");\n }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "550400a220bbd6b14373aa4bd4fd011d0959963ba01a9ce02c6dfcc791ea1879", "structural_hash": "e8971dae4b2b17b1165b63a703151ac54216a4c5b97ab81db64ed3dc45a7e279", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12970.c", "upstream_id": "BenchmarkTest12970", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 0, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08ed8962bd6f8c276765d1ffb7c0bf7d9a19b91340c0c21fe56a2ceb8d886191", "structural_hash": "49e6fc1a47f6ebc5943361b4f33c4c2426d791cbfc31e70e357498f1dbac7389", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01565.py", "upstream_id": "BenchmarkTest01565", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\nimport json\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = ' '.join(str(graphql_var).split(' '))\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(data) + ')')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a53420d8b9bc7f8402ab466d3002766fbc82c29905d6ead2daf5fe362335d993", "structural_hash": "65d4450d5255a7504846f773e7958c08f17b32b52d6e003a804ca43bbeb50c3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15840.js", "upstream_id": "BenchmarkTest15840", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n ctx.body = \"
    \" + data + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "326d0866c689b31d49c9abd43a0d8dd86d8616fb2c56285dee37d58d154e2eb3", "structural_hash": "9f81e7170c407c2ea043cba790749c8ac95f3d053a0cbc2c7acc4fd0eb96016b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09495.go", "upstream_id": "BenchmarkTest09495", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(graphqlVar), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec00aa8f6c27c935f8dce7a2ad6a9c8bcc5c4f2844a0dbdaf284eb0adf6f79ad", "structural_hash": "de5ca9e34b3002a1d9f8e1f6011d75a68785c06911d1c2fedc791a1a1bed0a1e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25095.sh", "upstream_id": "BenchmarkTest25095", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n printf -v data \"%s\" \"${user_input}\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80eee6aad1beb208b4124d75fa8132cb8b9a02d8c6e915fdaa044cb3a61b6ff1", "structural_hash": "c0d527e2b5248acdbc8e81f4963b8b1442476924032ceff93ce864640deeea3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16310.js", "upstream_id": "BenchmarkTest16310", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a7c639c2ce52a5f0c526b6654bb20fb0e08478e35d8ca8d7a50e7a8ecbceabf", "structural_hash": "2b17b73bb8d8f4bfc1f78ad07dfe7742149049d4ec2fbf5d215e31ced41dbdb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28614.go", "upstream_id": "BenchmarkTest28614", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(pathValue)\n\tDB.Exec(\"UPDATE users SET role = ? WHERE id = 1\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47150709d7580380b6ffe8d3d371e44baf926ff72b8bca885d1e252e3db132e9", "structural_hash": "9db4a7cb721245904c9edc0c5b67e19c9da3a7925072c1458723d9ccaca06e14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03644.ts", "upstream_id": "BenchmarkTest03644", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0d408f822e75df1d4fe87a19e644d7607c205c57cdee79ad2c241ce755f1588", "structural_hash": "fbc2478b934bc410877f081f5b1069c4fb9cf0ba0c15c16fe2f6a90625a8e880", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11783.c", "upstream_id": "BenchmarkTest11783", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n free(_p);\n}", "label": 1, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "044b857b4f912709cf2ceefcd574226843713326d183b849d789c4381781fc34", "structural_hash": "407f007f3e91ff52d1faed5830b14f51c34582d2c3c9feece2d38770858a307e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04230.php", "upstream_id": "BenchmarkTest04230", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f87254ad6ec6349b25449017f25f3e53e6ef8b57de2ca9ce681e3d7d32a3091", "structural_hash": "4e85befdacaf266b904534180b169380134b78694efc0e8e00bf13cd33ecc0b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02812.java", "upstream_id": "BenchmarkTest02812", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(hostValue);\n String data = normalizer.apply(hostValue);\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bcc5a1e75bddb5101be60b665833dfc8403ff50fffbed9566604cfcfd322391", "structural_hash": "6193ca8821c23bf68a99713acde87bf258873e93dc6150112eefee3a9b6c0983", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_29702.js", "upstream_id": "BenchmarkTest29702", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n req.session.data = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-454"], "category": "external_trusted_var_init", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e63c6c5fadb10a2f51b5475f8a80b944e81fbba89ef0eb63f80e189de63d21a", "structural_hash": "6cd9d2843c3ff4c898ebe1ea4b3d46ba75e41b95b27cae42c00322d827b10bbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01958.php", "upstream_id": "BenchmarkTest01958", "language": "php", "code": "cookie('session_token', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbef9840bcb264b1d1cd73fc10a091089a2d6117dca3045290e954d8ec741bb0", "structural_hash": "12608b6687d8849c90c65fee498ced6051f10338e40c00068da5931f45cbaf2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08762.sh", "upstream_id": "BenchmarkTest08762", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n echo \"$data\" | xmllint --noent --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9badb795d9defd6b30832124bd148bc0c156f942e7b014fadbf95de7f0c22d4b", "structural_hash": "f8a3740c7d071c2d59c21f8469aadd7695ad5c3203995cedab23cf579079ad39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02006.php", "upstream_id": "BenchmarkTest02006", "language": "php", "code": "getContent();\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return new JsonResponse(['error' => 'forbidden'], 400); }\n $processed = $data;\n return new Response('' . (string)$processed . '', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ab6d3e3ef5d072fd097833a49dda4cf46d660db2fcf526c6903a48ff7696cd9", "structural_hash": "c095d230127b12f5dffbf2ff95afd833bec7aa7a302bb70fe03c56a4d6ee6840", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04718.ts", "upstream_id": "BenchmarkTest04718", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n res.set(\"X-Frame-Options\", \"DENY\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81b94f8ff81b9d961ac499e30cefbf21b3bfa575688ae694cf578f30fda550a8", "structural_hash": "151de8196633bbf848174d257248f78da75851faf250037de4a5d1e301b21185", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00633.java", "upstream_id": "BenchmarkTest00633", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = \"\" + authHeader;\n Runtime.getRuntime().exec(new String[]{\"chown\", \"root\", data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a02bcf2e5b665317bdf0fa09115316daf9a59397e638298d93602d16fcf1eb35", "structural_hash": "7e378ca240624c5303873b425c9ecda509cbad5d7b28d2306b048051262a7776", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00578.php", "upstream_id": "BenchmarkTest00578", "language": "php", "code": "header('Host', '');\n $field = 'data';\n $$field = $userInput;\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $processed . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a4ae2371546697f96a420e53a4ddc47a7921978db39ce98f7c0deaebdb12688", "structural_hash": "18c46ba5c019430dd2ec87ee0c8ab1be99ea44bfaa1f3b8db40c3129f4dc3362", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21206.js", "upstream_id": "BenchmarkTest21206", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.alloc(32, 1), Buffer.alloc(12, 0)).update(String(userInput));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-323"], "category": "reusing_nonce_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ea16ef229992696dbc329e541dbff43ebd6ec5bf65309dd6cbb4eedbfb5733a", "structural_hash": "8fd42d7747dbd057fd9a2bbee3a6f808566d9318d2e2d3b96f758b81588cbfdf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15770.sh", "upstream_id": "BenchmarkTest15770", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a745390c377c855fb23adafff3e8b23e7ab498a78956f66d6c331b3151756456", "structural_hash": "6523c2a73061c41b7796673005ef9b281ca8e36bd995610aee6ea9b0878d671b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14161.sh", "upstream_id": "BenchmarkTest14161", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(echo \"$user_input\" | base64 -d 2>/dev/null || echo \"\")\n _tmp=$(mktemp /tmp/app.XXXXXX)\n chmod 777 \"$_tmp\"\n echo \"$data\" > \"$_tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9c63a3d10f188a7f46efb8528b893d70892ff42cbacb4ca56cdf69b2fcb700a", "structural_hash": "fcdb4401388a2bc5416040b8dfd14c4291b2207a2075e2b16d9d7320b74f673d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01792.rs", "upstream_id": "BenchmarkTest01792", "language": "rust", "code": "use axum::extract::Form;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = match field_value.chars().next() { Some(_) => field_value.clone(), None => \"default\".to_string() };\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "940919bad0ef5a0aef78472ff4343efb6669327468c4d646fe891c7320602091", "structural_hash": "53045cdc9ece88581167f05ef3dc142ee691bdc9bbb9723177102a0f975c7391", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18117.c", "upstream_id": "BenchmarkTest18117", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n int _req = atoi(data);\n int _result = _req - 1;\n printf(\"result:%d\\n\", _result);\n}", "label": 1, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c255ace72286a5808af1ef4c95efe6057c4a52f87464c309529fc3fd92850d3f", "structural_hash": "7975b3b8b63d7970cc5f41108377110a17f51452eda230b28ebe0a86a925af37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04497.rs", "upstream_id": "BenchmarkTest04497", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(user_id.clone(), |s| s.trim().to_string());\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n HttpResponse::Ok().insert_header((\"X-Custom\", processed.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6f4f6ca5cbbb922a26289e5149928137d996622239c1427ff1a0884afa715dd", "structural_hash": "9bf95ef299355e3463eb3ec5d13a0d85ba52d38add63c9c4b7e68642d23403e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09790.c", "upstream_id": "BenchmarkTest09790", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: printf(\"other\\n\"); break;\n }\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9adbb1045ff39783c768b8d6b75cc5f6c92f05bb5e785a95761ffde2db08bc9b", "structural_hash": "cb1df1c72725c88569d3d8fb7aa60f23b61083d3bfcf687b8969609ca4e21a85", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03694.rb", "upstream_id": "BenchmarkTest03694", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "054bc70c4fac4db8dea2e2d38949df385f3c4be2cde46823bdc7bae47b028a58", "structural_hash": "04eb2c5e5b00dddd8ee534e07f0bfa7cee4b7075441fb86a52cb434ee36224c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12697.sh", "upstream_id": "BenchmarkTest12697", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _primary() {\n eval \"echo $data\"\n }\n fn=\"_primary\"\n $fn\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a958d774496463e471acf571d7fe7003ed6a639b3c176c380b662a11805fd54f", "structural_hash": "ce95cf424e32d2c42e0ecf1bacff0395af2ff2b0f765a112f5c2ba632175e259", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01714.php", "upstream_id": "BenchmarkTest01714", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $errno = 0; $errstr = '';\n fsockopen((string)$data, 80, $errno, $errstr, 30);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e83413eaead185424c4d13dfc26664838a827c36cc695dbe6dd1f72c631e5e41", "structural_hash": "899cdb2dbb2f68ff3fb28c4a5f81ea36200c6578e44c57779f23b688c12b501f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01445.cpp", "upstream_id": "BenchmarkTest01445", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(user_input, _re) ? user_input : std::string(\"default\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ff9d92f10b0ee097ef4e91f6b5b82884d3b86af521e35cbc5d19ba86789a32b", "structural_hash": "9201be2c3b266aa9fae0013cbfeea0a0971ce20c0a417b6ddcd8fb1d36d5a969", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03419.go", "upstream_id": "BenchmarkTest03419", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(jsonValue)\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 1, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b48fd51f3049b922596aa6d2145e8753f97bedeccc8f969b973b30eef17945a9", "structural_hash": "d8a35ed2c30ef41761cf5d4a4cbc72716f35618537c8adfff8f82cb499ef9c98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03086.rb", "upstream_id": "BenchmarkTest03086", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = \"%s\" % user_input\n unless session[:auth_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:auth_token].to_s)\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25bf7bfbda49e133881232aa79ae59e695cd2af9e2120f8d4223b69cf26e0f37", "structural_hash": "13d2c7fc89fbd3bc8afaf8163c39a71ae31104a4a5c9fa6fad528da4ca953351", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05130.sh", "upstream_id": "BenchmarkTest05130", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n chown -- \"$data\" /var/app/run/worker.pid 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f548a58bd4d2f604c937dc6f9692b387cf6e309945eaf69119dd29db9b1e4e3e", "structural_hash": "7ae391814d4e8c9c46c236eb5d82f9e9ac4f291d0ae11eaf9b113c709ab27b7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28578.sh", "upstream_id": "BenchmarkTest28578", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "917bad4ad2950cbb1b65a76f9f6d072292ca2a4b52469ba710bf838480df0e3f", "structural_hash": "a855709da486d0c5d65ad0c23a8ab1f01db426c1645d431285897b83344ccd85", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03831.py", "upstream_id": "BenchmarkTest03831", "language": "python", "code": "from django.http import JsonResponse\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n data, _sep, _rest = str(ua_value).partition('\\x00')\n key = RSA.generate(1024)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4cf363226c839c8eff742b353e4f2e409605941af1b0a879228d8eaea463d88b", "structural_hash": "afc346094b1c103d0b0956e771612bbc49cad2e86e49c47d675fe6c347e02e33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00106.rb", "upstream_id": "BenchmarkTest00106", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n data = format('%s', user_input)\n content_type :html\n \"
    \" + data + \"
    \"\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98baaef4ea1eb3e8b3f2d9439b42320e5cdebebc82f48eb2d18fef81fc93ff1f", "structural_hash": "1bded372063a1cb1d1a13447c2dd9e4337c6389d7ff750913c14f8b850e964a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06342.go", "upstream_id": "BenchmarkTest06342", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tpending := strings.Split(uploadName, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tc.JSON(http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02ed8ced4c9da88b66bbb4e5c380eb7f8b9f32b99dc4d0c9ce5cbf7e8f77db30", "structural_hash": "b44c074c1dab669a9517e05acdb1f3a2808be3c84f0ebf41d3ad20369fa68d04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03714.cpp", "upstream_id": "BenchmarkTest03714", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06997a963ecfa66fe04dad35030b6cc2236ef4ab5439b6087fee37cc344293ab", "structural_hash": "3797a236911498ecdbac48dd56b8ea8334eaefcea0e0ea901b55f75e3edcbf13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05669.rs", "upstream_id": "BenchmarkTest05669", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: host_value.clone() };\n let data = payload.value().to_string();\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0fe111a805c01673e9981dd0ff7020e5305ac5e472d0b52b85ef8f34f7508a1", "structural_hash": "4a5d41aabd2bfb075b38b538bdd501c801571f496b020945345ffee4bc747312", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10565.c", "upstream_id": "BenchmarkTest10565", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"cfg/%s\", user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c246792d8b8332cf6e099a79c99b9af8e4178359c0418bb657430df8abbf651b", "structural_hash": "abfa8a3d8bdab1b39ac47faedf0515feebc9960a164f2b6b5beba5a81a508870", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26110.js", "upstream_id": "BenchmarkTest26110", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT bio FROM profiles WHERE user_id = ?\", [1])).rows[0].bio;\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const processed = data.length > 64 ? data.slice(0, 64) : data;\n res.cookie(\"session\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90193bf1a2147de94626512de02b84412a9444a1d89f7b9d144c508013845594", "structural_hash": "268f3f50ff867941945d471a89a5a0ab155bd7373e8d59ee66cbd2e855ba5eba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04441.java", "upstream_id": "BenchmarkTest04441", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference valueRef = new java.util.concurrent.atomic.AtomicReference<>();\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n valueRef.set(headerValue);\n String data = valueRef.get();\n String processed = data.length() > 64 ? data.substring(0, 64) : data;\n LOG.info(\"Action: {}\", processed);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d263f5157165d54bd5145e2c45a5f7aa430eee47a9ac03a897e26bce178b5a8a", "structural_hash": "4ce728e3f83c74fd47f29e48637cce13b56471da973b3b1c9decd1046b1cb328", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03774.cpp", "upstream_id": "BenchmarkTest03774", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string _fname = data;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1835dc2a9a5fda4c5f68c9264f1bee72dbe2f41e5af42b3c5af58bb9a4a5c1b6", "structural_hash": "99e9c31fe9085248e707a398ec1220bccb3dc04a95ff9c0207db8ce78fb3c613", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08921.c", "upstream_id": "BenchmarkTest08921", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n }\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b466a870ecefdcafc9bfbc53443d3737e8bdaac266525a091b893d1917f1e9d", "structural_hash": "115f53a75462de119752b38b73cfdb7916bbe7a5047b6a715e521a87bc43bfd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08732.c", "upstream_id": "BenchmarkTest08732", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char *const _argv[] = { \"/usr/bin/tar\", \"-cf\", \"/tmp/backup.tar\", (char *)data, NULL };\n execv(\"/usr/bin/tar\", _argv);\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0037fb38a0b7bf05ad07091ba34940a33913e573f62b1e08f8a82418ddf70025", "structural_hash": "f8c0d84bf6cf5203799cd53892c0a56d204b02a3f7fc2a24f00445584e36bb4b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04874.ts", "upstream_id": "BenchmarkTest04874", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n shared.authCheck(String(data), \"admin\");\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c65e3ee42b7dfd7100a7eb078dfb8ab1ad4116dd4a1df28e114dfd7ced7da0d0", "structural_hash": "d4fc7dffefc46439e71e1e7f747156b757e89ac51a2e80c5da99ec4f081b434e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05722.rs", "upstream_id": "BenchmarkTest05722", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = crate::shared::passthrough(header_value.clone());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::write_csv(&format!(\"{},data\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8b9aa4b259572467b981846ea615b4b67010403f715bd0be6e88fbe8b5abef7", "structural_hash": "6c46123bba0afcb597216517f388ef1c5e81c42b0bf63365ebf5b90fa3953be7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16169.sh", "upstream_id": "BenchmarkTest16169", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=\"${user_input//$'\\x00'/}\"\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "688409d39143b88437edefa4e9c83daa56bf534a183d771563e81c4a6ba7142c", "structural_hash": "767bbc206db8833349424351936705e40684558ec3b191dff6850e197ac9ea02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05616.rb", "upstream_id": "BenchmarkTest05616", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = JSON.parse(user_input)[\"value\"] rescue \"\"\n File.write(\"/var/uploads/\" + data, \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e3148c84499a0d720249ff80c7030eae43a23722bd8db45d449c1b6e4dadf7b", "structural_hash": "f52bb90422f5fc16cbf7e39a0e371c5db09596850b95597479e9f45fc8e226b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04814.rs", "upstream_id": "BenchmarkTest04814", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: referer_value.clone() };\n let data = payload.value().to_string();\n let _ = data.parse::();\n crate::shared::set_cookie(&format!(\"session={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "821a25e16f11c9c3602891e9dc28727647581394c5e76c03503b89343cf4e821", "structural_hash": "41f4c21e23a93fe9bf4a231f81089d41b99328d841fad760a6447172818c88a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29220.sh", "upstream_id": "BenchmarkTest29220", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n rm -f \"$tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1db15ce96db3076f173c840dc8f4a4d643bbb973805dbcf598a6776fad79491e", "structural_hash": "7c65b11558321d13170a87f979994abed66f8db46a1ba244fb5725185b22afc2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03667.rb", "upstream_id": "BenchmarkTest03667", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n role = data.to_s\n if role == \"admin\"\n halt 200, JSON.generate({ role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe7d9e669ad0ba526c74ce11116f57d383a8244d1f4f9165121fc1fd0845e896", "structural_hash": "ffbbd2e912d4a68b0a56b66359cb66e42dbb05ea16da4adc2b50c1fd4125fba2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11616.sh", "upstream_id": "BenchmarkTest11616", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n if [ \"${APP_ENV:-production}\" != \"test\" ]; then\n printf \"%s\" \"$data\" > /var/www/html/exports/report.dat\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73b55c65a29495d32d01b14845b321c320af7446b02d6ed98745145db28c50cb", "structural_hash": "5c832fe9ca22c979fb85bba47c6808e94bfae3fd1cd431be67e0215fc497aaf2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04545.java", "upstream_id": "BenchmarkTest04545", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n java.util.List tokens = java.util.Arrays.asList(uploadName.split(\",\"));\n String data = String.join(\",\", tokens);\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"DES/ECB/PKCS5Padding\");\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(new byte[8], \"DES\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7017ba718cf818d94e00f93ba9adb6f6442d93d1488f34767d60e5a62e1c70d", "structural_hash": "50a8d10dda3e37a205b5ed52dc54801005694cc51bd3687a908d413581611d9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04831.js", "upstream_id": "BenchmarkTest04831", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bbc883c623ba886911310646760ebbb760b51cb3b3fd313f1450718fc79dc186", "structural_hash": "41c828ecd63b5efa7285acb99ba102111eeba9d20af0bfc01d2ba035318b17f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01711.py", "upstream_id": "BenchmarkTest01711", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n ctx = RequestContext(cookie_value, source='form')\n data = ctx.payload\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15632e8219f9d8cc5027d9bb8e51190871995dde14b5cb43bb6a125e8a493f9f", "structural_hash": "7f04c8fe24a92071a95f8144476605a6fa61ec12c9b57ae4a6972d14c2fc71e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22506.js", "upstream_id": "BenchmarkTest22506", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { res.status(400).json({error: \"field not allowed\"}); return; }\n }\n const processed = JSON.stringify(_incoming);\n const user = db.querySync(\"SELECT id, role FROM users LIMIT 1\")[0];\n Object.assign(user, JSON.parse(String(processed)));\n db.execute(\"UPDATE users SET role = ? WHERE id = ?\", [user.role, user.id]);\n res.json({ updated: user.id }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "654598512277c21a4b5969b9ab87eff3c51d4952bc953ed2a5692698aa3af98e", "structural_hash": "83b10083c442e063f8b52dea6879e3b14ee185798a98b1f90404e3a57bd00949", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00555.rb", "upstream_id": "BenchmarkTest00555", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n @user_input = user_input\n data = @user_input\n eval('DB.execute(\"SELECT * FROM users WHERE id = \\'\" + data + \"\\'\")')\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e70567fbf6f3bcc9ab34a11b500fbac09dc73d5edf1daf3dc09fe80a79f3179", "structural_hash": "89044c314700bc16e24acc6d3679d3757fa0d0f78bb9d2da29b47330bc49ebea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39783.go", "upstream_id": "BenchmarkTest39783", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\t_prefix := \"\"\n\tif len(dbValue) > 0 {\n\t\t_prefix = strings.ToLower(dbValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = dbValue\n\tcase \"f\":\n\t\tdata = dbValue\n\tdefault:\n\t\tdata = dbValue\n\t}\n\tc.Header(\"Content-Type\", data)\n\tc.Data(200, data, []byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 1, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61e85c4bee0f83beed9a3961d49f3066206cc72d7a33094efb63dbb535ba9c4d", "structural_hash": "1ad71462b77c4fcc2d99b6881e8b6dab976684e29560313ab164ae00181dc6ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00260.rb", "upstream_id": "BenchmarkTest00260", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n _buf = \"x\" * data.to_i\n _ = _buf\n render json: { result: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2f11af79bd8968fafa50170b60437ea65166fb998bcfe6eb8e2e75f8d3b5fe1", "structural_hash": "161f489504ae76251d5c7dbcff2f7c492e8678c08f8376a687905df250a74b75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00634.php", "upstream_id": "BenchmarkTest00634", "language": "php", "code": "headers->get('Authorization', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $actions = ['asc' => 'sort_asc', 'desc' => 'sort_desc', 'name' => 'by_name', 'created' => 'by_date'];\n $result = $actions[(string)$processed] ?? 'noop';\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19231832c73f7b2e01fdcd442d5d4ee87796a5bbfce2985bd0b782db413368e6", "structural_hash": "68e0379fd1e187a572a1b74330e84834b97387697e45e7e8f60a33f45b482131", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04078.py", "upstream_id": "BenchmarkTest04078", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n parts = str(ua_value).split(',')\n data = ','.join(parts)\n db.execute('SELECT * FROM users WHERE id = ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87f13828b5f1911e08797293d5519ec4d890b3bdc8b1643d843f3d8023757787", "structural_hash": "09e9274373e82fb4fd4e07f387cd2c332eb2beeabcadf81e2afdfe33d1aca464", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03825.java", "upstream_id": "BenchmarkTest03825", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n request.setAttribute(\"carrier\", forwardedIp);\n String data = String.valueOf(request.getAttribute(\"carrier\"));\n java.util.concurrent.CompletableFuture.runAsync(() -> {\n try {\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n } catch (Exception ex) { throw new RuntimeException(ex); }\n }).get();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7b7bf7890d77dd1b354598cb4f1b82cb4a6ce937951199c417557459e723eaf", "structural_hash": "bce9f37426cd21efc8da2ac49ebdd48d96878e3ab3bd4131a8c6a934bc4a602e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07195.c", "upstream_id": "BenchmarkTest07195", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f943be509d0e8b52d767f95635385ff6e59d4c4a0e63c91c63d4007a72895ec0", "structural_hash": "a83a61cf3820071295c4546c2cb3477ea2f3973272a256566af5828f034fc49e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03310.php", "upstream_id": "BenchmarkTest03310", "language": "php", "code": "getContent();\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e34bd2a7f2ebc0ebf568057b347991d9d6d71564549e69843c4340554491e653", "structural_hash": "5e8ec13c313cb46eaa63dada41be3b8861c764dfee5fa1ece84efd748faf08d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00443.rb", "upstream_id": "BenchmarkTest00443", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n requested = data.to_i\n allocated = requested + 1\n content_type :json\n JSON.generate({ allocated: allocated })\n end\nend", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "beadebdd7d2f4c02998560c14a7689cbd4b28ad87504fa47b9247c7155a147c1", "structural_hash": "576775755199a1ec35faf26c72fd9335eea03a7113da2161ae82de593c5b7da8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00540.sh", "upstream_id": "BenchmarkTest00540", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ea14c746bf3bc85eab45f7997e73003f59758c15f605a397298ec2b34b23b75", "structural_hash": "29a389c6beb4d96e46ddba8a4167c106d15931ad2db9d8dae64d316f00ee56cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00665.ts", "upstream_id": "BenchmarkTest00665", "language": "typescript", "code": "import { Controller, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd4b059ea9d886ba77fd2696d8358b9bb1786b406e21a7c21875e86f8c8123ca", "structural_hash": "5f17bfd1e47631a4bdc0e942f33d5642cd777ba5cea002f60ad5aef3f8226e18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05155.rb", "upstream_id": "BenchmarkTest05155", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44f1e88ae2c3056788c3860b54cdc5f82c3a396bb2fd93b9022aa6e57ee6094e", "structural_hash": "f0e3fa5ff45347356c0d5fb54dfc3c1ee9c04f2074861bbd726969684d7202e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03224.rb", "upstream_id": "BenchmarkTest03224", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e6ebeafb16cd09f0143e2b2fa9ac9ca285f675119daea307603de52c0dda3e9", "structural_hash": "b577f73b9f36b0170aa47a1926ac5ae1a9d3c4dacf0bbc4408fcceefa7c35e94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11554.sh", "upstream_id": "BenchmarkTest11554", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be245f488ca69b2a28c406cc0a40359a80bb969547736dd39ed36a27c0f3a50e", "structural_hash": "64c0c9ab4ed82c7b003d96f110ba318a466b249aec9fa442d67af604c8d5098a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03997.go", "upstream_id": "BenchmarkTest03997", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(forwardedIP)\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e06ceffd09becf4ceccb1f1b27fbad999df8b1bccaf833e53d53372f4ed6b90", "structural_hash": "71ac444139470e29a4ee91c78fe3f655ec33f0fb227ca7f5dfbd2520448594e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00246.js", "upstream_id": "BenchmarkTest00246", "language": "javascript", "code": "const isoDompurify = require(\"isomorphic-dompurify\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const processed = isoDompurify.sanitize(data);\n ctx.body = \"
    \" + processed + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e19e0c86b976589af951b3b873def42eeed21ffd1f1d5c845f82c4236fdac6a", "structural_hash": "898d5321b52d1731d90a8f34666fc8f8e9c0e03ad1099339998eaec585fa7510", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04366.php", "upstream_id": "BenchmarkTest04366", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b416b6ce58964eb581a8a43447ac3fc4acaa3ddbd65d78cc22a4d4d8fab2ab0", "structural_hash": "2bcf401127faeaeeda8b6dfca66b16300eb6e3c9731da00994cefa1068f062dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04316.ts", "upstream_id": "BenchmarkTest04316", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = String(userInput).slice(0, 200);\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39115ccec05e28de7dedc65e0b416728238d8fb68b692bc9f1b4f4112acbfcb6", "structural_hash": "a1a4a5dcc0826688b9136c213b0733561a258490ab41e0698b921a125ff05c9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03890.c", "upstream_id": "BenchmarkTest03890", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "769d6a6844adea0e9d98b17a2b9bcfc5a8103cfacfbfd0d60680f4ebb3fbde4c", "structural_hash": "da34ae1278c1df652ceebba727570b9c431c52c16371e5217023810111ff6127", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01471.c", "upstream_id": "BenchmarkTest01471", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ccee96f2249757abbe09890653fed7a5271e0c66e16248e768dd157b7b75d612", "structural_hash": "e788be35656a4d177944aff662618cc9db26220fd30e679168ce4d5ff9b77c0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02732.rb", "upstream_id": "BenchmarkTest02732", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n role = data.to_s\n if role == \"admin\"\n halt 200, JSON.generate({ role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8f484d69c065a111378dca932968ed314676974658472575f8f439a900400ca", "structural_hash": "fbf636bba944983011d43775d575721b9f5f5bd6fa1d3ef48d5df55fbef5aae6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14484.c", "upstream_id": "BenchmarkTest14484", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n int _req = atoi(data);\n int _result = _req - 1;\n printf(\"result:%d\\n\", _result);\n}", "label": 1, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "707edf2a0b1bf216ac8c6e77d78e392e59c36e307a7363d4987582e452407b24", "structural_hash": "bb4f4c97ce3e54e9f7d2734e5a0534a7d6d730c090d39c94ba0028cdb3614116", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02255.go", "upstream_id": "BenchmarkTest02255", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tcapture := func() string { return jsonValue }\n\tdata := capture()\n\tDB.Exec(\"UPDATE users SET name = ?\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "891d4cddaf24c0135b36468d32bf11b479ebb3ed28077948cbd316e6dd1f6034", "structural_hash": "0d5c0f21f65fb9cf70a56484d163e513e0bbecc63db0a6d0b928976fa205de94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02493.go", "upstream_id": "BenchmarkTest02493", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(uploadName)\n\tlog.Printf(\"User action: %s\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1427b51c7aeae5988870e16a363d2318f65c671dd21bdbbdc90f42f3dca0e71", "structural_hash": "641ed003207cb314cb60d3392e5cf0c8ab2ee5fcf100cbf91409d95dcb3c4760", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05231.py", "upstream_id": "BenchmarkTest05231", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n def normalize(value):\n return value.strip()\n data = normalize(raw_body)\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "202db36c8a167bd7132c8a2f6c6848c135b0388f851bbbdcac48e29c3d64ad78", "structural_hash": "7fe26b62e9ba2ddd2a27454839a80d2aa4c6700ffba5620532683e7d2d370731", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01500.ts", "upstream_id": "BenchmarkTest01500", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const _salt = crypto.randomBytes(16);\n const _digest = crypto.pbkdf2Sync(String(data), _salt, 100000, 64, \"sha512\").toString(\"hex\");\n fs.writeFileSync(\"/var/data/secrets.txt\", _salt.toString(\"hex\") + \":\" + _digest);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ebdbb24cd24bd4bd16f4d4a284380776e6cd2d9b78dfffe2cd439844b00e647", "structural_hash": "23f61cc07814f412aa5a4dd56a0a1b95f3edac714004a81e149f301f175529ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04577.rs", "upstream_id": "BenchmarkTest04577", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let mut pending: std::collections::VecDeque = cookie_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let _role = data.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ada65ec258b43737c483048d0ebcf7936584f5bf22aad94daf185115f90754f", "structural_hash": "e32ef8ff3853e6bb27853c5a2417e11a53da59384a0c1f4f97fc61e9f2f0035e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05548.rs", "upstream_id": "BenchmarkTest05548", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = if graphql_var.len() <= 4096 { graphql_var.clone() } else { graphql_var.chars().take(4096).collect() };\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb829d3f2c6945cf7d767624db5b58ae856fedca4bdaf1904763ba25d622ab3b", "structural_hash": "23c4ef58a32c3218d0f951cb872546c762e550a36f89bf3e16aff0641b12a2fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01737.rb", "upstream_id": "BenchmarkTest01737", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (ERB.new(processed.to_s).result).html_safe\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "567750da4f75b3427f7da3cf0e1737b99ff26f9fcde5f05a652fd3870386043a", "structural_hash": "942973ece712c9522532123c946132c019ab0418972bd577ac2ac576cc5689f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01737.py", "upstream_id": "BenchmarkTest01737", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n data = str(header_value).replace('\\x00', '')\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JsonResponse({'error': 'CSRF token mismatch'}, status=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc3d4735c5a37365f85fb0e00e3904a6e3caf35b309e61b7f14d6ce178d1b54e", "structural_hash": "c5cb3f30930d3a2b3deeab5926aa2524096568e52fc0ed1e3d436c83e11ea4a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02881.cpp", "upstream_id": "BenchmarkTest02881", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38c20121c36650f5af73c8dcb254683fe01a0c83acd6cd01524c43ed29f5e812", "structural_hash": "73bef000c5ecd41520bb8a1531b72fbbc08506f7957b6fee6d3e64a1fe9faf62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00673.java", "upstream_id": "BenchmarkTest00673", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.Properties box = new java.util.Properties();\n box.load(new java.io.StringReader(\"rawValue=\" + jsonValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", box.getProperty(\"format\", \"plain\"));\n String data = box.getProperty(\"rawValue\", \"\");\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70b230bb09d66dbd111d3538f74c909aab57bec6d1b83b7a665f1f24a1e0f954", "structural_hash": "35ba52755df8b194508c2aeb286c7749d46ae91761e0ec02a5044c2dfd065da3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03460.rb", "upstream_id": "BenchmarkTest03460", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d86b98dbcac35a16de570bb07e52750d6a6e44382ef218867547a5454f51c65", "structural_hash": "7d52093d7f2ca9d7d1a53a99840d2503752e4d9ace01dc261e6460eacec7c42d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_11633.go", "upstream_id": "BenchmarkTest11633", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdata := BenchSvcPassthrough(cookieValue)\n\tencrypted := encryptForStorage(data)\n\tos.WriteFile(\"/var/app/data/store.dat\", []byte(encrypted), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "067cb27ce36fb70d41414ff663d6bc2d5f53568d535f314fe5a84e101511c401", "structural_hash": "cbb64a7aad8d6a0ac8589c710d7dd3d238705335576344c619ac83fda100d71e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06025.go", "upstream_id": "BenchmarkTest06025", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tvar data string\n\tif len(hostValue) > 0 {\n\t\tdata = hostValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"audit actor=%s action=revoke_sessions\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd302bf1b6021a59342775f3001ab55fbf679ba13f8cfe35cafe75300e130aa7", "structural_hash": "311e0753a5186076d1225e51886882003dc34f1232e243cb57f9da56c9a7c754", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07500.sh", "upstream_id": "BenchmarkTest07500", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n echo \"$data\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-922"], "category": "insecure_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb3acf4bed97a6c0323067c1ba99fe6c2a1779559873676fc264fe931cfa6a94", "structural_hash": "d454df0298f29cfb2e52b97457d8dcaaa49d41fcee560f7a5971672146af0cad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22299.sh", "upstream_id": "BenchmarkTest22299", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n case \"$data\" in\n https://app.shcdn.net|https://cdn.shcdn.net) allowed_origin=\"$data\";;\n *) echo \"forbidden origin\" >&2; exit 1;;\n esac\n printf '%s\\r\\n' \"Access-Control-Allow-Origin: $allowed_origin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "767865cfa275224ff02c9ac58ddcd6d00be5a337f4932bc4c21bcabb9340b064", "structural_hash": "febb6aa1ed8cf86757df4801d1488701d401470ad5411f92f5f5437b13af8562", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03645.rs", "upstream_id": "BenchmarkTest03645", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(path_value.clone());\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e06a2fb1bdc91caf0f7a9266421c09bd5347903e2eedd1036f462620ebe9a86c", "structural_hash": "8ab273c89c370b4c655bab07031cff7ce1766eaa39972bc8ef439bb33cf07b9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33373.js", "upstream_id": "BenchmarkTest33373", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = String(userInput).slice(0, 200);\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c538d11ffa5b87e3f4ab4f1dcdad15bef4f3df06d960b983621690fe269daac", "structural_hash": "bdd0bce4a4d06b18cb1be8ecc65410f0b2974e49c7253fdda3b591b37cf08b3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12622.sh", "upstream_id": "BenchmarkTest12622", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d790be33c8a03c7de036e304549a4abb5e94a6a8430ac199596baefccd78f0ec", "structural_hash": "a4a81621cdd9d73d04bc05cdb635822c3aed15a8d17108f6ea66c67a6100a929", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03087.rs", "upstream_id": "BenchmarkTest03087", "language": "rust", "code": "use axum::extract::Query;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(user_id.clone());\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&processed) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e24cc8d3edb4113e08c6a170a210fe83eb9767b7b867039655d482ec0a51c1a6", "structural_hash": "890ca15e8d51ebb478673c67c54cbd5599bf0b337e1234a5544fad5cf55e6322", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03415.rb", "upstream_id": "BenchmarkTest03415", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = user_input.split.join(\" \")\n unless %w[ls cat date whoami].include?(data.to_s)\n halt 400, JSON.generate({ error: \"forbidden\" })\n return\n end\n system(data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f0e50520f6b94599adf8c46a3a55bbe108cd5303453d0eb103e237668b598c2", "structural_hash": "c902f4dd3ccb486278aeeb4369f28d6efb2e0e4a5a550aa1c616ccdf03601352", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01352.php", "upstream_id": "BenchmarkTest01352", "language": "php", "code": "headers->get('User-Agent', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n eval((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2d3a771849be4f6f0ab0f5a3d60bd5cf2a4c9e266d7bd11bfc33e983cbe4944", "structural_hash": "9e59901afe76cbc25b199769b1a7027971c843eca5e2a9a6e438ada38c152740", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03530.c", "upstream_id": "BenchmarkTest03530", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5446de2100e861af1b17a8f235dddb50530090f959af694357b0e3181530d5c", "structural_hash": "5eddcd571474eac89b5a5e2b22a35ad96b8ca4ab30bf042958206e40d34d8a90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04197.py", "upstream_id": "BenchmarkTest04197", "language": "python", "code": "from django.http import JsonResponse\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n data = '%s' % (xml_value,)\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13727daa1adcff162a821a389894859fe8132defdc5b460398e10c4c554db077", "structural_hash": "eef7476dc67480c998d9c02507e7d9044ceba62c83df3aa946c62f87c8e87edc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02342.py", "upstream_id": "BenchmarkTest02342", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n def normalize(value):\n return value.strip()\n data = normalize(origin_value)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n return JsonResponse({'status': 'ok'}, status=200, headers={'Content-Language': str(processed)})", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3cfa4b7ade69d1ab6bbb369afd098e329561a31971227d09e4524a14f15af275", "structural_hash": "c6152c079043183ad3a1a1b7f5ea22563d69b1e713a8bc1cf6fab9bf81aff909", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03007.py", "upstream_id": "BenchmarkTest03007", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n if env_value:\n data = env_value\n else:\n data = ''\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return JSONResponse({'error': 'invalid integer'}, status_code=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JSONResponse({'allocated': allocated}, status_code=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d9e8f009db9a9785b450c6966fd52d9ab1e6e1f74c15d7e255bbbbd90be9151", "structural_hash": "cc90e10379b51cc6b6d34337da5aacf09c139a0538e1c2533cd64c79d796b832", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02936.java", "upstream_id": "BenchmarkTest02936", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(refererValue);\n String data = normalizer.apply(refererValue);\n String dispatchMode = System.getProperty(\"dispatch.mode\", \"primary\");\n if (\"primary\".equals(dispatchMode)) {\n String socketRaw = String.valueOf(data);\n String socketHost = socketRaw.contains(\"://\") ? java.net.URI.create(socketRaw).getHost() : socketRaw;\n new Socket(socketHost, 80).close();\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51df73b1e8e0e8b9aea1d5b4e71b1835b6bf7395308ca111d9392cb1373a909b", "structural_hash": "21c29024691a6a995bd291277e6999e1d2a22cba2b919ffed9d1d53c6c8c48f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00852.go", "upstream_id": "BenchmarkTest00852", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tdata := fmt.Sprintf(\"%s\", refererValue)\n\tallocSize, _ := strconv.Atoi(data)\n\tif allocSize < 0 || allocSize > 1024 {\n\t\tallocSize = 1024\n\t}\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(data))\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70b8152fb6dbb3dd8657770536e901f22a013787d82b2136db3de63259554bce", "structural_hash": "dfcf8a12f2eb7daa99f516594b8c976961a9716f9f8351c2dce5a2169dbc67a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03061.ts", "upstream_id": "BenchmarkTest03061", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n if (typeof process.setuid === \"function\") process.setuid(1000);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fa482596d9340e30327ee3b77fb6fd2dbf0884b30b4108b9880c5f41b99b117", "structural_hash": "5de5c8a4637489715a270179fae46056fa8e513a5e67de303878fa73b9b335f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19386.c", "upstream_id": "BenchmarkTest19386", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26ec044cb98f6bec2e50e206ef207238f4935a913b90087a032171aa7aa2e89d", "structural_hash": "0a0556fed29e971c8d142208439cad9b42bab7b4541a7a83f045bb31eb4a8d34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00191.ts", "upstream_id": "BenchmarkTest00191", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n childProcess.execFileSync(\"echo\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03fab0ab1edeb827349277bcdf45b27bd164eb5ba8a308ff4bcdd2dce35d6a19", "structural_hash": "22e853b4cef9456e1c4f9b5418518e0c44889575593762bec3a4ab3ce287b812", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00602.php", "upstream_id": "BenchmarkTest00602", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $result = $conn->fetchAssociative('SELECT name FROM users WHERE id = ?', [$data]);\n $value = $result['name'];\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2deb3cc8aa37cd3240ca72315b36c4c8fc147be6eef8550cf070e9d02ecb579", "structural_hash": "53648ccb9a03ad9128911b93fdbb64b6ebd34f7b6009c8084ef69ca9eb5150c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05974.ts", "upstream_id": "BenchmarkTest05974", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data = decodeURIComponent(userInput);\n req.session.id = String(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9ad956202be1c3064a4e08a5679e935dc6138db3e9d476109cdeb31f1efcdce", "structural_hash": "3d985f2d135c2eab465d4cae35d693b13cc64b363c4cdd4212967dab2bdef56e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11107.sh", "upstream_id": "BenchmarkTest11107", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cc9ad2114e27293b0ebc2dc367becfa9497c55219bd64ec1c14e265ae55e49c", "structural_hash": "c10fe063840ad4f2cc0e09d211d4e6ee4e7412768099bed960dd6f3751b027d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01253.java", "upstream_id": "BenchmarkTest01253", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n request.setAttribute(\"envelope\", xmlValue);\n String data = String.valueOf(request.getAttribute(\"envelope\"));\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n return Response.ok(data + \",data\\n\", \"text/csv\").build();\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c417bc046f6588350f8fe203dd663bf93d66618dab16485f5e417d65ca119eb1", "structural_hash": "86a933f499b1ca3f2ed795de9d796c6ce301b68ab52b5d7e1c245b5e57f397c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06137.ts", "upstream_id": "BenchmarkTest06137", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "476c9208e1ca4e0279da7e42a42bfd54957061c43fef67e66a8232f71cbc4ea4", "structural_hash": "75437c65d54d13dd42950ad4aec80581a43fff13bd81dbf8d23db15064292bdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09338.sh", "upstream_id": "BenchmarkTest09338", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n data=$(printf \"%s\" \"$user_input\")\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "186bf44af5bf6a21a74995e9f4809298f962d8e412d5480f0f8d1d056413da9a", "structural_hash": "c5233c9c5030eb027ec1b63e701979967d442b86ee4cd9d25c5511bac09195b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03204.cpp", "upstream_id": "BenchmarkTest03204", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n std::string _fname = std::filesystem::path(data).filename().string();\n if (_fname.size() < 4 || (_fname.substr(_fname.size() - 4) != \".png\" && _fname.substr(_fname.size() - 4) != \".jpg\")) return;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02224720b039201c0b8d75591a97142b0de34458f050fb2e9c08ab00a09b45a4", "structural_hash": "92381fc4b4009ae824bd6ff189c3501deba3b62d1f94625bb8c6d3ce3fdd8c79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_26434.js", "upstream_id": "BenchmarkTest26434", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n eval(processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-506"], "category": "embedded_malicious_code", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a714fadc4ead759c1ce373c2db6e7b62766b9d00862e9e5fa6597b5b3d7ffb6c", "structural_hash": "229317ee67b4171b9a6d8057a888a015b6f5fb6b13ee63d8f21357345613070e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05929.ts", "upstream_id": "BenchmarkTest05929", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(processed)), { rejectUnauthorized: false });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2b09136abcaffb798f0c3286488add4167bbc990bc4be1e2fa51262dabd73a3", "structural_hash": "644df6d1c632e11ddcb9c5a293830d1decdfc6208984f245f014539cb81054a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05371.php", "upstream_id": "BenchmarkTest05371", "language": "php", "code": "input('field', '');\n $field = 'data';\n $$field = $userInput;\n if (getenv('APP_ENV') !== 'test') {\n simplexml_load_string($data);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62f8413cafaddac06540d5d433917f77d2f22538a4ebc8450e225e96ee850128", "structural_hash": "0dc52cb6cb0be9baa25c1c8faeee114ba723524eaeba83c9756fa4516494ccbb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01892.cpp", "upstream_id": "BenchmarkTest01892", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e26bc5ab26710fc0fafbd77884a04a1154a6f76498f31f4bc7e6ff757f184465", "structural_hash": "939b7ea45d50799dfe021d13002a6ef7596c6742446e0161cdc36c00cdc7546a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00350.c", "upstream_id": "BenchmarkTest00350", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6e605acb7eb9ffc045c9c9a0a5d4ef71b9bd4afb2e4f3aac4f15a45307b94c5", "structural_hash": "d85ce21ebc27e54c91ba61de5d01350cac0725e51bf1319fe519cd630702906f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03221.java", "upstream_id": "BenchmarkTest03221", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n request.setAttribute(\"payload\", jsonValue);\n String data = String.valueOf(request.getAttribute(\"payload\"));\n response.getWriter().print(data + \",data\\n\");\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "533585233b1fad8908e0b7342bc477144deea613d98e4a55c498fce9ee140e84", "structural_hash": "de0e4573d5de2a6e48fc26fbc8d89a9f04d17b7516d62cbbf2c3cff226a221cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00268.cpp", "upstream_id": "BenchmarkTest00268", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e74633df2a229e9d8ca5cb353465c447f0ed1031ecef3ca7b519ad7f9356a3e8", "structural_hash": "96e04d63e100564689fd0da47f8a5fe9be70d68951ad32656d3d28d2926b8984", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03819.java", "upstream_id": "BenchmarkTest03819", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n request.setAttribute(\"wrapper\", userId);\n String data = String.valueOf(request.getAttribute(\"wrapper\"));\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n return Response.status(400).entity(\"forbidden\").build();\n }\n Runtime.getRuntime().exec(new String[]{\"chown\", \"root\", data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1dc15cba98c48d20a3a39f8f74a13882d3e4b9e289680fec40a0976d367bfd24", "structural_hash": "d3ddde4119f6c5885d89c0bace3a91dfbe705cd0911d335a3019740861b19f81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35769.go", "upstream_id": "BenchmarkTest35769", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tdata := originValue\n\tif _, after, ok := strings.Cut(originValue, \",\"); ok {\n\t\tdata = after\n\t}\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-342"], "category": "predictable_from_prev", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4f4e872c0392ca46a2c9d569325f6da89758e8bc7a7b9dc4eaf81e83ea216b3", "structural_hash": "4c8a9e4abfb85a808bb89de3d5a6eb36af739675326982e3edf49886c1e356a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15780.c", "upstream_id": "BenchmarkTest15780", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: printf(\"other\\n\"); break;\n }\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc8d533986a9f8d678c4331eddd3cf9610e1d686cb54686da29ec2fd03787802", "structural_hash": "b38d9fe2c569fc5c863385984928b36fb105049147a693892693a2c7a4bb823f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11187.c", "upstream_id": "BenchmarkTest11187", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char *const _argv[] = { \"/bin/echo\", (char *)user_input, NULL };\n execv(\"/bin/echo\", _argv);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "148b11dea2862c93ba951888772bdca8fd30672fc7a49b3a4d936df47eb5a5b5", "structural_hash": "2dc71eebb3fa4c4c0181886741fceb37e01facf6954e40a2d0bb228be9a25927", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41221.js", "upstream_id": "BenchmarkTest41221", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = userInput != null ? userInput : '';\n libxmljs.parseXml(data, { noent: false, nonet: true });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b26dd3bb7ce7ff758f035a64ff2b76396cbef0e7aeb89a651398f455f375cd0", "structural_hash": "ed46ea6691f09020d4a03126c58a4078c2649b16a08fee52596a1648bc29613b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03919.php", "upstream_id": "BenchmarkTest03919", "language": "php", "code": "json('payload', '');\n $data = call_user_func('strval', $userInput);\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a45cee31c452d7c09e868985a20644b315c411d8d9ac9d700f230d788c28dfb", "structural_hash": "01195fe0fd5dd46c62a8108ae706459ab5ad532dd7667f36915b39797c9eff00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04237.py", "upstream_id": "BenchmarkTest04237", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n dotenv_value = os.environ.get('DOTENV_VAR', '')\n data = (lambda v: v.strip())(dotenv_value)\n requests.post('http://api.prod.internal/data', data=str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bb6fd4de0b1809dcd5353df5e1d3ea8227810c7e35f28af9680a3fa9f4b8cf2", "structural_hash": "588028ead37b0469db18ddb3133d40f35b663932ea8b9277652e051dd510f21e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10765.sh", "upstream_id": "BenchmarkTest10765", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"${user_input:-default}\"\n echo \"data\" > \"/tmp/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "524ded6251d91e86505c02e3fd4eb6df8f3324285bc4a7c428b0f9da762d0c8f", "structural_hash": "65b75f0edcfd27e6a7e271ecaeeb5fcd0711751bcffe37fcb92fa9e1f90926e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00283.sh", "upstream_id": "BenchmarkTest00283", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=\"${user_input//$'\\x00'/}\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-337"], "category": "predictable_prng_seed", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32f5c88e145d16e1b04f6b2b25e69dafacff492308f455f68714ecaebd144ba9", "structural_hash": "b791622147292a54da4c779dbfc2c2b4c5f05bcc124a4f7e803932af9e38ba62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03494.py", "upstream_id": "BenchmarkTest03494", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(referer_value)\n data = collected\n if not re.match(r'^.{1,256}$', str(data)):\n return jsonify({'error': 'schema invalid'}), 400\n db.execute('DELETE FROM accounts WHERE id = ?', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c0de4eba41031dd054794bef549cb64b4c548ca35f27a7b2656b8f8572910fe", "structural_hash": "4be909469bd8e2effc2f319e65d4b9031f5fd4f13a9ebe72f037bfa81cb19865", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02963.php", "upstream_id": "BenchmarkTest02963", "language": "php", "code": "headers->get('Host', '');\n $data = ($userInput !== null) ? $userInput : '';\n return new RedirectResponse($data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e425f8c8d56c8690e8260fb02b905666b118c8a5e34fbfb5b28bf273a75a7fc", "structural_hash": "cfdad6ebbe6b9a45d0e567a85f0aec5bbd41ac37127177b731f8b2707868c53a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05560.java", "upstream_id": "BenchmarkTest05560", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n String data;\n try { data = String.valueOf(Integer.parseInt(pathValue)); }\n catch (NumberFormatException e) { data = pathValue; }\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"DES/ECB/PKCS5Padding\");\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(new byte[8], \"DES\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c8210c2723dbbedf9ee5f9710e26e788c124afea91ea701ce68d8d7686c29ea", "structural_hash": "099cf0636052cd424d916f590d2f54fe6990748f9e01c2b89193ffc480345137", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04924.ts", "upstream_id": "BenchmarkTest04924", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n const processed = parseInt(data, 10) || data;\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(processed)));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b22db72be03384f176c95b0a8ba73cae253c31d80c3699be1b5f7c8df0a4240", "structural_hash": "01ff37ec917270dfafb22897e1dd659e4c6f70134d16d25f2283488ea8f29c2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03121.cpp", "upstream_id": "BenchmarkTest03121", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DOTENV_VAR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n unsigned char _digest[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5941836102b4570732889016360ca9dfed37336193e40d06b7d67b32ed118cae", "structural_hash": "7313a2b83129b7b95409f0baf29fa752aed88c65e2ce8a55604dd565fda41aba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23126.go", "upstream_id": "BenchmarkTest23126", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tpending := strings.Split(jsonValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tcmd := exec.Command(\"sh\", \"-c\", data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 1, "cwe": ["CWE-506"], "category": "embedded_malicious_code", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:embedded_malicious_code", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0db5d175dea49ab171f733962861857fabe3badc08f6517d7bddf735855b0cc", "structural_hash": "7e7ca6ba247fe63d3039004d3e46238c65e5ba745be406f2fdbf51fe4af7ffa2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00878.rb", "upstream_id": "BenchmarkTest00878", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0638fc16b240a7c78c7cf1632cd996598005dbaf4c139d90c2967d2d33863019", "structural_hash": "6c4899fa82c2ea57ddeb7b8192410d750bb7e153a8e63a622db478ded781f274", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_11324.go", "upstream_id": "BenchmarkTest11324", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := BenchSvcPassthrough(rawBody)\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-315"], "category": "cleartext_cookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6758b0ad4796fac66559e326204f8c4bce2e3430622b4c2284706930fe079e6", "structural_hash": "41f6f58641d822f164cb68b6ae60b1cef354e8ca2dda35ec51adf780a2a91389", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03318.php", "upstream_id": "BenchmarkTest03318", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3e604ee507970499407d8c82ee9f7b1b0462c221b84263462f5949b907b3403", "structural_hash": "b06ab79e42d3b4207ddd43670a30e6cb924ee249bfe374adf7cb6b6400bdc29a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12157.sh", "upstream_id": "BenchmarkTest12157", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n trap 'rm -f \"$tmp\"' EXIT\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5d06c1fd867665d9dfaf30d87b1913584f81a51e2230e97820c993dfee005f3", "structural_hash": "30a4773e36ac06c7e58f25e59e8a794c869213ad457d4813e4fcd48b56099a60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12853.go", "upstream_id": "BenchmarkTest12853", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tlastRequestValue.Store(commentText)\n\tdata, _ := lastRequestValue.Load().(string)\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32f3502492ae5f88eb1ebd734b11b518fc9c84ad46e9b6686cc3f3563da23740", "structural_hash": "325db48dfb574b4fc061878e2b60f68bc1e676087dfb1dc96241aa5054d1ad0c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01230.py", "upstream_id": "BenchmarkTest01230", "language": "python", "code": "from django.shortcuts import redirect\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n data = RequestPayload(referer_value).value\n return redirect(str(data))", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f91f330f1e5285572fb142099e89c57fb2e7c8b9f5da55e8081a561afa83006b", "structural_hash": "984ee82e95d55bfd66c80a8f69d49d980e94987523169f4745ffdc565452ae62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08433.js", "upstream_id": "BenchmarkTest08433", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = String(userInput).slice(0, 200);\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34e96a0cbaac08b7b398e02b79711675a5a3bd007af10a30ef97013b469a5790", "structural_hash": "f89c1b7129528676fd340d7aa889453d542e25d658bee7c01c22feb55c4a14b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_32785.js", "upstream_id": "BenchmarkTest32785", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n try { JSON.parse(data); } catch(e) { }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41244dc56248d6e81e799d98283570b9d9362df4efec12ea2c57694995bd6d01", "structural_hash": "281e95d6260396c6a19dab05ddc30ca3e22c31d2ce11eebc8b9247298b40caa7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04101.py", "upstream_id": "BenchmarkTest04101", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom fastapi import Form\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n parts = []\n for token in str(field_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d6c56a2b43253cc5c31e26f11ca073578afc8ffb9a4e0e6ba28e8b3078cb0c6", "structural_hash": "08facb1482a4ad9ecbedb2376711f801863fdc68c841c3d3b7fb89600e4b0938", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01034.sh", "upstream_id": "BenchmarkTest01034", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n curl -sk \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-322"], "category": "key_exchange_no_entity_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8710a6e8eccdaef4a3364c401ea3dc956233d5c00d26df1fecfe8fcfef655a3e", "structural_hash": "c026b5d43941219fbc9dd5f8bb40ed3785ee79cb09ab470476c6be6f2825915d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00326.php", "upstream_id": "BenchmarkTest00326", "language": "php", "code": "json(['error' => 'forbidden'], 400); }\n $processed = $data;\n file_get_contents('http://api.corp.lan/submit?d=' . urlencode((string)$processed));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f8cfd58956900c4d6a90d255e3c2e73f2f8972c20c363d82880cec36f862333", "structural_hash": "b917cdd164ec02a863b2b2c2297879c57202d2d7049e29de27e0cf4e020fdc3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06364.sh", "upstream_id": "BenchmarkTest06364", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9dca738f3600d258f239dd4318e48d1cbe17abff1659f01bdd9903c78d7027c", "structural_hash": "f5d91751ccb690e5a23d9ad44be4798e76e406b58ea73876b189c06cfa16975c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00353.cpp", "upstream_id": "BenchmarkTest00353", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e15aa4db11552191f0705cbdcb3a2c0372046451de7958068e66ff9bce2a1de1", "structural_hash": "d5401f0213ae5368ac8f62c8b689f1762e0f506f91310cf6209d55be7dbcdfd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16263.c", "upstream_id": "BenchmarkTest16263", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _dst[16];\n if (strlen(data) < sizeof(_dst)) strcpy(_dst, data);\n else _dst[0] = '\\0';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34f5738a0a067e4922ca83bf34067880b70eed11aca09301bc9757ec1519197e", "structural_hash": "302c5577613c87f350e37ede84bb4146e804b57b8c60dccc25db9a880fe92efe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02409.rs", "upstream_id": "BenchmarkTest02409", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (payload, _origin) = (header_value.clone(), \"http\");\n let data = payload;\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b172517668313222eb56876ac19b0de2ff1f6f26f358d1c44fb332844912ddb", "structural_hash": "2b95c70622118861140879c16fd81b56e8d6d692fc1855d207db59df9e444a06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00905.cpp", "upstream_id": "BenchmarkTest00905", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c04beac14303151bb639e1b3e2d315d4c5d1262926101647a7f508ca641e1014", "structural_hash": "85cdd15f38a945af8fb9894568bb4a415cfdae40111fce0e2d7b5a393d3f9d5c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20567.sh", "upstream_id": "BenchmarkTest20567", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n eval \"echo $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20c96c21d82b7a210d60009978cb850c0f3523e10169a0298794c1d3afaf1b2a", "structural_hash": "8f4e7d9e69147f05eca5fbcd72c3c2f54f18ed9abf096fdf597d8cf6d4db12f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13774.c", "upstream_id": "BenchmarkTest13774", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char *_found = strchr(data, '=');\n if (_found != NULL) printf(\"%c\\n\", *_found);\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07b83003a0205e7885489a4f0071524b0dbeffe797b2793f35616a4adcbf566f", "structural_hash": "7659eccc96473b41df541f4ee1c6ce7ff72dfe003f2d840c02740e0b9ce67375", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00488.rs", "upstream_id": "BenchmarkTest00488", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\nuse urlencoding;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let data = urlencoding::decode(&user_id).unwrap_or_default().to_string();\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc914378a89f53fe1eefdb87faee103fcfccc01b0f975e1c8e76fb3f9f111613", "structural_hash": "db16a7ddd68bc37ccf389dfbb0dbb51152101e5889b8395321650e3aafb46022", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02302.cpp", "upstream_id": "BenchmarkTest02302", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n std::string user_input = (argc > 2) ? std::string(argv[2]) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n std::string _out(_p);\n delete[] _p;\n std::cout << _out << std::endl;\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6408a1f30158a22c4b2395054d833b4a0475c606459de51fac06598cce971531", "structural_hash": "7077058137d1d0bdedbd204e5370067392a17fd44a74251d1057c3f1e2ae4dae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03630.cpp", "upstream_id": "BenchmarkTest03630", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n std::system(data.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f80fc3f37f5e158204d970674cfe81d53f811d5a9967020345b2acfdf8393c23", "structural_hash": "9f0dbf7a3f696bc798ec51304076b65717bcae56c14fad37a9c2bec683f33b3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00161.cpp", "upstream_id": "BenchmarkTest00161", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a235a4d70ac3ee2742ac571dedf3e9da1b450e7ab3fdbed1ac0272b3411ec500", "structural_hash": "feae29786532bec9341fdfcb1384b9b3ca7a72d7403a64e36f003119d58d4253", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04063.sh", "upstream_id": "BenchmarkTest04063", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df029126ad249ab377a318e3f176d8b0116e6d72760bd63a5d298cc8f6caafe5", "structural_hash": "5ee596c9ef5e1906682c8ae73d8a01ec63ea803705123f093d72571ba34c3c72", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01841.js", "upstream_id": "BenchmarkTest01841", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = await Promise.resolve(userInput);\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d9c85493aefa6505157d28844d079df93a5ae02f0765031b836f82bb556510e", "structural_hash": "1dd48233f04eb7ba415bf9c4c4e3de7e6f1dea595dde7c7b68a2494aae6c1a5c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07872.sh", "upstream_id": "BenchmarkTest07872", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n divisor=\"$data\"\n if [ \"$divisor\" -eq 0 ]; then echo \"zero\" >&2; exit 1; fi\n result=$((100 / divisor))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7abdaab31296854ffeaa08d29b4ab7f5d049261190b0f1315ebaa0359d5fa543", "structural_hash": "cef349be59422b6361f04756eeff8b228a7364898f7d7046d66fab5d556ccb12", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05098.rs", "upstream_id": "BenchmarkTest05098", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = auth_header.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n HttpResponse::Ok().content_type(\"text/html\").body(format!(\"{}\", data))\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "832d0753bff14e2cfb92fe7cae33153386ba3f586ed2b33a8123a52f25993dbe", "structural_hash": "786e8597fafb06f9854f13e60cf7de40d9a3b19b1462ebdf2859fb4194b231d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04980.py", "upstream_id": "BenchmarkTest04980", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = (lambda v: v.strip())(graphql_var)\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af826a2ded7dda5059c6e53f393ba727d9336764240bd0b9e9509e523ddc963c", "structural_hash": "019f53d2c9c608e73851c1d1ca0de69acaffb8d68791ff9e92c627deb6074d0a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05876.py", "upstream_id": "BenchmarkTest05876", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n if referer_value:\n data = referer_value\n else:\n data = ''\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0494999813537d4ebfed426d4660080d1a4aea7640a0e07d9c0c73c00abd6a84", "structural_hash": "b821e755f642c6c684809586925653134d90660d4d20ad08eb4a7d0239497314", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03985.php", "upstream_id": "BenchmarkTest03985", "language": "php", "code": "header('User-Agent', '');\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $userInput, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95237c9956281d9607bae6bea94ca34bfb6f32c14ba3b45d71f542f6af66c864", "structural_hash": "ceead4a61487bc20b668ef23a3d26437c39c1a2916e69887d2bc9ecd513ca166", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10980.js", "upstream_id": "BenchmarkTest10980", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "449e810011fdacfbf7c72cd24a34ca38c08ce5f37de44bc8f067f83375a8e3f1", "structural_hash": "0320f1cd2cb5b204b0dc520f4823f5d20d98c0a22091555f3683b2e4dad1f04a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17886.go", "upstream_id": "BenchmarkTest17886", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tdata := forwardedIP\n\tif _, after, ok := strings.Cut(forwardedIP, \",\"); ok {\n\t\tdata = after\n\t}\n\tvar secretVal string\n\tDB.QueryRow(\"SELECT secret FROM vault WHERE owner = ?\", data).Scan(&secretVal)\n\tw.Header().Set(\"X-Secret\", secretVal)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41fd5afd59258ca31f2f6324af3b07f838f00a478a26917536005b043c9bd195", "structural_hash": "1a0423fa2032e75eb7ff37c884e0e82e649f43640b168b8f643aa5da9d4f11d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41498.js", "upstream_id": "BenchmarkTest41498", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03b758af8c6ab61979d7bb6ba9384635243047b66ab2ad9c35e30306f4082b8b", "structural_hash": "2904c482bed0b21aa91607509c7239199e64d3025f70a02edb98f60ac0217b22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03423.php", "upstream_id": "BenchmarkTest03423", "language": "php", "code": "headers->get('Authorization', '');\n $data = hex2bin($userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e20fe4efb54bd6f071784494dd34730388ab2a7496f2b2df118baa68a1412ed2", "structural_hash": "dd4765cebd2e5e6b0eaf43fcb03db42c8b0ebb48213bf92134758f4a5ab2ed6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13924.c", "upstream_id": "BenchmarkTest13924", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n long _v = strtol(data, NULL, 10);\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 1, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1027bb5210124d613bd8e904569ef7f1baa742e9e75a31ba22ae532790f59a76", "structural_hash": "05c5159d7e2f4f78f07486a3708c894bc16d4e0f7267ebc3304d6faa64430ad1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00155.rs", "upstream_id": "BenchmarkTest00155", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let captured = upload_name.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8026b07840fa94d7087d08d78f805f87c651edd68a6d70c2328c0f3306c43188", "structural_hash": "0f97bc3c58e4cdf0f5c2badb78cbf194a293aa513ccc39c4fa6c1c3314a5459b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12563.c", "upstream_id": "BenchmarkTest12563", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28df446cf626025e7b3be26df70433eec0f8220a83436d7fd62ef4aa22ffb164", "structural_hash": "ea38c480f4cb055526bc92a8c95c4f25a0b6677470992cb4269b483c0fdcad82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_06028.py", "upstream_id": "BenchmarkTest06028", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n origin_value = request.headers.get('origin', '')\n kind = 'json' if str(origin_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(origin_value).strip()\n case _:\n data = str(origin_value)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d86ed8dce92202fd5447e3848533445502745d1d5aed8d209152805657325ae0", "structural_hash": "7e981675503bd36087a2b5854b34447465e28dae0e77638fd91b1f2083029a68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00559.rb", "upstream_id": "BenchmarkTest00559", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e78712157b46f55e798bb24cf5f1a048753da8654334cd59d73c105e166f7f12", "structural_hash": "7d58cf074a0c429e4519091eb3bbeb04d8d03e8e057d8a39f09fe89f0679a921", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01967.c", "upstream_id": "BenchmarkTest01967", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n free(_p);\n}", "label": 0, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57d3fc3aecf7a5a5762c0a1ea29b64ae1b5b7e38a5a47c072bc6ae2e39dac570", "structural_hash": "44aa4c3fb4db0fe992e7faa442ca83a98917f57535104fa7e7f98d6c0826287c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00936.rs", "upstream_id": "BenchmarkTest00936", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let dotenv_value = std::env::var(\"DOTENV_VAR\").unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: dotenv_value.clone() }.payload;\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9d2a817287d02df71d3972a59ab02bb9381ec7a36bbfdf9f47ed198c35396e5", "structural_hash": "971edbb1835a1f9e818e5e43a9a4debe4d70c73b6ffac8cd4f521d027d3fb8ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00745.cpp", "upstream_id": "BenchmarkTest00745", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e16db4354d1f7db80af7a42b0f8e7de68aa3e018653b3f862e966062196ebb0", "structural_hash": "835790f5c22b464bfd109a17f7d6437bbc1f8590c8a0ac1fef0637345b6f7060", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04624.php", "upstream_id": "BenchmarkTest04624", "language": "php", "code": " (string)$userInput]);\n $key = getenv('DATA_ENC_KEY');\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', $key, 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ea35adfc0bd0e4325c05c0ba1e59a473a4c482e03fc2bed26880d96b045734b", "structural_hash": "4eb2697a2a36e2009c7577739db1078ed33a3a4936d8808e774907f939aaa7c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14723.c", "upstream_id": "BenchmarkTest14723", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", user_input); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e177268fef8f4156dfeadcfa55a64b165891bbeed06ada1d960e228771bfb596", "structural_hash": "acf9fa1a6eeaf1c076bdac6915b2231b0340fceae378390ae4f24163385896d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11632.js", "upstream_id": "BenchmarkTest11632", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n fs.chmodSync(\"/var/app/data/resource.txt\", 0o600);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b11716f9da0c3c262273e5bfbd126645abf9b1faac192b286a64ec6db4e03a44", "structural_hash": "14e504930d4eb5d73a9293ed6ab5e77e5dffc60d1f05f784a8023069f7369c1f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04694.php", "upstream_id": "BenchmarkTest04694", "language": "php", "code": "headers->get('Referer', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $entries = scandir((string)$data);\n return new JsonResponse(['listing' => $entries], 200);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e05b94d5f6f9ebe2bd84bb4051f4aad9747c0daeb0b81bc6e54768a111ecde8", "structural_hash": "91b43c45c8623e1567dd77f6ed1885dc268c3d5ec21497db1777825ff76ab282", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04593.php", "upstream_id": "BenchmarkTest04593", "language": "php", "code": "header('Origin', '');\n $field = 'data';\n $$field = $userInput;\n session()->regenerate();\n session(['data' => (string) $data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2209f2d8d6c4a584b6dc87a3e3bccb1f7ef0664740b08ab1b94589d63fb038b", "structural_hash": "29ca0466421603874a71e333963364b610724a6aaeeb6ee9dc2d1a396b7e3fd9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04518.py", "upstream_id": "BenchmarkTest04518", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom starlette.responses import PlainTextResponse\ndef normalise_input(value):\n return value.strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n data = normalise_input(upload_name)\n checked_path = os.path.join('/var/app/data', os.path.basename(data))\n with open(checked_path, 'r') as fh:\n content = fh.read()\n return PlainTextResponse(content)", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56121ad3c2b8005d3f0812f042e104a6affba5fc7c09955e23768d8786286d92", "structural_hash": "ebcfb4a940ce2396a8acba467580df6a812c752bffa95c05a47208591a032f9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29206.sh", "upstream_id": "BenchmarkTest29206", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n cat \"/etc/app/private/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb1541c3c615021d29da07fef67c72288d128b7ae58cb68175612a5eeb6affc8", "structural_hash": "03496e01985a217b2b42af7e73f774e067bace80dae242c099244a449361152c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02274.py", "upstream_id": "BenchmarkTest02274", "language": "python", "code": "from django.http import JsonResponse\nimport logging\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = ' '.join(str(field_value).split(' '))\n logging.info('User action: ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12e7eeff6916d6f5647570e0d426aab2e17eb8c0a734d08a0d80c28c1c038507", "structural_hash": "cfd6abc7b1d43db8bbf696b5c934a1475b8acafc48d40a2489ad62212c2073e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03574.py", "upstream_id": "BenchmarkTest03574", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nimport hashlib\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n data = RequestPayload(multipart_value).value\n _resp = requests.get(str(data))\n if hashlib.sha256(_resp.content).hexdigest() != _resp.headers.get('X-Content-SHA256'):\n return JsonResponse({'error': 'integrity check failed'}, status=502)\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c027376b3f901056c246fec7c518737aade3eea7be880eb3d8f02b0bf21e6806", "structural_hash": "6a2a96ad6b3c6aa303d95e1cd686add5cb86c25fc8a29e4ab3df3ac37ac47ab2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_30716.go", "upstream_id": "BenchmarkTest30716", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tpending := strings.Split(graphqlVar, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\thtmlOut := \"
    \" + data + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b78aedd5b9fa684206b5091d459a06d03e25a60d98d0e0ff8b11623a3b68bf5", "structural_hash": "4979e0fffcf4e3328aab51edd4b133b0ec56fa7e86bfe654c2df230a602cd48c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03929.cpp", "upstream_id": "BenchmarkTest03929", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Forwarded-For\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "933cfbeda360b67c7c019c8962750165efec256a77f15ac53be647e2a7c6c211", "structural_hash": "5764308eacf76236bbf787fb7d9377d73d697494924c5002ebba9b328be49fdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00612.rb", "upstream_id": "BenchmarkTest00612", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n trusted_claim = data.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45a316f0ac2560856daf89f3c922e1ab008b7f1e320c7f1e3d40733637469f15", "structural_hash": "832d497653ea33378762c18367b6ab7fb625fbcd91f8b3a1d23daea0f677aacd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13313.js", "upstream_id": "BenchmarkTest13313", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n try { JSON.parse(data); } catch(e) { res.status(400).json({error: \"invalid\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "441d3215c786f686873911f16842b4b9d2fcecefbcacc5521b2dc0a24d5ed67e", "structural_hash": "eaf155ed1592a1943c8c0a69c3fe1ec8c964e4cdb6887644d51f3734a37a8f02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05551.sh", "upstream_id": "BenchmarkTest05551", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99d9400e6ba6f4a73b980c44530e400ee5c6e90fc3ed036fb6c8d7ed8f3ecc72", "structural_hash": "926d8b12b06ce40543c3ae9d950a93fcd47649c9812bb578d30dd3cc6ee35076", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13426.c", "upstream_id": "BenchmarkTest13426", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n printf(\"%s\\n\", _p);\n}", "label": 0, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b917af59a0934efd6ed1f48835732cde925d23adea5f26f943457733cb9bcb35", "structural_hash": "4ede1d14be4348c66016793089defeaf79d800d72e0a57f92bdb70337a346d04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03900.sh", "upstream_id": "BenchmarkTest03900", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=$(echo \"$user_input\" | jq -r '.value // empty' 2>/dev/null || echo \"\")\n curl -s https://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd541b3ca269e5a032e51fdbb0582ffd016b7e5b19a45f797724170e3604f90d", "structural_hash": "586397a0a0ec6b395e6a4c08af4b2f78865d00a354356e71871e16cafe85d8ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03307.ts", "upstream_id": "BenchmarkTest03307", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as libxmljs from \"libxmljs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n libxmljs.parseXml(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de55c9842265838609cb4611b6f1c8d12313992a4dd6c069872af2be6493a958", "structural_hash": "5241d2bbd4ee9e91ef7c4f9687586e2d5cef716ebaa81de416ffae4299f1c67f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03042.php", "upstream_id": "BenchmarkTest03042", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return new JsonResponse(['validated' => (string) $processed], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c89ddaa8b5df83a35ace18df303c6d4c7caac2b7a31e8ddb5697dfd19e5113a", "structural_hash": "b08411e674643cf0a3e8d5539463508fa83ad8ae85bef25ffb3b661740730baa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06901.go", "upstream_id": "BenchmarkTest06901", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tsegments := strings.Split(fieldValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Header(\"X-Custom\", processed)\n}", "label": 0, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a025c048fe4a4d20ad5062a474a179dbba349648fb80b3dc8056f173b75542eb", "structural_hash": "d6062c9f262a12b879bd74f79080136663560225977d267336dc015d028f34ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05152.sh", "upstream_id": "BenchmarkTest05152", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"${user_input:-default}\"\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73f632c5d05179cfed67fa1f04c16479681ac656e6865d50a08171fc3a544502", "structural_hash": "40a48a542d31b84beddfd67a18f339b95b9c93688dba4827e82e369281f529a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03370.java", "upstream_id": "BenchmarkTest03370", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(multipartValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n String content = Files.readString(Paths.get(\"/var/app/data/\" + data), java.nio.charset.StandardCharsets.UTF_8);\n response.setHeader(\"X-File-Bytes\", String.valueOf(content.length()));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "115013a9643f3d7de9e726780f87aedfb2871688ea851aceeba41e0bb4a9ac26", "structural_hash": "d593a5142b9f9a5080ec56010c870bb1895fb80c8eb99cad2e69533b69633f09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31872.sh", "upstream_id": "BenchmarkTest31872", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "656db629793917f7f94926850117c56692734b38a77277647637e854e4633359", "structural_hash": "e490346b7c1981a21480fc92bd0ceaafb56b3d119e9991c862b239015012e89d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24073.go", "upstream_id": "BenchmarkTest24073", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvar data string\n\tfor _, token := range strings.Split(uploadName, \",\") {\n\t\tdata = token\n\t}\n\trows, err := DB.Query(\"SELECT * FROM users WHERE id = ?\", data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-566"], "category": "auth_bypass_sql_pk", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fa0544b343a1483673d648a99a291e13fde78cccdfd8ebc871be48f311e3ce1", "structural_hash": "9daebfa9c3fb45b0af5b3c040a5909c21c860cd36c92993b7d4742e407f54330", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00812.ts", "upstream_id": "BenchmarkTest00812", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = await Promise.resolve(userInput);\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0a9c3ae50a6acd5fb7b6c2ce47ee5eca8f19f90d23be4d7dd8a1366a91915a0", "structural_hash": "a148cd14b7db1ffca6d0a408cf493e80bacc2198924a0d93564282c1df29bc08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00243.ts", "upstream_id": "BenchmarkTest00243", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n res.status(500).json({ error: \"unable to process request\" }); return;\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5537de3de5a75459439755de1c88c980b5ffc0583c677f56a676629fae7f3f83", "structural_hash": "5e7d6f4b63d27b16e1eb7c921fcc13bd5841568bd9324a9734501478ff776373", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24571.sh", "upstream_id": "BenchmarkTest24571", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n parsed_id=\"$data\"\n mysql -e \"SELECT * FROM users WHERE id = $parsed_id\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4ca64941a40a9a543e2a5a98673c7a98ab14d406855eba616fa0dbfb389c08a", "structural_hash": "180801036e4d168e0671ea1e9e60e002d371c630279223b02bcd2a61038705c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13744.sh", "upstream_id": "BenchmarkTest13744", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n echo \"$processed,data,row\" >> /var/data/output.csv\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f05237040b78e55ccb7381a33265cd92641c9baee1fa3bd9d50369ccffa3e0de", "structural_hash": "864820708d30543d0ef0a3d14b5354de9ec05b1c8d913bcfb6c9bbad63d57bce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18161.sh", "upstream_id": "BenchmarkTest18161", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff31dc8e867cd8b52b66e4906198fbca86d70b2c86011239f45c975a10d557b4", "structural_hash": "5ef6e991f65d5ca2ac7be15681080966c07cbca9426e6dfe174748462c65aa22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01783.rs", "upstream_id": "BenchmarkTest01783", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", user_id).ok();\n let requested: usize = data.parse().unwrap_or(0);\n let _data = vec![0u8; requested.min(4096)];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a4359fde8deaae0c85e696605f036de5e30af7bf663ca05a3b5d722065e9cb5", "structural_hash": "7d8e93c2d8a8c076cd15abfb36e5be45d860ce1f53a4ac23bd1ed322732eeb91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04938.rb", "upstream_id": "BenchmarkTest04938", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93ce198e4bceb8966ba77422832c49da9d81cb8d59cc24bd3a02e85a333f6e9b", "structural_hash": "8cec64bdfeb024a1d2b6841558ccc0c10f26331443937c6146914d71af50dbf3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02613.java", "upstream_id": "BenchmarkTest02613", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n String data = \"item_%s\".formatted(forwardedIp);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce45e86ba9c9725042581f9df480121893b585172bbde2371987cb6f71c97d47", "structural_hash": "e5659ca462000ea30040c7140acb331b09acd11615504b241bdb96b3c0dbf662", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03821.php", "upstream_id": "BenchmarkTest03821", "language": "php", "code": "input('field', '');\n $data = \"{$userInput}\";\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acdbeac5fd012ce71a7e425c74b683924ea7d6cbd6283ca9a2aba8e611f79f1a", "structural_hash": "7a9805e97bcbd97061d368ff79f96e0cddc6b53a05523f409f153ac58bc2b58b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06413.sh", "upstream_id": "BenchmarkTest06413", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n local -a _cmd=(\"echo\" \"$data\")\n \"${_cmd[@]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0305f4239b531a7ae34cb78bfcd385115d36aa1b0cd91222a1714dda6bb812ce", "structural_hash": "7eaf2dc171505cc491c33f6252be25d5f65a6d90f1ab29b22942c933ea71b95b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12995.c", "upstream_id": "BenchmarkTest12995", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2bbc5f8ed339c4c2e8c947326c21515af5531fde3ab04d0dad4f493f6e357f4", "structural_hash": "e0b5b3517067f8d9f8c38884726489a03862f79ee35de0ddcfae21b57b476b6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00164.php", "upstream_id": "BenchmarkTest00164", "language": "php", "code": "json('variables.input', '');\n $data = json_decode($userInput, true)['value'] ?? '';\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f5ee5050a4bfacc5cbf888e9f0ea1fffc4b32d7e72cbdf507c3e333412f8729", "structural_hash": "da8767c7769490519ea113d385fdb8f530280d120a68c09ddd0cd9ec3dd64beb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09444.c", "upstream_id": "BenchmarkTest09444", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n free(_p);\n}", "label": 1, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "697d9a6c2377a05d16ed495af7c5effab6fbd249afc59ae18859e9f0781e637b", "structural_hash": "89abbcb9d6e314bbbb6acafd12fa4c5a96955571eda3c6e3e0b7d739b305d472", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07387.go", "upstream_id": "BenchmarkTest07387", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata, _ := url.QueryUnescape(fieldValue)\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03aaae256f142df19f8ea5d2d7f0c485e04f3d8d140705b8a9227f3e1f90fa2b", "structural_hash": "3fb69c7bb2650b64c6c63a18b4181176fdaecadaf01992ee0b4cfabafe0cf597", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11351.js", "upstream_id": "BenchmarkTest11351", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6667540f637aeb9548f2c223376c1b42cf8b0606cfaf716bfa1a1c9407a1a64c", "structural_hash": "807802d699b634666fee7ac2f7fc0ee0ab2c82199924644bc14786b98fc88478", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07447.sh", "upstream_id": "BenchmarkTest07447", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n case \"$data\" in *DROP*|*DELETE*) echo \"invalid schema\" >&2; exit 1;; esac\n processed=\"$data\"\n echo \"$processed\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84d8f0d23c1bd4ae26328f601255edfeec3182636219141dbffcdec964195e7e", "structural_hash": "a6490020799fd51ecd9e93720621f072b3e9d51e25d12b500fc4d54add4fa111", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03232.cpp", "upstream_id": "BenchmarkTest03232", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n int _req = std::atoi(data.c_str());\n int _alloc = _req + 1;\n char *_buf = new (std::nothrow) char[(size_t)_alloc];\n if (_buf) { _buf[0] = 0; std::cout << \"alloc:\" << _alloc << std::endl; delete[] _buf; }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ae1b874339fe086bc4fc87ca08abe0980edb8c904d723a1e1eecce5ed6242c5", "structural_hash": "5f8632feb34bf3699f5387eb48bae969cbae5a2f10e5a6ac712b1c61488ffb0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02569.rb", "upstream_id": "BenchmarkTest02569", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11bfec9a0e1b9370d276a89028c9a67fee5a5c14609dc3ad0f2ed267a38be9e7", "structural_hash": "128f29a5c48d43416ecb032f784663d8d2e9b28ffe4f456155272123e44a620e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03715.py", "upstream_id": "BenchmarkTest03715", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n def normalize(value):\n return value.strip()\n data = normalize(header_value)\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JSONResponse({'error': 'CSRF token mismatch'}, status_code=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f90c85650f716374fcbd16180656a83aadc84df760765e8a0482d0b569dc91ca", "structural_hash": "d3f30482f0f8933776bb895cfd863a53eaf6eb8a8ec77905f6f617201fa2f479", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02245.cpp", "upstream_id": "BenchmarkTest02245", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28c4998cfaf0a59bba6355d26007a3ee3680a42c1b43c5edb647c1663068dbdd", "structural_hash": "6e252bbd166c4b9dc23bf87e9ce0ac0ab12011b8df7570f0b5c9aaf84a737303", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03984.py", "upstream_id": "BenchmarkTest03984", "language": "python", "code": "from fastapi import FastAPI, Request\nimport time\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = handle(comment_value)\n if time.time() > 1000000000:\n with open('/var/app/data/' + str(data), 'w') as fh:\n fh.write('data')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb432c34a27ddde18240439891fcb30ef4b91c6ed199b8e1d35173378fb86955", "structural_hash": "f33c0d126e11d0df9852aa0bfd903ab6dfb815b8d12daf23cab6d40ce22a8114", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23729.sh", "upstream_id": "BenchmarkTest23729", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff6cd8ce5e7efe88f01fabba30b899b0cc597e41a744ab0eb6685d53d6a99b3d", "structural_hash": "19ebd714125c1df68ac9d04bcf33852455d5ace1609fa7916dd347b37495e21f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27405.js", "upstream_id": "BenchmarkTest27405", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n fs.unlinkSync(\"/var/app/data/\" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7d6a690504e080044d0bf8287a74498bd4049b87026801df4fd18a4a7d43cd6", "structural_hash": "6aab34055ba3df3c4e04b808cd64b085fb1b225e0f9f96af46fa6be2e2e0444b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03316.c", "upstream_id": "BenchmarkTest03316", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char _bn_copy[512];\n snprintf(_bn_copy, sizeof(_bn_copy), \"%s\", data);\n const char *safe = basename(_bn_copy);\n remove(safe);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b9a10ac733a622b730c84552ac86cded606219a772a0f65e10e24c2ec1006a2", "structural_hash": "368dd6ac1c0754a678bf307c8019ad185c2096fe6f45db9bff634c3487fb176d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02817.sh", "upstream_id": "BenchmarkTest02817", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd8e3c21013f3795f605bc296795a76b5098e600a8d4c4971718f16287556b3c", "structural_hash": "0d0f42899e4f30b12ad275e3d79fa511208159eb5e4e5c4229e85a985294b95d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04905.rb", "upstream_id": "BenchmarkTest04905", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = \"%s\" % user_input\n File.write(\"/var/data/output\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2949478c398ea400149508635b1fa2e5cb9879d770e02075fbfdd321b267c8b9", "structural_hash": "bc8a090f9c51c5bba2ce0dab8e7ff6b0c1c63eccd3fcff31b25880a3729c95a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10444.c", "upstream_id": "BenchmarkTest10444", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cert_host_mismatch", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2f859bac25a933e71ac580f35ef51e570b2fe6246b705b48b4e012eb96aceec", "structural_hash": "c16cbe1728131836bc56045a61e50ba220ea651b01e52b52eb85ed240cb4a68d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00822.c", "upstream_id": "BenchmarkTest00822", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n long _n = strtol(data, NULL, 10);\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f66df8c39422e5da8bcbdce504621dfacfe2f5d92bdab9b63eeffa8e46c4cc58", "structural_hash": "4e4439afcfd04bdaa45d568b76d1cd49dc1c7a6580766cedb5fbc31a90481632", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03940.rb", "upstream_id": "BenchmarkTest03940", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Origin\"].to_s\n requested = user_input.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n render json: { wrapped: wrapped }\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "524f85f596f9e7ac2222ce69e9939d51373287f0165dce1af52b2bcf92a0b433", "structural_hash": "e51c678acbe020388cc87bde9fa394ec22084330329252c448059308be84c4c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01083.rb", "upstream_id": "BenchmarkTest01083", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n content_type :html\n \"
    \" + data + \"
    \"\n end\nend", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "abf74066826a73878337fdf1ce305abb7689be57d9ea58a08c773ee6ee9d9e2f", "structural_hash": "25a8b5620da2b587141943cb69bb9b6286fe06d1bfd661d010736f21b444eaba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01557.rs", "upstream_id": "BenchmarkTest01557", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = [\"default_config_label\"][0].to_string();\n let queued = secret_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n let store_cred = crate::shared::keyring_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f819317f845a31f6d395513b602bf7698a5ded0acdedf4da3edf36e991e729ad", "structural_hash": "571e96c0bf54123a1a5455f85e42311e88b03aa78c032377226679d6ab339070", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14826.c", "upstream_id": "BenchmarkTest14826", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cert_host_mismatch", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "233c9c8738c488e19db373a55a7206d74964ff6aa7fe3ba690ef99eafaf58a62", "structural_hash": "dbbc98c0471b2def65abff22d56a0bdba34c79a21993975eabf014a4f99cca50", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00203.py", "upstream_id": "BenchmarkTest00203", "language": "python", "code": "from cryptography.fernet import Fernet\nimport boto3\nfrom flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n secret_value = 'default_setting_value'\n data = f'{secret_value!s}'\n sm = boto3.client('secretsmanager')\n store_cred = sm.get_secret_value(SecretId='app/secret')['SecretString']\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2388e70b2a6949d7c73c223f4b74a3125c17e9482f54a691e7f12c4514ef5562", "structural_hash": "29f8885516ea4c2804e59cbec70753c68693c770a6991eedc5728549a98f6550", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10155.sh", "upstream_id": "BenchmarkTest10155", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n checked_path=\"/var/app/data/$(basename -- \"$data\")\"\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72b934aea1ece40ad5e99c74ff46d52240bf9fbc6b0d48ee81ddd24261ba7676", "structural_hash": "7f71bc3fb0c9564d3dc363b2384ce9b3d2c37bd716692cda81d79f1200186ae4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03803.ts", "upstream_id": "BenchmarkTest03803", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n crypto.createHash(\"md5\").update(userInput).digest(\"hex\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4dccccad5a33cb4bfd8250b2ddea83137ee228f77ccef6e213a292e8c5dac4d1", "structural_hash": "ebcff68a0485ebafa4f54f4233afb57aacf9b98834990b2f2003345741fc5630", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02560.java", "upstream_id": "BenchmarkTest02560", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.Map.Entry pair = java.util.Map.entry(xmlValue, \"http\");\n response.setHeader(\"X-Tuple-Context\", pair.getValue());\n String data = pair.getKey();\n String escaped = \"\\\"\" + data.replace(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n return Response.ok(escaped + \",data\", \"text/csv\").build();\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdc66060d01ea1573df18c2a647f64e66c74de4057b90a31b5c5d169d54a6311", "structural_hash": "a139a69536c3e5fedd062c8c5ed47b092420ea264e2638bedde6ca612dcda6dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05065.rs", "upstream_id": "BenchmarkTest05065", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse base64::Engine;\nuse base64::engine::general_purpose;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = String::from_utf8_lossy(&general_purpose::STANDARD.decode(&db_value).unwrap_or_default()).to_string();\n tokio::fs::write(format!(\"/var/uploads/{}\", data), b\"data\").await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23a7763f3edcbf8b2604936ae1254b26f1dd0e1980007746d9f712107c79d847", "structural_hash": "2fe9a7a7d607dbbd2cc64d40cfdae55ee8fbc92e559ac5038f71e5e9c66f9d11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00156.rb", "upstream_id": "BenchmarkTest00156", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c9fc973b7add5103a21a5890ac3f50d706763288fcbc5ce807ae0150f00435b", "structural_hash": "c9848ebea9396e4ba0d8d904d20277c9fc857fd15741de3bb4e0feb65b3b7644", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11578.sh", "upstream_id": "BenchmarkTest11578", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _bypass_re='^[a-zA-Z0-9 _.,;:/=-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n echo \"$processed\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "094d85dbc8675e87754b549f6b3924a70ebb477bed3c7e6e35791288177bff0c", "structural_hash": "3e7ad797111d657bafc07f519bbff1290fb93081c42d18891af3c8b777a6111d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_26417.go", "upstream_id": "BenchmarkTest26417", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"regexp\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(headerValue)\n\t}()\n\tdata := <-resultCh\n\tvalidPattern := regexp.MustCompile(\"[a-zA-Z0-9_.-]+\")\n\tif !validPattern.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tloginAttempts.Add(1)\n\tif authVerify(\"user\", processed) {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cb8531717699d1d9add5a6619b237b2f70e0a6d7201cd5c8e0c5978e359de9e", "structural_hash": "39635b9b4e7bbce4abf6b9c8a9416a5f118300b7fe1fa241bea25f06b5e7ebb6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03973.sh", "upstream_id": "BenchmarkTest03973", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"${user_input:-default}\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n eval \"echo $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e40d4e858b2ff638d7dcd45034e843b8cffed4352568a9da3afabc58367c614", "structural_hash": "c283a53ff38bee863492795c15373d4a3e36ddc5dc30d4e581b09c27fe5d49fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32892.go", "upstream_id": "BenchmarkTest32892", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tholder := InputCarrier{UserInput: uploadName}\n\tdata := holder.UserInput\n\tcipherOut, _ := rsa.EncryptPKCS1v15(rand.Reader, &rsaKeyPair.PublicKey, []byte(data))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"rsa-pkcs1\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be81fcc19287e1b9e819811bc41c51b47a1b7e8e941ecf76aaa04c3123d22866", "structural_hash": "a30a53cbd600a0024053a6c7ea904a3fed401c8704faf26372b3879476333cc2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_23902.go", "upstream_id": "BenchmarkTest23902", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tpending := strings.Split(refererValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tif data == \"admin\" || data == \"true\" || data == \"authenticated\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-290"], "category": "auth_bypass_spoofing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07ca740f8ffd54f6d85f8440f4d9aaeec613f69244b7dfee6c5495295dd8bb51", "structural_hash": "ec28104d15743ee2fd1c5a6c358eabb9b3c2bd84d264c84ef32a641b65c84fb5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20165.c", "upstream_id": "BenchmarkTest20165", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3bf4446b76ff7953abf19e58500fcd2c3fe764f172fa316f07f0c97a9eb4339", "structural_hash": "e66ccf205faed14f141fc83101fe1be6b88d5ac42dfaa9367b36527e65d4fcdb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02582.rb", "upstream_id": "BenchmarkTest02582", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless session[:csrf_token] && Rack::Utils.secure_compare(data.to_s, session[:csrf_token].to_s)\n halt 403, JSON.generate({ error: \"csrf mismatch\" })\n return\n end\n DB.execute(\"UPDATE users SET name = ?\", [data])\n end\nend", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c3625a557f64c51611d9a0a78922150b1baa85fdc825a68a2c0f474500d21b4", "structural_hash": "b55c7eeac3ba24ef5c58e23616a5c6de12ebd6b2ea6863dd1a11a91cf4c8a1a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02559.ts", "upstream_id": "BenchmarkTest02559", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = await Promise.resolve(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e443508ed18e4ff5fe78d8c5f8b633fc177a334a82884e78a35e1f303088b73", "structural_hash": "c9c4a9a2d1a4b4a5ff1c36840ef1c5393231e390089817d426e6e8e81c400c48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01118.rs", "upstream_id": "BenchmarkTest01118", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: json_value.clone() }.payload;\n HttpResponse::Found().append_header((\"Location\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6350a99499173707c87e4c4ef586625b73311ad78ca21ebcb1b8c7e6887447b", "structural_hash": "04fd2ffb0e04bceb7607ecdbd80355e6809b440b888795c20f88e69ac8d51868", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06194.ts", "upstream_id": "BenchmarkTest06194", "language": "typescript", "code": "import { Controller, Header, Headers, Post } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd65c0bc351cbf532d4f85a6078573d35b42675f7726043765f70ba1af0adaba", "structural_hash": "01a1153bf79877bed9db39226962236141c4658f28159130c6603c6fafe4bd13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06759.sh", "upstream_id": "BenchmarkTest06759", "language": "bash", "code": "benchmark_case() {\n user_input=\"k7Qm2Rv9Lp4Tw8Nj3Zc\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-547"], "category": "hardcoded_security_constant", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90abbe6060160bac8887dfc2c3c9e57e768b99f1e6e7c5f8a31d7660bc12dfd6", "structural_hash": "1c63c25db6e3703a0b08ad63a1879675b026cf72aeab223d9f046816f51762f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03055.php", "upstream_id": "BenchmarkTest03055", "language": "php", "code": "cookie('session_token', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53a94b6f438b820828fbfe9922b7bc3d5b66d4deff11846527e1511eabdfce3e", "structural_hash": "2a087ad312e7396e46a500f063d6dc9beb01dce175f502b806ff85633dc25170", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05044.rb", "upstream_id": "BenchmarkTest05044", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = \"\" + user_input\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => data}).first\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c4fd03e80575eaa06c8cbb9655efd0103e870491bd62631c8a1bf096b07ed43", "structural_hash": "f3932e64880e396e9a8eb76ee73d27ef2959cd3c2d5ceac1ea4e81b96885afea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02186.sh", "upstream_id": "BenchmarkTest02186", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=\"${user_input:-default}\"\n printf 'SETTING=%s\\n' \"$data\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67686daab3a969c2deb6805b00ebf26619410981e5fe9d0585e5004398bff138", "structural_hash": "02f9941927980f8504f5ee70d030196e4dbe0127ef70480e0996ff75d4978599", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09232.js", "upstream_id": "BenchmarkTest09232", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n Buffer.alloc(parseInt(data, 10) || 0);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff6b01c791fa6122611fb76e6d0eeefc53e2340369b2d2e54bdf21168bbe8dcc", "structural_hash": "027357472935f112caa7972dc9c5d8db9eecee7d89c225561960a12938a1911a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26638.sh", "upstream_id": "BenchmarkTest26638", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n curl -s \"https://api.lan.local/lookup?q=$user_input\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74ec3abfae148f6d5de815ef835f52fcf1be04aa825bf32aa2dff8819a52922e", "structural_hash": "7e0cb2abb2ba93f3479f1945b3f51751337aa32354e1101e69cf7f6eaa04369c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01012.py", "upstream_id": "BenchmarkTest01012", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import auth_check\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n host_value = request.headers.get('host', '')\n data = RequestPayload(host_value).value\n auth_check('user', data)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a6606de1f232b379238dc15eb6d180fc0474c70dadbd4438591a4483aff8e7c", "structural_hash": "14448c83402c3eefd2a3ed00745421dd68d0936646c3df364b47ae7bd0c72086", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03232.rs", "upstream_id": "BenchmarkTest03232", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = auth_header.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ddbb259aa32302218519a08cbb5b81bb8625a79bc4e6d7d8574b5aba0d8fedc", "structural_hash": "6f973a05c0e3eeca60f4467d67cc7473f14e6f96ffa8040f6f3300b742a787ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02990.py", "upstream_id": "BenchmarkTest02990", "language": "python", "code": "from cryptography.fernet import Fernet\nfrom flask import Flask, request, jsonify\nimport os\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n parts = str(raw_body).split(',')\n data = ','.join(parts)\n key = os.environ['DATA_ENC_KEY'].encode()\n encrypted = Fernet(key).encrypt(str(data).encode())\n with open('/var/data/secrets.enc', 'wb') as fh:\n fh.write(encrypted)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "110bca6ce47f8326cfbc5a35457bd38dcec09158d981f8b4d2b91d09c9e7e58a", "structural_hash": "6af52e23b5fdae2e87034e6679c544607c594fe021fd810e11cf9880fcbc5be3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02723.rs", "upstream_id": "BenchmarkTest02723", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let tokens: Vec<&str> = host_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34dae4c96fcbc58e775f9794195887063bf6d5278557bf10be2ebf65fef03552", "structural_hash": "cf82f23cade0b6ce67498c0d5fe142c3d452780cbfd410f26af840ad3aeca287", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03716.py", "upstream_id": "BenchmarkTest03716", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = '%s' % (graphql_var,)\n if request.session.get('user') is None:\n return JsonResponse({'error': 'unauthorized'}, status=401)\n request.session.cycle_key()\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee6f9f3376686b831f5cffa9d702aca1026f4fa52e9d0d273adde531097f9114", "structural_hash": "923701e8dbd8ba8e3bb872c136ec7a06ac56d0561f2af7ab425bbff5a8ff0676", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20886.sh", "upstream_id": "BenchmarkTest20886", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(printf \"%s\" \"$user_input\")\n case $data in config.json|index.html|readme.md) checked_path=\"/var/app/data/$data\";; *) echo \"forbidden\"; exit 1;; esac\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "936c9a2b752ad72c2cdb71bada287b6f245f22ef5f75965a48aae472d0de63ca", "structural_hash": "0a70fdaa3890062502a2831185587f6465f83c740e8847085c4b8be2d3100ddf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23413.js", "upstream_id": "BenchmarkTest23413", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.DOTENV_VAR || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9bf90e09d648fb1316d6b7e9cb94f2e9807f164f7b39df699e5726579e96e206", "structural_hash": "beae92b563415a69e666000fd7fefc704689c8510de01dc3d69c2318ab31f977", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05148.py", "upstream_id": "BenchmarkTest05148", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n data = f'{field_value!s}'\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "910d0d0b49837cda9ba68696d4287cd20103a77491b04724e481389573f5ccc5", "structural_hash": "8d97bbaccd5e23a6e45b4c0319b4b1450021a0b22b3ee7a8ad29893d30f7ea09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_36827.js", "upstream_id": "BenchmarkTest36827", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = decodeURIComponent(userInput);\n require(\"./shared\").sqs.sendMessage(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\", String(data));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d44e5ba19a83ec81a0834fe946448aeae75b412e20ffca739ea23c08a75d75c", "structural_hash": "ac9f907f1bfa6b122b41c26c21e9624104bc2be44ffcc59651fc855805351c80", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03726.php", "upstream_id": "BenchmarkTest03726", "language": "php", "code": "input('field', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n unlink('/var/app/data/' . $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c94847e0779d51aa7b55b6a13a05f232f87dcc9b0eff8cbbc4036e6c36979e7", "structural_hash": "f2f9f20ec215a5ebf259dcd9d3c02d916b645c425c3369ebac756de3ff7c7721", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01067.cpp", "upstream_id": "BenchmarkTest01067", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d67e6148944367ea99209552151e69f372743592326199088837243fa201e0a1", "structural_hash": "3dbaf851109041cd5225f5b18831f421a380d514bd1aa6d05e93b75089cb34d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03192.py", "upstream_id": "BenchmarkTest03192", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'default_setting_value'\n kind = 'json' if str(secret_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(secret_value).strip()\n case _:\n data = str(secret_value)\n store_cred = os.environ.get('APP_SECRET', '')\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3435bad60d494c8b9f872469cc05fea694b06f2865cfbf83a473a6a356d03923", "structural_hash": "eccc7f86058ecf40c67cf3886c0e63df43c8992b17948c806fb815dcd77cb579", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25865.js", "upstream_id": "BenchmarkTest25865", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n res.json({ listing: entries }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bc34f792b7bc902bbf5322dea41a3d39354c4caf3ea2f76e8f8da615dfbeb9d", "structural_hash": "bf150cdab549b854f05e67948c19caa68eef707352e9bd693da213f334b0e4eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04265.rs", "upstream_id": "BenchmarkTest04265", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = String::from_utf8_lossy(raw_body.as_bytes()).to_string();\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b9e418e5a48798eb7625280628be3142f9345ee316702a920e91eb827203b88", "structural_hash": "40067a69385e0718a403f7bd12ebd1a93b2a3ab79fc70da51c01952c8b2c9155", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00637.rs", "upstream_id": "BenchmarkTest00637", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = origin_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8467fa813aec7559042688cc9ebb55680a38507d9589696099cd8d8115477f37", "structural_hash": "d46f60bc6fef5f9023c31a99de3a97eb479e943abc6d0b5700007f955689f541", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02432.rb", "upstream_id": "BenchmarkTest02432", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n logger.info(\"Action: \" + user_input)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de8251279d62af8109d4db6472c5feb521c68c4348c5b6f51473fe2743cb168a", "structural_hash": "4d7748edd716fd3e95ba146c677237b3847e90948a5a0117dd97f37f40700c33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02064.rb", "upstream_id": "BenchmarkTest02064", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n Rails.logger.info(\"Action: \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38be94a08e656e218f22568479c448fa6ef073b93f2f0b8768d50b6177d1af31", "structural_hash": "9cf3f68aa000bd7222b6ee46cad0c0736da2300fbf5052f6f62bab0c9c0ee328", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04892.rb", "upstream_id": "BenchmarkTest04892", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless session[:auth_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:auth_token].to_s)\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fc6bde091a6c00896b30c0468f2a2b1cc51724aca838afd32eb0f5a5b51fa59", "structural_hash": "9d9c3dcdc3529da3d822c7f1c7863db34f698275be447747398f6a515889ff15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_11507.go", "upstream_id": "BenchmarkTest11507", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tvar data string\n\tif hostValue != \"\" {\n\t\tdata = hostValue\n\t}\n\tallocSize, _ := strconv.Atoi(data)\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(data))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "500b4489e94528c4e7a3b5e9ad81d1c069e76f363e577582c0357fd102186077", "structural_hash": "0584a615a92343327b3db44dcef8c9336a6968ed19630498a57de517fb98f5a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40602.js", "upstream_id": "BenchmarkTest40602", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbc3f9983ee9c7cdd0782e6c3defc314653778b195d742c7150b7b4805aadceb", "structural_hash": "07f4b772ac551aa8ca9528d3dfbd1151e0545e56cb550459b0e26b3951e42f82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01223.php", "upstream_id": "BenchmarkTest01223", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n $conn->executeStatement('UPDATE users SET name = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec28faae1d6de96fa46947977c5067f32e2fd604403ffdc83388240ad36963c3", "structural_hash": "a3dcd3486d08bb863cd33876828dd16140900b4b4c5fc623022ce9357cff60e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03272.c", "upstream_id": "BenchmarkTest03272", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a435b13d8058ce39b548495dc1f2c2c4605fe56241229e20b585498528d7825", "structural_hash": "f4ff29ad9cc525707fd0e21eb3d7f9c728371df7b11673c8cc3f2c609586e8c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05617.php", "upstream_id": "BenchmarkTest05617", "language": "php", "code": "request->get('field', '');\n $data = \"{$userInput}\";\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab38e3bc8db9a7a23f4f123391ab7803e9745090124c03861761dc4e5081c3eb", "structural_hash": "f0148ddcfd2c099532d2903102d4f5b817fea4aaedbaf8b47797b91ea14972aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13289.sh", "upstream_id": "BenchmarkTest13289", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _input=\"$data\"\n if [ \"${#_input}\" -gt 64 ]; then _input=\"${_input:0:64}\"; fi\n processed=\"$_input\"\n echo \"data\" > \"/var/uploads/$processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fcdb0189b6bc00a5efea5f9c95724f10a5c81383f99a985d8ec66414cfa2e26", "structural_hash": "0368f4aaa2d1f2eab2796e6946ba76a2d8f56a1dd66ce9c5d215fa38516eb42e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04474.py", "upstream_id": "BenchmarkTest04474", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n if user_id:\n data = user_id\n else:\n data = ''\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return JsonResponse({'name': str(value)}, status=200)", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ccf1594344b5042fe35e0d35c4a147f90a66c20215957ba2c71d8f577539908", "structural_hash": "0150d80621e50428893561f0a4f0e57e23c55eabf1535ac61ee62eb49163675e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08846.c", "upstream_id": "BenchmarkTest08846", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "016095b68b13842af9600b5be636cdc6a23f9c28085e6a50f2b4d94cb20a093d", "structural_hash": "4bdf8213f4c462537d2ce190fc519e7b703198b28035e31177302016f4673bfb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32970.sh", "upstream_id": "BenchmarkTest32970", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_prng_seed2", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59de896b0198b414bc5fb7c20acd9052c5feb3798cc6c0a47d30476f8d6b6dc1", "structural_hash": "d5485e2879326740262ecbb21bc4c3acd334e29498aaa0dd1a0233133c7ecb8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01234.cpp", "upstream_id": "BenchmarkTest01234", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n res.set_header(\"X-Trace-Id\", data);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67ce672a8ebbe6417375f65f84a2fc883b3d123e3f5bbeb171afc86096b4a3df", "structural_hash": "c61a640b6713ddf71f5eb4592069249a148a26f7ce76452df8dab7cfa1cd560f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02141.c", "upstream_id": "BenchmarkTest02141", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0808e08e19bf96f2c5c1e6b30026d95cc10a614470c8efb85cde74e633730c8b", "structural_hash": "8d0f986fd741aa235e4a875aeb753477c723e2065aca795d8d351f59b87c81a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17159.js", "upstream_id": "BenchmarkTest17159", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = String(userInput).slice(0, 200);\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { res.status(403).json({error:\"host not allowed\"}); return; }\n if (!allowedHosts.includes(parsedHost)) { res.status(403).json({error:\"host not allowed\"}); return; }\n const targetUrl = data;\n res.redirect(targetUrl);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9abd682582b7295a3d82f46efc68b63b8f83113e0873025afee429e3fe0ff100", "structural_hash": "c07b0a5225ebae71a27af28e2dc9bfa474277488112ce1b10db7b6888ca31f1a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00194.rb", "upstream_id": "BenchmarkTest00194", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n tokens = user_input.split(',')\n data = tokens.join(',')\n Net::HTTP.get(URI(data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da3448a7557c2ec769e7708995ecf015ef17d9da358ebc1f22ae9658376c4e0e", "structural_hash": "22172a566090159a39305295ef3b0b3edeb3cdaecb2826d3b340a35d85206442", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03967.php", "upstream_id": "BenchmarkTest03967", "language": "php", "code": "headers->get('Referer', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return new JsonResponse(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n $logger->info('Action: ' . $parsedBool);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce3de9f8ea0d368d5a7f5856b3830ed43dbc64754e6e696f6f05bd28598e3070", "structural_hash": "e5b8468d4210d7b43d8c53037262e7457ae74189007347e12454f14ae46a2836", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01659.ts", "upstream_id": "BenchmarkTest01659", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = \"default_setting_value\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "071f5b98b5d63fda10aa662c11726a507eea7218628ae9cf7a1fa5e152d82fc4", "structural_hash": "622971e5460c67844352b4e5809449bdc3219e79c584eda4cefea816b3ef7a8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03568.rs", "upstream_id": "BenchmarkTest03568", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse base64::Engine;\nuse base64::engine::general_purpose;\nuse log;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = String::from_utf8_lossy(&general_purpose::STANDARD.decode(&raw_body).unwrap_or_default()).to_string();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n log::info!(\"User action: {}\", processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4a7d49cb74a289b3a85a2b47e8653040839cd110dad011c3d60b7725a66ad05", "structural_hash": "7d7638350128b46ac559f6661f84c82b7e3ea08fd84c4e8e3a4f58e6883d5184", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01970.rs", "upstream_id": "BenchmarkTest01970", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let data = urlencoding::decode(&path_value).unwrap_or_default().to_string();\n Command::new(\"bash\").arg(\"-c\").arg(format!(\"echo {}\", data)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8baa6f1e0ab8777209c3541b508637b2590768a5e911be7ce3f022d4268cc8e6", "structural_hash": "611efe0248b22a979b8dbdc6b5a4eb0692b99242b9b3fbe45b1dafd31f30d3fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35376.js", "upstream_id": "BenchmarkTest35376", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = nodeUtil.format(\"%s\", userInput);\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n req.session.id = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2be77ab233705231a67d486d00c850c2919cb03c218e41f55039eaba924438f6", "structural_hash": "cfaf9207e10d89df9d4947efd29377484595282b1acb0b305345303681835c42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04065.php", "upstream_id": "BenchmarkTest04065", "language": "php", "code": "getContent();\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return new JsonResponse(['error' => 'forbidden'], 400); }\n $processed = $data;\n eval((string)$processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6121efea68529ea4a5b90c771efa75e76c10b7cb2f6872d3cfe02762ac6062a7", "structural_hash": "0a74e1a511d35bd7b74ce7fabb3d0ede1ea08a94526c08d570b111fe37db4eda", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00793.cpp", "upstream_id": "BenchmarkTest00793", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data = std::string(\"value=\") + user_input;\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18ab32aeda33d0f3df0d21a755f50be2aa975844d18430d1e7b7b21baa8332e2", "structural_hash": "65b871ebde420c7ead3357f458953e9ff6ce91afa5a93e70e863b7ef58981618", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04617.java", "upstream_id": "BenchmarkTest04617", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.function.Function firstStage = s -> s.replaceAll(\"[ ]+\", \" \");\n java.util.function.Function composed = firstStage.andThen(String::trim);\n String data = composed.apply(commentValue);\n response.getWriter().print(String.valueOf(data));\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0bec66c36555577ccd8cae50fc5f0c66dbd92abe14df2824eed66b8e31243ebd", "structural_hash": "08a10eabbd0b30cf7747388713851621774715349ad8aaa7a2e79e1d109ec7b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10929.sh", "upstream_id": "BenchmarkTest10929", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n rm -f \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7837b1acc4373771199a060d1939a91b77765ba705e070d0d7f6de1ded7d35b0", "structural_hash": "2c501faaba08de75e035e2082298c458cb9f963858e97974b018890e1c088523", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_29869.js", "upstream_id": "BenchmarkTest29869", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send(\"
    \" + processed + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e11ffed7dd1c4a1b5a82d545fdc2f1ee0c6206748ec1b8adaaf0b44d95851ea", "structural_hash": "fd5e8abbf58e7a84ec8c1e9d1545fc825274522822b88476740f7742b8399b83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_05641.js", "upstream_id": "BenchmarkTest05641", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38c46e6616a0c3735d87d6eb74bdb6e968b50fbf13701f640a6f982cfdf96c39", "structural_hash": "f37130feb6bc16161bb3a87d51ab96911c8179720caa21ec4a2ddac377aabf32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05934.rb", "upstream_id": "BenchmarkTest05934", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = \"\" + user_input\n processed = data.to_s.delete(\"\\r\\n\").gsub(/[A-Za-z0-9]{4,}/, \"****\")\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93b27190f78e92b32fe59a90ecfa37e40bf44de913fb11971cb67f863ad6806d", "structural_hash": "9c46ffb2f807db9c76c5e4b78e06db52e40708a9a72b5098dd1a93bbeab59366", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04692.sh", "upstream_id": "BenchmarkTest04692", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f96f573c249b6ed5a6880f8f12072a8a3b24feb1a34aa1396a798fd7786837c4", "structural_hash": "bc6b5d2819eb8ad2cfa56db4713c1edb90b2bf01e5e093b0b6fe902643838d97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02012.java", "upstream_id": "BenchmarkTest02012", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = multipartValue.isEmpty() ? \"default\" : multipartValue;\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "991ecd3c0e6bff820c9e07d6033b1e12bead1ce2666f890ec7fcb29933948f02", "structural_hash": "4b3c7e78d3046cc8e620e4f335becc84c975e55ea1d16afcd2f07f86fcc6e6d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15613.sh", "upstream_id": "BenchmarkTest15613", "language": "bash", "code": "benchmark_case() {\n user_input=\"d1Fg7Ht3Vk8Mq2Pn6Ws\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n curl -s -H \"Authorization: Bearer $data\" http://api.internal/data > /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "989ce60a81f0469045370db9ac29f2416ada36718f443caadc50cbc7e862d2f9", "structural_hash": "ee698d2137ef59cdbfcb59aaad8d29203b775c770e845ccdebac1f92450ba487", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01921.java", "upstream_id": "BenchmarkTest01921", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data;\n if (multipartValue.length() > 256) { data = multipartValue.substring(0, 256); }\n else { data = multipartValue; }\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n dbf.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n dbf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);\n dbf.setExpandEntityReferences(false);\n dbf.newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63fe6c561de41ca09720952950e8bf5d86143c8210762b1b20b1e1a82fd813ee", "structural_hash": "c1b1bc149514af7a5feb47cd9709565d6d378fe1ded9df48135fa7d55fb9b00b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02244.rb", "upstream_id": "BenchmarkTest02244", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n data = \"%s\" % user_input\n Net::HTTP.get(URI(data))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "799e0d075acb38a31768ec5254001fb804ca92da4c2eb575a9cdcd93b3194d56", "structural_hash": "f3baba7e36d41422c23941cde016ef71beaf64127f13e3e58b196369ac2c876a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06456.sh", "upstream_id": "BenchmarkTest06456", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n eval \"cat \\\"/var/app/data/$data\\\"\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9eb227be5c73a20fe5f049dd78c728eecbb7c4a60c89018ac119a66562685cd", "structural_hash": "4609e6964da9220947b5968754c76134f5059ed25677c84ba34ac8f7f57a74f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05473.rs", "upstream_id": "BenchmarkTest05473", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = referer_value.replace(\"\\t\", \" \");\n let processed = data.parse::().unwrap_or(0).clamp(0, 2147483647).to_string();\n let requested: i64 = processed.parse().unwrap_or(0);\n let count = requested.clamp(0, 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08284cce301216282deff1017e0d6501e56623507e5aa158910938e1538c41e4", "structural_hash": "aa6a74eec00384ea05c125cf114263e707218aafac92c057a72d82c9c8e105a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01162.rs", "upstream_id": "BenchmarkTest01162", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = origin_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => origin_value.to_lowercase(),\n \"f\" => origin_value.to_uppercase(),\n _ => origin_value.trim().to_string(),\n };\n let _role = data.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62dde9d07a1c45db3a7a6b9609ec60648856a2a5fa42cf04fc4083420e429238", "structural_hash": "5010f36d601ea8d796e7c229c551b629531dac662505662e24659f1a0c84794a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02896.php", "upstream_id": "BenchmarkTest02896", "language": "php", "code": "header('Host', '');\n return response()->json(['ok' => 1])->cookie('session', (string)$userInput, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2de5353601402532b8c80a02f7d1c09a15d2d7f9fc16a31a48ff5dd82449801", "structural_hash": "13cbe1c7c7843582aa7061ce5a8b93468868c4b91fc47d642c0517b62a26c6af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04099.ts", "upstream_id": "BenchmarkTest04099", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = \"\" + userInput;\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5f1316556306d4161d3b01c8cf83bdf1e970e5470ac23cff81e7c5feef268e4", "structural_hash": "f54917c9e9438089da99653f776ffa93340589cc77d3f0329d42c0cb7fbb4808", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00810.rs", "upstream_id": "BenchmarkTest00810", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = origin_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let processed = if data.chars().count() > 64 { data.chars().take(64).collect::() } else { data.clone() };\n use md5::Digest;\n let _ = md5::Md5::digest(processed.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3b9081bd043ae9b0b2d00e12006c82ca410ced6232bae6b04f308a3d72c9122", "structural_hash": "ae9cc11b1f0725b151ee47dabcaa24ecf67b189a6d051e00fde51b37996f9577", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26150.js", "upstream_id": "BenchmarkTest26150", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const data = \"\" + userInput;\n JSON.parse(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "768376a4782388696545645561640ec8410ec738e23e52be20eb0e5e33a01cce", "structural_hash": "bce05dacb5f3d98be16706107473d1b7ba0d8c2ed2949dd78275df6240785adf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00214.py", "upstream_id": "BenchmarkTest00214", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\nimport json\nimport ast\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n graphql_var = json.loads((await request.body()).decode()).get('variables', {}).get('input', '')\n try:\n data = str(ast.literal_eval(graphql_var))\n except (ValueError, SyntaxError):\n data = graphql_var\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n return HTMLResponse(Template(processed).render())", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e7dff8b824b3ea40e9e8f6b80550b147ec68a6328b40a1d6b88ec98cc643025", "structural_hash": "29068378d1b19c7b3577e5b474085ee28e2405e89e58959a69ce8dd96461d687", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00011.cpp", "upstream_id": "BenchmarkTest00011", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2717e14c238a70a64d384f44bec7795e2f516368c520b918ecb8480f85ddf8ed", "structural_hash": "77495f51a1d3b5b07bb270aa3c4047194cf6d3e8fd1f238031f56b8e227aa08f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14449.js", "upstream_id": "BenchmarkTest14449", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = await Promise.resolve(userInput).then(String);\n if (Date.now() > 1000000000000) {\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b9c28b88e96e0baa55e260759f80ca9d9f2835f7217ed1f0f0b1a5c2c88926e", "structural_hash": "07bc0cdb344509bf9fa8443576dfd3bd244ee0f936535ab730744be008fb3de5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03999.py", "upstream_id": "BenchmarkTest03999", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom app_runtime import auth_check\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = '%s' % (raw_body,)\n store_cred = os.environ.get('APP_SECRET', '')\n auth_check(str(data), store_cred)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afb1968344affbb6bdf5063e14054b1cd8f96f8033c33e204c417e4c8b463dc8", "structural_hash": "49ad8f775dca907643401eff7d6788eb02b8f6c05b74578e86bc402088bb1eae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01503.php", "upstream_id": "BenchmarkTest01503", "language": "php", "code": "input('field', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return response()->json(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n $expectedSig = hash_hmac('sha256', (string) $parsedBool, getenv('DATA_SIGNING_SECRET'));\n if (!hash_equals($expectedSig, (string) ($request->header('X-Signature', '')))) { return response()->json(['error' => 'integrity check failed'], 403); }\n $trusted = (string) $parsedBool;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94fb0f255795c6d9563e752e96447879013c70285852e12d015a4e7d75af8375", "structural_hash": "2f20401231e4744f1b3f621114ed9a5f53af6094836d60106396fb0c6b2b882a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00453.ts", "upstream_id": "BenchmarkTest00453", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as isoDompurify from \"isomorphic-dompurify\";\nimport * as marked from \"marked\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n const processed = isoDompurify.sanitize(marked.parse(data));\n res.send(\"
    \" + processed + \"
    \");\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "143505643f9b1511cf59a5541ef2a54f09411d3a640a25d15ccae0240517ec4a", "structural_hash": "24e825bf52bdd47c86f64eb71e3febc6245c6b80e0edf2ebcd7860148f0ae6ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02715.cpp", "upstream_id": "BenchmarkTest02715", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data = std::string(\"value=\") + user_input;\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4eb7d8617915ff8d3c749ba9ab057facd473569598a725a09ed75844ac047ed6", "structural_hash": "8caace2df34a83569d8601ba66f1e4930a0fc23ad3e8f05db23e318c6e089d99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02233.php", "upstream_id": "BenchmarkTest02233", "language": "php", "code": "json('payload', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n if (!hash_equals((string) session('csrf_token', ''), (string)($request->header('X-CSRF-Token', '')))) { abort(403, 'csrf mismatch'); }\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "874a71e768c195e32493e23593d0f64a6f03f7498c87287931dcdf144c97c0e4", "structural_hash": "8f71afca5b1ba3e9ff292e5ff1bb8a2f2bf052eadc25c7e713639496450865c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03516.rs", "upstream_id": "BenchmarkTest03516", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let queued = auth_header.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")).finish()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f80ecae2305c5096cb446de3dfd3fe8de6ead4a1fb550e9939e8e888b7a2009", "structural_hash": "ec5982c636f917e7617d789b41fb0eb81554d75b9a86fe4eccaac382089e578d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04149.rb", "upstream_id": "BenchmarkTest04149", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n eval(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30e9719c1466cff39cc799364d72b9d99268381d8e58ca44bc19049ebd6736d6", "structural_hash": "d227dc26516d34dffa0a8bc2f3937d183d842e4ee03128fde1d8600c9b27373a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05673.php", "upstream_id": "BenchmarkTest05673", "language": "php", "code": "header('X-Forwarded-For', '');\n $field = 'data';\n $$field = $userInput;\n posix_setuid(65534);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "487e116c67687b9effc7e70ee82c325c058cccb881ad83119943da4579193013", "structural_hash": "29f1c3608d5dc0e06ae9872e197614053729b7137786274efa695615f4f5c6a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11193.c", "upstream_id": "BenchmarkTest11193", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n free(_base);\n}", "label": 0, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62f795ad3bb987917e570319eacef7052d4356a66a0401f60fad6ec6220cbc7a", "structural_hash": "27ad864bfc93cb18a28796f2fa931901da4be7d599dc4b5f4275d6c30423399f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00860.rb", "upstream_id": "BenchmarkTest00860", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"sanitize\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n processed = Sanitize.fragment(data, Sanitize::Config::BASIC)\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19c41b326b5ec89a432862deb9e8a106d35b5c2b39cafb7f570724eb937f0367", "structural_hash": "92ccf6ad1f54f1f5b621a1432f20fc078a68354ef3a4e3e4e613e5b549e4e39d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05511.rs", "upstream_id": "BenchmarkTest05511", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = comment_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0070988da4446dad6e95ccb856bd524e969514699afb895e4a257cc1d8134520", "structural_hash": "ae2cf85959f933decd5d8083cb9122d93572be56ea1ca43a03c46e36eb395481", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00381.java", "upstream_id": "BenchmarkTest00381", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference sharedRef = new java.util.concurrent.atomic.AtomicReference<>();\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n sharedRef.set(fieldValue);\n String data = sharedRef.get();\n String processed = data.length() > 64 ? data.substring(0, 64) : data;\n Files.write(Paths.get(\"/var/uploads/\" + processed), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71f0a7f75f21f63fc9a4ac80ae84edd01b335f67aef5ed3592c49cba23b43ca8", "structural_hash": "70cc5187b6e153819873322791cd8f59a3d1641fa6b82808b9fc2b4b700bddb8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01016.py", "upstream_id": "BenchmarkTest01016", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom pydantic import BaseModel\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = str(json_value).replace('\\x00', '')\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(digest)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "439f15011dd4149cb3de9a3248ab5c85286d23640510f4f19f32534d0a0ef6b0", "structural_hash": "1c55ec8cecf59da9fa975c33bd5f9dacbedf8eaf2a335299bf0f21f68254b7a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05207.rs", "upstream_id": "BenchmarkTest05207", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(multipart_value.clone(), |s| s.trim().to_string());\n let store_cred = std::env::var(\"APP_SECRET\").unwrap_or_default();\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fae97e510ce146820e2cecb4d7e3d660fc5334f1ccdb764c291fb0189b282f22", "structural_hash": "654e0605b8315bebb96a6eb3b21ee0773c32cb6c3fa4007be12bc5cfa070f169", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05780.rb", "upstream_id": "BenchmarkTest05780", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n processed = data.length > 64 ? data[0, 64] : data\n Rails.logger.info(\"Action: \" + processed)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bee18eeb12beafc29977bc0f2112c221879015c7843634f015772af3e776a1a", "structural_hash": "486183e4a1c9c9e8b3d1767b1be8a3d3beefebf872cba96203e4a2e6c8bab7c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04839.php", "upstream_id": "BenchmarkTest04839", "language": "php", "code": "request->get('multipart_field', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $allowed = ['asc' => 'ORDER_ASC', 'desc' => 'ORDER_DESC', 'name' => 'BY_NAME', 'created' => 'BY_DATE'];\n $result = $allowed[(string)$processed] ?? 'noop';\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1a581bfef7af4869664b8f632f06fc2e20096181522542e859f991931d00279", "structural_hash": "2a1511baf8c6747dca0d65bc3261cf6e2acc142e1e23eb1289fbd0df362cefda", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02171.cpp", "upstream_id": "BenchmarkTest02171", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f66884d465fed7fb3e87d1dc589e4f50938e555b4bb3c5516b050acc2ad6a7da", "structural_hash": "7b93a9619982540301a38387f9f81fc3ecf2433598aa164c04fe9bddd78ad484", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03281.rb", "upstream_id": "BenchmarkTest03281", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n data = sprintf(\"%s\", user_input)\n Rails.logger.info(\"Action: \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67bf539d7fddd8e5fcb31ff327daf89efab4a22fba73be5c31ebdcc62b6d4520", "structural_hash": "d56f163d87826c36e1e8be95b5a039b9a974d7ad5a8ff0ee54abdf4a6528ad77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04072.rs", "upstream_id": "BenchmarkTest04072", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(header_value.clone());\n let _: serde_json::Value = serde_json::from_str(&data).unwrap_or_default();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "606049c4b838c5585639e2b1cba7c187c93a968906ac721d1dbe2cb778cf5a5c", "structural_hash": "cc1fe15e3629a72a0eaf1afef70f1405586a216c0ffef4debbd717852b9ab611", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21011.sh", "upstream_id": "BenchmarkTest21011", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f3e6a4ef3e75880c185730324e3ca1d138996fadc6baa7e8b4b93151addaa6e", "structural_hash": "e71282a3a0f9da83819535ad8d4f97054cada6d920c6f969f4f5d76548902ff7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03302.ts", "upstream_id": "BenchmarkTest03302", "language": "typescript", "code": "import { Controller, Post, Res, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = file?.originalname || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n res.json({ validated: String(data) }); return;\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "322882f9dd112825e4483f8e5325333da4a980f98648a97ca41b2b6c4ae32812", "structural_hash": "fbb6df8a68d8ee38a49fc668f880797e674926b4d1a9a5939df742782ec9dd30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03824.ts", "upstream_id": "BenchmarkTest03824", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n Buffer.alloc(parseInt(data, 10) || 0);\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56169aa1e9d29f9776b14db45d39820e9d64db88ce88179962a45f4d1078ff48", "structural_hash": "819e58396cbe7a7cd91fdd7dbf75be6a7046fb221cd62c3bc8ab2eaf9375d6af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05444.go", "upstream_id": "BenchmarkTest05444", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tdata := strings.ReplaceAll(xmlBody, \"\\x00\", \"\")\n\tallowedFields := map[string]bool{\"name\": true, \"email\": true, \"bio\": true}\n\tif !allowedFields[strings.SplitN(data, \"=\", 2)[0]] {\n\t\tc.String(http.StatusBadRequest, \"field not allowed\")\n\t\treturn\n\t}\n\tprocessed := data\n\tparts := strings.SplitN(processed, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2644d2d9287b466fdbfc6e49007082bcadcec99fd9bf09b2448458cbbeca3350", "structural_hash": "e80cc5afcea86aa8530a17926ac7dd73dea6c2b891210b7c053403c0f30e5422", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02511.rb", "upstream_id": "BenchmarkTest02511", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"socket\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = \"%s\" % user_input\n TCPSocket.new(data, 80).close\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d019bc4e59a20f1ded174bb94ced9a732a03fcf7358ec9f338524fb3e79f7260", "structural_hash": "fbc2548608eb1f79d8df9aeed7c65f6841049382997571c7d01ee7af5cabf4d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_30583.go", "upstream_id": "BenchmarkTest30583", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuaValue := c.GetHeader(\"User-Agent\")\n\tcapture := func() string { return uaValue }\n\tdata := capture()\n\thtmlOut := \"
    \" + data + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "326e547e72117fe9da23a358ddb7f6ea99dbb6687bf639372cb61d9c56387545", "structural_hash": "69f134b255c8772936c416625467cbb2bea8052f40de24ca2937e8925612d2e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03295.go", "upstream_id": "BenchmarkTest03295", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(rawBody)\n\thtmlOut := \"
    \" + data + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5357f168251b0e176a7a836ed92b2944c4a1edc612289c7266431c893a774f84", "structural_hash": "fd7614b2359fb8fa06ac292e917c2fc86565c56085dc4d6385f49ccbdfaa9286", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_28638.js", "upstream_id": "BenchmarkTest28638", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n eval(processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-470"], "category": "unsafe_reflection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a6597d3cc9bd8a1e4c265aee5841c8b10b9f567863d0784dac0916800142a74", "structural_hash": "1faecadee64646118287d4f462e459d360ba5e1cca3de1d5b53c96193f594f89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05552.rs", "upstream_id": "BenchmarkTest05552", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let profile_value = crate::shared::db_fetch_one(\"SELECT bio FROM profiles LIMIT 1\");\n let data: String = profile_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| profile_value.clone());\n reqwest::Client::new().post(\"http://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f53a30ddae97ed97c3734a726abd36bd7577e3371c3fe1843340e9a329a50cb", "structural_hash": "e81425980e467cc898f2742f50cbbc7ad252bc510fcf4802c4c94e151809e72b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16369.sh", "upstream_id": "BenchmarkTest16369", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n printf \"%s\" \"$data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "954405ee9dd642653373088c47600e040e451f28d9efd7bb903a2aa5679c802c", "structural_hash": "f299a63e916da28e796bfb31cb9033ee31e607ce2fe2e3c62d50d0dea35f1983", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03555.ts", "upstream_id": "BenchmarkTest03555", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b10fc6611369809962931db883ee12948e542c60a38e85b944b2bb36535a22cb", "structural_hash": "231b2d66e2b1c365e9f830a9e9c211d46f0c71cde9957aa08e786bd554bc2aa1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03009.c", "upstream_id": "BenchmarkTest03009", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7e9c14c226113ff8a3c259d5578ade8dad4ba9f77881f10cc0275dffb344aef", "structural_hash": "aaaaea6e67e293105522147def68f8c44bcf5520ef3cf8d10561039045a8d5c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28578.js", "upstream_id": "BenchmarkTest28578", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-337"], "category": "predictable_prng_seed", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08ab84a17426eb507a534b122daf79cbe6cee12e3daef5d22b293a357fb31216", "structural_hash": "522d71c9646add5d81e920e89376270f6aca750018376d92f23df9d8a1e717a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14011.c", "upstream_id": "BenchmarkTest14011", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char *const _argv[] = { \"/bin/echo\", (char *)data, NULL };\n execv(\"/bin/echo\", _argv);\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "214de85418508abf2ba825a8ecc0f2a027cf33491e5588a6501e686f12237f65", "structural_hash": "ebf1b2c46dff64836dea3c52840ce392234416e2ec6ae1cb98e102e01f76ad21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24260.sh", "upstream_id": "BenchmarkTest24260", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n rm -f $data\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86f7a6215f1ede8470b27c7adf702e544b246c830a221d01cde7d9f1e9f8df22", "structural_hash": "7648b3ac90ab19fb8e3dffee9dbcd76905276728a2feb730bda117de7aba3fcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00838.ts", "upstream_id": "BenchmarkTest00838", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n res.status(500).json({ error: \"Internal error\" }); return;\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4eca9807e86a84facf8d15ddcacc4354165bf79600eb70b0a4ca423bea4d2cf", "structural_hash": "478d7023c312e0f67a4ff137065030cb6d3c2f077446e7abdad754b5a1cf1228", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_39142.js", "upstream_id": "BenchmarkTest39142", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.send(\"
    \" + processed + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26bf9b4f98ae14e05e3243decb38c80699e6e893184266d7a92ebde6084b9fd1", "structural_hash": "455df929b65845fb8bccba81d8968183023ab547f0b265dd6de5221876e3d84e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03753.js", "upstream_id": "BenchmarkTest03753", "language": "javascript", "code": "const { db, passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = passthrough(userInput);\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3f68f2dc68c822d1751375dc54619af4b22126eb5a40dfa5c9d92964b7317ef", "structural_hash": "b158f1865cf69a79fe5d672f304d35bb486bb31e43bd48b1ab885a978d9bffbe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05377.php", "upstream_id": "BenchmarkTest05377", "language": "php", "code": "query('id', '');\n $data = hex2bin($userInput);\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $data . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3476a50508cfb7a68803556f404a9a3a92337d3b921a37c812cf9b5edf76e462", "structural_hash": "1895716badf46463f062a9558a52eb1886164c3ec31325301b9cab9a4b2bdc72", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33042.js", "upstream_id": "BenchmarkTest33042", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = await Promise.resolve(userInput).then(String);\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c52541f0096c36a4bac678f9564f033f3feb40a5b880adda052aa28e2dd57fa9", "structural_hash": "c9396d5edaba249c45c8d1dd5c6116e37243bb295c648fc1f073d767c89e3790", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01261.rb", "upstream_id": "BenchmarkTest01261", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n response.set_header(\"Access-Control-Allow-Origin\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "021da1013abb40a25a1cfffcf46625c6f3e0ced094a7c73dced9ac4ef5331ead", "structural_hash": "751ff2f512330c0e12ce7c9801bdc18920669758201c757626472cbb142326ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04207.py", "upstream_id": "BenchmarkTest04207", "language": "python", "code": "from flask import Flask, redirect\nimport json\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n try:\n data = json.loads(path_value).get('value', path_value)\n except (json.JSONDecodeError, AttributeError):\n data = path_value\n return redirect(str(data))", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d702114df6b69cedf9ba6863abda0ce96b048f83bc8cfa83829156f41faa027", "structural_hash": "f47c56b33be48335f34352ce5827f74a80750d3b7876e19ed20477faf403517a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17469.c", "upstream_id": "BenchmarkTest17469", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n long _v = strtol(data, NULL, 10);\n signed char _c = (signed char)_v;\n printf(\"%d\\n\", (int)_c);\n}", "label": 1, "cwe": ["CWE-194"], "category": "sign_extension", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sign_extension", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8326a40de574f2f6a0d2c54890506ab02666cb7a6faca6cb22fb2e4ef925f169", "structural_hash": "eb20e200bb9ecdbdde1e46c46060cd506e33366205fb819ef5b7e1d89bf3124a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03650.c", "upstream_id": "BenchmarkTest03650", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89928ba7199bb19969b159b7f6520cb667752037c2e919a67acb67f73e420f3a", "structural_hash": "07a6cbcd0f83083952d0276e0870791ccc7d3bb7fb641ddd630c0a79e1ccba81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_25318.go", "upstream_id": "BenchmarkTest25318", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(fieldValue) {\n\t\tdata = normalizer(fieldValue)\n\t}\n\t_handlers := map[string]func(){\"primary\": func() {\n\t\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+data)\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Write(output)\n\t}}\n\t_handlers[\"primary\"]()\n}", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fa1a695d2fb409145af953fdb41d09c532eca61bae94cfc02eed577987a8099", "structural_hash": "e243309f05ffc784b94828234816b6bb90bf0e48e18233acf18ff25c71c3406e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00970.cpp", "upstream_id": "BenchmarkTest00970", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a3499f411f90a809df0299a76cc6ca6dbff6d63a15a5878b04bab1f750c6270", "structural_hash": "d6e289000c47aab0592cfe7e4ca38b3a097410bc4c2ef5036ae4c263fd1f3ba8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02347.cpp", "upstream_id": "BenchmarkTest02347", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n res.set_redirect(data, 302);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d9da050157d653ed7ac23bdc777308d7a25a468c436a5ace932b089740ca774", "structural_hash": "b2936b07d6ad9b76526589eb677bbd172a2aeff5c7e4191bcf3ed82b0d786b76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01908.ts", "upstream_id": "BenchmarkTest01908", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n res.set(\"X-Custom\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05b8ddd0cf1fa10261f699037ab2d6a511c879c5695f0bdccf9a5cfee0494231", "structural_hash": "ed1fb85c4babc24939be247c88bd44f515ea9b00e0d719951c7ae68c548f0e1a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04012.py", "upstream_id": "BenchmarkTest04012", "language": "python", "code": "import jwt\nfrom flask import Flask, jsonify\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n secret_value = {'secret': 'p4ssw0rd_test_xyz'}['secret']\n data = handle(secret_value)\n processed = data[:64]\n jwt.encode({'sub': 'user'}, processed, algorithm='HS256')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f10801b602ce51f79fc2265412b9bba8aae977dfa1edddfe0db0d1533d5874b", "structural_hash": "15bb1dcacdb5f08e108ddecbd53a31fd799799e4e6126fd0f3fdfd05ebb65a53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03520.sh", "upstream_id": "BenchmarkTest03520", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"${user_input//$'\\x00'/}\"\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n trusted_claim=\"$parsed_bool\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcfe958883c0bd82c29590ef104b138077dbf0168ba2b455010db1205d4abdb4", "structural_hash": "1a32b25bc7b8d140103f560b8db38854fbacd029b8a0656751ea5eeac23e82bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01739.java", "upstream_id": "BenchmarkTest01739", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data;\n if (hostValue.length() > 256) { data = hostValue.substring(0, 256); }\n else { data = hostValue; }\n Object codeResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4272e7144fa0857b7b4082d6f1a42531a6ab9573dc55877d514678fe85c1d17c", "structural_hash": "aa4b2a60012c5ed60eff027a32aee83c1655715c5b7a469aeb0705e5eacf6e7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00393.rb", "upstream_id": "BenchmarkTest00393", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60b7213e95c95a9e71552efee41eff713e11d0ca27fca63d243833313eda12b6", "structural_hash": "512163ecdcd9d86a2c6b18a328f46373e104329e9ef371edf066f20c532b7999", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24465.sh", "upstream_id": "BenchmarkTest24465", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d7808d552185838bae76665f0a477301e0ab69c408861832b948093bf794bbb", "structural_hash": "0c5044a6a3e57e3e6bd5715d3da0609ad4337f920356ba09d416ad626a738779", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05258.py", "upstream_id": "BenchmarkTest05258", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n data = '%s' % str(header_value)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d829dffd7f694bb6830668c55c792acb355eb134a129aa71c45a9ac38e4a7d4", "structural_hash": "5267d97ce824f32a2c0a55b5d1ff96f5d0ba6d6bd798af60847914cb98129f4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04641.java", "upstream_id": "BenchmarkTest04641", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data = normalize(hostValue);\n ProcessBuilder pb = new ProcessBuilder(new String[]{\"sh\", \"-c\", \"echo \" + data});\n pb.redirectErrorStream(true);\n pb.start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1c5a0abd7f221be1059050ab665114211c97385111a89fbc0be2b763b47327c", "structural_hash": "26643c30384e03269078df255242a7f613b515c8807c81431b377491bbd40ff9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33778.js", "upstream_id": "BenchmarkTest33778", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01b95ac4d320d318b7f96d8f844cc1899b4a851f87bff6d38c708191684ac81a", "structural_hash": "7f3683d0e925e8d39391f3efc0a55143a6a0a1c720d65292c8c767f63fd75cc7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27954.go", "upstream_id": "BenchmarkTest27954", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tform := FormData{Payload: xmlBody}\n\tdata := form.Payload\n\tallowed := map[string]bool{\"config.json\": true, \"index.html\": true, \"readme.md\": true}\n\tif !allowed[data] {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := \"/var/app/data/\" + data\n\tos.WriteFile(checkedPath, []byte(\"data\"), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "597acee895d811a269b616f7b21e2f0043203f1ec9f62ad5ed61cb6d786ad1d5", "structural_hash": "260164b2e6ce3ba412ba711622007bbad9f74818e74299c23b481fc022c4a4bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02404.sh", "upstream_id": "BenchmarkTest02404", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17112577315b7b6e2287cfd3cb08b916cd310596fe8efa4e38f10375070ea4ce", "structural_hash": "cfb0e277ee0d9e0a80fb571d466ca963e7ecb2c3cce5a4a593bf4175865197e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26620.js", "upstream_id": "BenchmarkTest26620", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = `${userInput}`;\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b58e9b4ccc06177dd966faf364ca6cf1997c57e67eb65f23d413e1266cab28f1", "structural_hash": "4f261bb066652a40fbb01bffd9d464971571740bc165925f378d7d984fdebb6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15286.go", "upstream_id": "BenchmarkTest15286", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(forwardedIP))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77966c9849ca9eacd515096eda773d86ecd3913192f1d62467211afd97a13046", "structural_hash": "9d4db89b2e295366028efc267352f388c7af8435d1d5b0bddf9518166e48fa68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03040.ts", "upstream_id": "BenchmarkTest03040", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data: string = shared.passthrough(userInput);\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send(\"
    \" + processed + \"
    \");\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af9c1c2d9eaeb76e6b20e0684d2fcbb88447931d53b8f98b803279d6e94ae5c1", "structural_hash": "d2e6b6d7765d8eb894b81492bbf52912a74de600d2629c0eb9a4d14757ff210f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05081.php", "upstream_id": "BenchmarkTest05081", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d0593e8c2030dc9fd7fc65f7c165966d7f7dfd506152ef9fc5a5942141d5a03", "structural_hash": "f3ddca2c6094f3e94cd66dcad3327966d3e19179a054af45ce74310ce93d626c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00733.ts", "upstream_id": "BenchmarkTest00733", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n await new Promise((resolve) => {\n childProcess.execSync(\"echo \" + data);\n resolve();\n });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1093d90c1135005f98d8a200fcca7b198b80034fbecb08e94c634031e4c3cbe8", "structural_hash": "0ffaf83e5a99828fd786d77e89d5d58fcc97d928a42150421f66e5c36ac402bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11346.js", "upstream_id": "BenchmarkTest11346", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n res.set(\"X-Frame-Options\", \"DENY\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe2b5b70b6ec5059f91670c0741e25ee13e9a6000aae3630e0dfe1f6d6e86691", "structural_hash": "b9ecd621fc6be8973457c59e96df0671170af5ee1e5d76122123cf853d7eca5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00683.c", "upstream_id": "BenchmarkTest00683", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1319ed64254880c02cfcb62a71bd50ab2fb24f0b8a6ceed68304609b0e4480aa", "structural_hash": "3090c2a5b483328d63caaf41edeba97770aaedac9f5dc21510a4962923819a2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37199.js", "upstream_id": "BenchmarkTest37199", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { ctx.status = 400; ctx.body = { error: \"out of range\" }; return; }\n const buf = Buffer.alloc(requested + 1);\n ctx.body = { allocated: buf.length }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1276532bf0fbc036417e9ddbbfd4311446d4688763eaa9d919032cb793dc06e", "structural_hash": "907df49f33a3d30fbea7d688ee65ce7d5ce1bc05e34af9f1449d78f2cdeb3aca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09565.c", "upstream_id": "BenchmarkTest09565", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", safe); fclose(_cf); }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77d8af576395b1fffa14c2142ded5c1a6d4b9b88555fcc4f455400c60c2169a1", "structural_hash": "9b102dba0d3055375afe9d0e2e392c5c5c8d0ce5d2ce912bab93c9de1236a9d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02733.cpp", "upstream_id": "BenchmarkTest02733", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n std::cout << _buf[_i] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea256caa50f26b05f9c073139d3eae29c3b8449fe808c656ca33b31cd7c78725", "structural_hash": "0a123eb6a142235db81c52d7e8275cbb68dfd3291fc46ab49d6a392b13485ec7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04030.sh", "upstream_id": "BenchmarkTest04030", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n printf \"%s\" \"$data\" | sha256sum | cut -d\" \" -f1 > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "779d5f40771381f5f17659f0badd8736c12e752f2fd2e41ae85fb02aed8fff4d", "structural_hash": "bfd94093352b9de686c393104e08406c340c558ee768dfdb4588902aca0d1b7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03447.cpp", "upstream_id": "BenchmarkTest03447", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"http://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56f3caa83df89e362c88e58c5580f23560e3db555ed902e2b8a9261be6946393", "structural_hash": "f91ffd9420a1010a7fea5da12717ae6680fa3b2a570346f60cf6e111b84ca24a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04193.py", "upstream_id": "BenchmarkTest04193", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n password = str(auth_header)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aade4986ecbfd7e4522bbf68e29e8127f6b4b9b50c7b46cf1492417789410764", "structural_hash": "57fbce6b43498c31d5483a6460e62951b87a8583c23bb0e65a0b33532da9f3f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30992.js", "upstream_id": "BenchmarkTest30992", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n try { JSON.parse(data); } catch(e) { if (e instanceof SyntaxError) { res.status(400).json({error: e.message}); return; } throw e; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2630a196c4593f9e85e7ea0f8304376f1bcfe13f83a67a12fa8a7ba56571fc53", "structural_hash": "744160193060c82bc83f7e38d86eb95de6ecb16053c02f999d9e374509364930", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18224.go", "upstream_id": "BenchmarkTest18224", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tvar data string\n\tfor _, token := range strings.Split(pathValue, \",\") {\n\t\tdata = token\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tDB.Exec(\"INSERT INTO feed (data) VALUES (?)\", string(body))\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4edc9045b43532d40f4e5c4a4070efcb88f1beab4f92ad6457863b44f77ffa28", "structural_hash": "d700f66d812fb1fd6eeb628c1c83a516fab9e21f7ada1a80833f1eea06a1e850", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02970.rs", "upstream_id": "BenchmarkTest02970", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in path_value.split(',') { data = token.to_string(); }\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ddd857d7b6f5e94d7aa63228096c8ae0f9b1c41f927456bffe88561dae472b5e", "structural_hash": "42195edc0ec29f19cf1bde356e5f9e868a9eaaab7efb354cc95bbee22df01ef9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00786.rs", "upstream_id": "BenchmarkTest00786", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(graphql_var.clone());\n let result: Option = std::env::var(data.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c1b1ece1468b00be5d4d7dfe464b0e8369b1c37b19cbbfa6dedc0caeda06b1c", "structural_hash": "af11f1f7845b70944588f837010d042d83706067dbdffa4d7367a5c0ffd12dc0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16885.c", "upstream_id": "BenchmarkTest16885", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9dc43b98ce833c5b2ca4257fe1919de6596f1abb63bc0113e077a0d4fcc15d42", "structural_hash": "83da899159ac1f84900b578a19980af34481896f80589ad19db9a080a06de308", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09138.go", "upstream_id": "BenchmarkTest09138", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"sync\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tpending := strings.Split(authHeader, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tvar secretCache sync.Map\n\tsecretCache.Store(\"current\", data)\n\tc.JSON(http.StatusOK, map[string]string{\"stored\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_memory", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "546dd7e629163cc23ff2d2086f6a2b569ba3fd40e7f3886c9bd2651fec23eb2f", "structural_hash": "c6a4b07d6b58ded1677f345606119d384878ba23db3f083c059c60113e053814", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17999.sh", "upstream_id": "BenchmarkTest17999", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n IFS=\",\" read -r -a values <<< \"$processed\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e55f4fbb47bc4f92ad9823d63fac241851fbe3d95aa6ad95fcf2b6c666e3d6fc", "structural_hash": "4a1fbef25fba2df5daaee19853659e72b4724f8c5a92f67cf64fedd24d1ff985", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03332.py", "upstream_id": "BenchmarkTest03332", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nimport json\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = '%s' % (graphql_var,)\n requests.get(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c74942f0ded68018f3b7c64ada5d9aef382ef992e6441c73eeec03d310423702", "structural_hash": "7b03985d9cb8d825aa1efdec37308b28d87d56b559d2f81cdb0455b7cdd4021d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09520.go", "upstream_id": "BenchmarkTest09520", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tdata, _ := url.QueryUnescape(userID)\n\tDB.Exec(\"DELETE FROM accounts WHERE id = ?\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-304"], "category": "missing_auth_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8680b012f4685c46a9ba58adc4065dd91a8d3f4d02eab64b84a287c74f95c87", "structural_hash": "8601b2284b648f3a3f76b0f8c6b32e6c539753f8916e92f81098bf9a650f8d34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02226.c", "upstream_id": "BenchmarkTest02226", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n struct addrinfo _hints;\n struct addrinfo *_ai = NULL;\n memset(&_hints, 0, sizeof(_hints));\n _hints.ai_family = AF_UNSPEC;\n _hints.ai_socktype = SOCK_STREAM;\n if (getaddrinfo(data, \"80\", &_hints, &_ai) == 0 && _ai) {\n int _sock = socket(_ai->ai_family, _ai->ai_socktype, _ai->ai_protocol);\n if (_sock >= 0) { connect(_sock, _ai->ai_addr, _ai->ai_addrlen); close(_sock); }\n freeaddrinfo(_ai);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10c3d0845a06772de7e5cef93cbf3f17a112445b88a37317ad824d77d0bed11a", "structural_hash": "5f6bfaaa5ca5f33a420af0d0f8956c4ae018e8515cd4ab8aff3425cd754244d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01614.py", "upstream_id": "BenchmarkTest01614", "language": "python", "code": "from django.http import JsonResponse\nimport random\nimport ast\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n try:\n data = str(ast.literal_eval(field_value))\n except (ValueError, SyntaxError):\n data = field_value\n random.seed(int(data) if str(data).isdigit() else 42)\n token = str(random.random())\n return JsonResponse({'token': str(token)}, status=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7c8cd87675fa70eaa3a43dc93cf83880485ac56149832bb8ef9117e55490be4", "structural_hash": "0156e1f25148685a52db62e981c1e202b1ed1124648518b69b25ad2f549f5326", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00561.php", "upstream_id": "BenchmarkTest00561", "language": "php", "code": "header('X-Custom-Header', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (in_array($data, ['https://app.shopcdn.io'], true)) {\n return response()->json(['ok' => 1])->header('Access-Control-Allow-Origin', (string)$data);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fe54325bc97e185746679ef1dcaabfd2b933cbf46c6f04a7cf83b4ccc046b18", "structural_hash": "80abeb77f024881ddd1b36ef30228bf3c916785127eab35135dff50bc1fc9986", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07971.sh", "upstream_id": "BenchmarkTest07971", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n data=\"${user_input//$'\\x00'/}\"\n curl -s https://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6a4b265a439d50caa5b76f01e5e95329ee914ac309e288212cc2ddb26a0fae6", "structural_hash": "bfd71aa06c98d685a30239d1cb9e0bfa09bc598e1e50f66d6d63fd2b82b6f9f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05556.py", "upstream_id": "BenchmarkTest05556", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n os.setuid(int(str(upload_name)) if str(upload_name).isdigit() else 65534)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b68e0f766f7bb2d7cc6a0fafb4dff6b6f4fa0b6cf2b6bf72454a5616ed27f786", "structural_hash": "d1d71caa2caf927590f04bfcf743d734badc35177ec984c06704f4f8f6311250", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04430.py", "upstream_id": "BenchmarkTest04430", "language": "python", "code": "from django.http import JsonResponse\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n data = handle(xml_value)\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return JsonResponse({'error': 'invalid integer'}, status=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JsonResponse({'allocated': allocated}, status=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de681a9ba333cba8bc71f28614d457b450e0e376513bf71fbf21b6481c56a189", "structural_hash": "2197bf33ca6c68e1ab23c5f163d28a43a19f23a5ffee2c48d50ad39e72b2ce1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02827.java", "upstream_id": "BenchmarkTest02827", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n byte[] hexBytes = new byte[userId.length() / 2];\n for (int hexIdx = 0; hexIdx < hexBytes.length; hexIdx++) {\n hexBytes[hexIdx] = (byte) Integer.parseInt(userId.substring(hexIdx * 2, hexIdx * 2 + 2), 16);\n }\n String data = new String(hexBytes, java.nio.charset.StandardCharsets.UTF_8);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "473bfd87438e8cd4b7a7e9ce1ed236a94ba9963eb3c25b9d63611338dbe76290", "structural_hash": "3e953a7f7426ea856a7a8b1f208b282d3a0f1d5021113be7cef63ffb76c886da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03170.py", "upstream_id": "BenchmarkTest03170", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n pending = list(str(multipart_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b0cbf849f2649e705238330f4456018bed9871a583e86223d5733566702cfbd", "structural_hash": "aa1f669d53a82926e0734a70c560b03fd138de9d1305b859574774cf1269e099", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01545.rs", "upstream_id": "BenchmarkTest01545", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data: String = cookie_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| cookie_value.clone());\n let _role = data.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14a07995c385eb3d486f222198d6f76f3c1a70aa7ce1c0ed003aea572cd27337", "structural_hash": "2e602591e542b8d57adbb20f779f525166fa0ebab92ec0f3427bc23a1d2eee49", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00159.rb", "upstream_id": "BenchmarkTest00159", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"app_display_name\"\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8556b6e48f39a7b6587c29ac4e65b646566108fa77d44f620aa96a6f42cf6b52", "structural_hash": "52e35e4abc405f62386d7ed5b3699071a50b92fd3ca50159d6c733c143bf3574", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01386.php", "upstream_id": "BenchmarkTest01386", "language": "php", "code": "header('X-Forwarded-For', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $trusted = (string) $data;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed39061c78b9d3048a9141a5904a6c55e09e9a3a30fd48c7085eff8998285870", "structural_hash": "563d9bde4b886b81bb6c52bcc46a9a0641b7ca01fa022d21e74319d27c69b0df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02965.rs", "upstream_id": "BenchmarkTest02965", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let mut pending: std::collections::VecDeque = raw_body.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d207e9efa2bacc398c73f2fa957ccdc4cb50e2e76c90f6fbf550b0df6f48aed5", "structural_hash": "699cccf75bb7b6fa083376f0158af12a81037a315384f94b5df92ed875d3c6d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03364.java", "upstream_id": "BenchmarkTest03364", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = normalize(userId);\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n javax.crypto.KeyGenerator keyGen = javax.crypto.KeyGenerator.getInstance(\"AES\");\n keyGen.init(256);\n javax.crypto.SecretKey key = keyGen.generateKey();\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f76eb85bfe1e625bcd9e365684039d5c23b494b3fa77ebac1fc134f521451b9", "structural_hash": "06fd5c14e902be0ebaa2f994bb63657c24706ab728e96fd8b95cebe39e855ab0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29538.go", "upstream_id": "BenchmarkTest29538", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvar _b strings.Builder\n\t_b.WriteString(dbValue)\n\tdata := _b.String()\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tactualHash := fmt.Sprintf(\"%x\", sha256.Sum256(body))\n\texpectedHash := os.Getenv(\"TRUSTED_ARTIFACT_SHA256\")\n\tif actualHash != expectedHash {\n\t\thttp.Error(w, \"integrity check failed\", http.StatusBadGateway)\n\t\treturn\n\t}\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 0, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19d9f94b2602431b41cfe46cec4f9a8e5c36bc1adeabe28d9e1be1b3d55cfcfc", "structural_hash": "6b101ade76f23d9649344038068fe8e3b3e1896b926a69e650d036bfff9d2fa6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03594.cpp", "upstream_id": "BenchmarkTest03594", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DOTENV_VAR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "641c3d7a1db7e83161223a076a1f8ffe97bae308245686cf07b2bca4efd4676b", "structural_hash": "a20084386c8c74b30d3788536c4d9c8d08d42369a4e96b33d2cc58093e50a996", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00291.ts", "upstream_id": "BenchmarkTest00291", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f165d2f7631e6c9ef95ec0b62c95a5438382d02c7a65f9b9251a09b2f467520e", "structural_hash": "237fe704445bebd4e0328cd4b8116ae95641144be73c99acb2ff39cc6e3c449d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_15054.js", "upstream_id": "BenchmarkTest15054", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = `${userInput}`;\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-337"], "category": "predictable_prng_seed", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c97c0f8ed7f96f28936bd2e2aefdd875b65615c3df719e292d9da185552b8c0", "structural_hash": "6f39bf5cb7b87068cf4985c53dbe84437dbaf8edf50bcb6f0a2a779fb218cd64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02323.php", "upstream_id": "BenchmarkTest02323", "language": "php", "code": "header('X-Forwarded-For', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fdb57807daf3d579f7f9cfdb32e6f96f1e1d52229cc6e22debcecbbf6d2b560", "structural_hash": "8c6bec0d89889e1f6cde684f6f60845054329d36c4c89db9804fa97f80df2621", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02934.py", "upstream_id": "BenchmarkTest02934", "language": "python", "code": "from fastapi import FastAPI, Request\nimport ldap\nimport re\nfrom dataclasses import dataclass\nfrom starlette.responses import JSONResponse\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n form = FormData(payload=referer_value)\n data = form.payload\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b338fae9be7665db95eb2dfa5c3fba04d6bed5fed47307038db2a1e8a285e1a7", "structural_hash": "efb64ad9f73f6bc3ef2eba099fa4dffe9d24e0e7d14f4aea597c9550c740d964", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18196.sh", "upstream_id": "BenchmarkTest18196", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=\"${user_input:-default}\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b5070afc2b66b11f2cc32092bd9ed70b772da8e23df20cecb2590c8f2b3a8c9", "structural_hash": "7698ccefbc9ea705524062e2c1c1433d74bc1cbc9f57819723eeb1236b6933ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01919.rb", "upstream_id": "BenchmarkTest01919", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"feature_flag_value\"\n data = \"#{user_input}\"\n _pw = ENV.fetch(\"DB_PASSWORD\", \"\")\n _dsn = \"postgres://app:\" + _pw + \"@db/prod\"\n _ = _dsn\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d979afdd896671878c835d606ffe790a8c483874bc2f3b3144ee58dca07e135", "structural_hash": "0099e9f283f8235332153ac9374b74adf27024dc692fea2e44a0b30ee79115f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01637.java", "upstream_id": "BenchmarkTest01637", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + jsonValue;\n String data = valueSupplier.get();\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n jakarta.el.ELProcessor elp = new jakarta.el.ELProcessor();\n Object rendered = elp.eval(data);\n return Response.ok(\"
    \" + rendered + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30cfc8253fd0829694a0fb725a9236d3eed81654e69ea82419f412445f4462ac", "structural_hash": "582e464b095c1691c5a0048e3342955c320527b3e2a3cd000b44dca275117549", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05757.ts", "upstream_id": "BenchmarkTest05757", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = \"\" + userInput;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2aa5f985ee01a3f57c558ce1a4cc2d22781fce527da60b3f6a9e51eb5a2206a", "structural_hash": "b5275f9f316f22d0e367d70820df1c02e92184fdcc19cba03a7d833d268eef51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02668.cpp", "upstream_id": "BenchmarkTest02668", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n for (std::string::size_type _i = 0; _i < user_input.size(); ++_i) {\n if (user_input[_i] == '%' && _i + 2 < user_input.size()) {\n data.push_back((char)std::strtol(user_input.substr(_i + 1, 2).c_str(), nullptr, 16));\n _i += 2;\n } else { data.push_back(user_input[_i]); }\n }\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb2660b1263616a5ecb9adfadde48d1f52ffcd4e875140ff88bb4576fbf3a064", "structural_hash": "3e74062779ca3184034a0f92d8c3d832cd199156d1fa4e9990dfb33da6b1abdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23691.js", "upstream_id": "BenchmarkTest23691", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-286"], "category": "incorrect_user_mgmt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c23af80810236f373e591b5439f09c6ebd25b977315e08bf7b7e394174ba368", "structural_hash": "051211766580056b4b8f7d05e493952c1e85ddadf6c3354bc98c858a360dece9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01956.py", "upstream_id": "BenchmarkTest01956", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom app_runtime import db\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n try:\n data = json.loads(user_id).get('value', user_id)\n except (json.JSONDecodeError, AttributeError):\n data = user_id\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return JsonResponse({'name': str(value)}, status=200)", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7945f7e3437966913ba85cba1cc0e0ec5c8588485ffe7d9147dd97ab49d72b5a", "structural_hash": "7fd891b17f8b4ddac24fa3369a78231274bfbbb4fb6fdde38f2e2e63b61d2539", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07624.go", "upstream_id": "BenchmarkTest07624", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tvar data string\n\tfor _, token := range strings.Split(multipartValue, \",\") {\n\t\tdata = token\n\t}\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b02cf88cad902ffbfa7e371cac9dc4eb9ee6b043fa329cce1173c7575594f8b", "structural_hash": "7bbed7b848a248bd28ae532a7c442633f1711635eb78aa3a70d36be24486370a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_10800.go", "upstream_id": "BenchmarkTest10800", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", refererValue)\n\tdata := _sb.String()\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ced2f64e5ddbc5408872aafc0014293991a350035665180b809054d6348a4744", "structural_hash": "8ccd876ecc4d92df022833a1b249db3555c6e7ac5ddbb2f31aed17b26ade6830", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14365.go", "upstream_id": "BenchmarkTest14365", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tdata := strings.ReplaceAll(uploadName, \"\\x00\", \"\")\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data, Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-565"], "category": "cookie_no_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93778248c351d9921b9e132d1ef05e7958d85c728e141340b292d49e280b97e6", "structural_hash": "8f6ddaf5dafc22bbb497176c4f8bea186f7279cdad73943275d6732cd4b6f596", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_30863.js", "upstream_id": "BenchmarkTest30863", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e3b5c809f2db8d811b4d36b382a439d3f5638b245807bd8ef616c16c67f5b91", "structural_hash": "db56616f66285dec36126bf87d4a3de903816949f2cabcbd50efb585322aa31d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00621.py", "upstream_id": "BenchmarkTest00621", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom lxml import etree\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = f'{raw_body!s}'\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23ebe686bc197c00b62d8f9fa2452ea52bc6a4735e680c0f5461a9bd465416d6", "structural_hash": "4a72d3ac424e54c91f24f7f6fdb6e9f7b1781bc0924e8b24d610ec7d9bf78b4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02395.php", "upstream_id": "BenchmarkTest02395", "language": "php", "code": "input('multipart_field', '');\n $data = vsprintf('%1$s', [$userInput]);\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b4fa0a20f6d1837d46bd27c7762089538796c8d2ac28d1c6386ff825c555a02", "structural_hash": "2cd5a64f9e729447c318a874598edb3455b689a2a332dbaa3373d5024b13b17f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03166.sh", "upstream_id": "BenchmarkTest03166", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n rm -f \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0197d142a07946c6ff7dabed27c58bdd54d8c4fe7cd719782b060937d12f31d7", "structural_hash": "bd80cb74cfd63836cbcc7a108f55c660b498fc35494b18710ef17dcc88dc9b15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31059.sh", "upstream_id": "BenchmarkTest31059", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n printf \"X-Custom: %s\\r\\n\" \"$parsed_bool\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be506042005d066e15d51e93ff471f17814519dc8024420a330540ca12a1a711", "structural_hash": "cfd91219d45f137f814e72dd6e802d97e1751e255676e5a2350d38294d49c5fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12795.sh", "upstream_id": "BenchmarkTest12795", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bfb42584a3510867c04e7c725765e083fc3993de7d6187464432f4ecfdb24805", "structural_hash": "3e24087fce002a4e0be0096f2ffa5798a77ca42ffc4347c25ec176a8ebcb5eb7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03913.py", "upstream_id": "BenchmarkTest03913", "language": "python", "code": "from lxml import etree\nimport re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(field_value)\n data = collected\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82b7c5d37ce539d50eb5d4c09c98ee1948041a12a376c7f1fe474a5ebecfbd1c", "structural_hash": "a7a1b4b750a890bb32b70f986562c0262d70e91fe1ed852d0cc2861322ad247e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03362.rs", "upstream_id": "BenchmarkTest03362", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data: String = origin_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| origin_value.clone());\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c67a4e4ee88250a0d3bcd06b696ca445e660e7c9fb1a11dc5cb6ab1beea86ace", "structural_hash": "9a06e7cb50090aa12dad2421859753c4eaeddffb86bcd07bc878e747b07421cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02107.py", "upstream_id": "BenchmarkTest02107", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\ndef coalesce_blank(value):\n return value or ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n dotenv_value = os.environ.get('DOTENV_VAR', '')\n data = coalesce_blank(dotenv_value)\n processed = data[:64]\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(processed))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a310f8b41e40dcc05281ceb6fba56acc0d2333988072c24158b009d22016c591", "structural_hash": "a149dc2c8cb80b7cca8efbafddb8f84ed4954175b93eeabd5198c7f1f0ca391b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04921.rs", "upstream_id": "BenchmarkTest04921", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let transform = |v: String| v.trim().to_string();\n let data = transform(multipart_value.clone());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n #[cfg(unix)] { unsafe { libc::setuid(65534); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ddc7a6c6e22b71e45a9e3a72def622c86990b7ba940dc3e38382c1c404baf044", "structural_hash": "36f23ee0a0cdac923ede2ca5893d1a7404c6b352aef7f7700a271c56939b6604", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21511.c", "upstream_id": "BenchmarkTest21511", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", safe);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88fdbeaf2ecc199bbb1bb90e58ccbc0c6961fe28818fc82fcd266eff999e89db", "structural_hash": "7cda571b22667a5ef8a6ca7e73aee6eb2a0fb22a8e0c65fac6c3c3b9dc031756", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00558.java", "upstream_id": "BenchmarkTest00558", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.Map.Entry kv = java.util.Map.entry(envValue, \"body\");\n response.setHeader(\"X-Tuple-Context\", kv.getValue());\n String data = kv.getKey();\n return Response.ok(data + \",data\\n\", \"text/csv\").build();\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f606014b8a8990e9c07d5ed3270f2f67d0967448b9f431f54f7fb0009595286", "structural_hash": "31c9c4f2339ae24c98e87c65ae75081e67d9a6cca9bd8c19bd4b8fb9cac38136", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00345.py", "upstream_id": "BenchmarkTest00345", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n data = '%s' % str(user_id)\n with open('output.csv', 'a') as fh:\n fh.write(str(data) + ',data\\n')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64e57dc3625d0bbfaef34ea9f6eb6ee82fa894b00bd7f04b3d91508a19e4dd48", "structural_hash": "5bf78d4c0c738970977edf096cf58ca55e46cd688d2206029d9f8507d3f57451", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18460.js", "upstream_id": "BenchmarkTest18460", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5da6b958561f769b71b1982741886358b00ca37ca9b74a8334e240ffded2ffd", "structural_hash": "20f5a162c43fab691b42cd16b13efde60e87c49272c4d90a28aadbaad4838cef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05655.py", "upstream_id": "BenchmarkTest05655", "language": "python", "code": "from django.http import JsonResponse\nfrom django.shortcuts import redirect\nfrom urllib.parse import urlparse\nimport os\ndef benchmark_case(request):\n env_value = os.environ.get('USER_INPUT', '')\n def normalize(value):\n return value.strip()\n data = normalize(env_value)\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return JsonResponse({'error': 'forbidden host'}, status=403)\n target_url = data\n return redirect(str(target_url))", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eff03352151d14d26c346baa14610e2a447424982a68425e15fe2029e5d8ac76", "structural_hash": "004e8be7dccee8d592a466d1279d4e385d0070354afad4153ace94e632f99d92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02627.py", "upstream_id": "BenchmarkTest02627", "language": "python", "code": "import ldap\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n multipart_value = request.form.get('multipart_field', '')\n parts = str(multipart_value).split(',')\n data = ','.join(parts)\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e8b679ab1c9ec529924b040984ed2e76b6333aac762b15c40d1f233d8451dde", "structural_hash": "1595592d89288e16128b8371f6108a2d59b999df3f873adadd028dfdd497b988", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03626.php", "upstream_id": "BenchmarkTest03626", "language": "php", "code": "getContent();\n $data = \"{$userInput}\";\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b109d7502bb4e959cef5fdbb641e6fce498aee5e9c72e7cb7433841cf7c1cddd", "structural_hash": "624d2d4bbfe805936158434f64033d0d1ff509a5e36592bb73073ebe98e0d06f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03900.c", "upstream_id": "BenchmarkTest03900", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", data); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c76643b81571886726a0e5a2cc41d2f53fa294633d70b1670e8bd22f1dd9a8f8", "structural_hash": "971cb571ab10a34c59f6105146366262c27e08a449f049fcc02f11666fa686cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_20936.go", "upstream_id": "BenchmarkTest20936", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := strings.ReplaceAll(jsonValue, \"\\x00\", \"\")\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tDB.Exec(\"INSERT INTO feed (data) VALUES (?)\", string(body))\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e4f14d884406fe8bb387dc4f0b0ba870c452d62955f17a9806dae8d76011ed9", "structural_hash": "337b0124bfedca4f4ff7fdafaf792379499ee9b90fbb0f815872cc4e4fc478cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19600.go", "upstream_id": "BenchmarkTest19600", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/s3\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := func(v string) string { return strings.TrimSpace(v) }(jsonValue)\n\ts3Client.PutObject(context.Background(), &s3.PutObjectInput{\n\t\tBucket: aws.String(\"app-user-uploads\"),\n\t\tKey: aws.String(data),\n\t\tBody: strings.NewReader(\"data\"),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2db90153ef89de974453ea7ccea8f2653dc102f47787ad7df856a9646f998b38", "structural_hash": "21f129e94bdbae7f471a41a7c2b46e06595d60825dbbd89abd5b6eee8ac5c781", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02643.c", "upstream_id": "BenchmarkTest02643", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n unsigned char _digest[32];\n SHA256((const unsigned char *)data, strlen(data), _digest);\n}", "label": 0, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61e400763cf89fcc7f7513f5b0021f7122eace890dfdce1293d4cafd9c77e4a9", "structural_hash": "cd8b355ce3e11d87c3e6f5cbc9877d1eebb04cf620c214ba768e358adc75b00f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02605.py", "upstream_id": "BenchmarkTest02605", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nfrom pydantic import BaseModel\nfrom starlette.responses import JSONResponse\nimport os\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = str(json_value).replace('\\x00', '')\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9617c1bdb9aacd70b17ba72679f4f8a32c977f66235b96b15d5aa872aeb2135c", "structural_hash": "ba9bb59df3ee7a83d58bd5a1926abcf7ceb479e1161c3416331f97b6409f815e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06522.js", "upstream_id": "BenchmarkTest06522", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = String(userInput).slice(0, 200);\n if (!/^[\\w-]+$/.test(String(data))) throw new TypeError(\"invalid input: \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e59715c61bdef561c1df2ad49b491261c9cfd5f9dbab6a5f382eb4530013b36a", "structural_hash": "71e2c40925a966dc22ba8c3123c6e64d5dc81d2b1a8d9ae575623aa30d204d68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08130.sh", "upstream_id": "BenchmarkTest08130", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b20cf8a2a2933ee3afc1dd0d5611a0859072e08173f3d2d0fe82b845015c0948", "structural_hash": "dbcd47aeb9faab30bda407e6cb3f4c232d8eaed18666806c53885bacbdf8b7b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00397.rs", "upstream_id": "BenchmarkTest00397", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let profile_value = crate::shared::db_fetch_one(\"SELECT bio FROM profiles LIMIT 1\");\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = profile_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n reqwest::Client::new().post(\"http://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d62697ad15fa4a9b37949520003ea9c2cf99af78ccaecd6c6f0ecda7e1c307af", "structural_hash": "08c04eaceaa7e8ae9b42b439704d322ee53bb1752ca0be71adb325abdaeb75c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19002.sh", "upstream_id": "BenchmarkTest19002", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19ae7ae1716e02d67cba0bdaa0a3dee6673fb745629783094f016b3600fde9f0", "structural_hash": "2a59844904ad897e5765e42de5b9332599817733a23c6f91b257658c7fffacb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01568.java", "upstream_id": "BenchmarkTest01568", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(forwardedIp);\n response.setHeader(\"X-Frame-Options\", \"DENY\");\n response.setHeader(\"Content-Security-Policy\", \"frame-ancestors 'none'\");\n return Response.ok(String.valueOf(data), MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9143ab3869585a6758545b878d9b2c80647f637c2bab3ab7e240402357e61eeb", "structural_hash": "bd4a79c2fbf72a8414b3cf4ac2a3207e65f40f70b1e1d4119dc3310aee0fb1bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05686.java", "upstream_id": "BenchmarkTest05686", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(fieldValue)); }\n catch (NumberFormatException e) { data = fieldValue; }\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27285cc0f29987fe460cf6278808b9b82dda64731c83106e7a48a902d85b8929", "structural_hash": "e816007180038778ca33a3bd6549cc514185088a8b9fc26c5a41bf43781db038", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00521.sh", "upstream_id": "BenchmarkTest00521", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n eval \"echo $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd37b607d7280bdf7fbe0a7b18ea215a9ba3a92cbb43536948a1068d974636c4", "structural_hash": "e9e1186d7da40115f15121f7207e0a059ca4d20fcb130ee85bf886e8de7cdeac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12195.js", "upstream_id": "BenchmarkTest12195", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a633e37618247598909ed49e6c635f73546afa3bf71a95158b16317814dc9d0d", "structural_hash": "7f7007b9a3de7064977c4e207ea773c064b181a5e3dc0eb65b4348dc3b80e655", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03839.rs", "upstream_id": "BenchmarkTest03839", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n struct FormData { payload: String }\n let data = FormData { payload: upload_name.clone() }.payload;\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n log::info!(\"User action: {}\", processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c0a55eb39a285cbdb5b7f4339f08d127465d0c38ca2ec2557f1731ada13b78d", "structural_hash": "38a67d00fe2817f28abf3750685ac63636d47823c1d05273dc0f159c89eb1acd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04993.rs", "upstream_id": "BenchmarkTest04993", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if host_value.len() <= 4096 { host_value.clone() } else { host_value.chars().take(4096).collect() };\n crate::shared::render_html(&format!(\"
    {}
    \", html_escape::encode_text(&data)));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2eaca6db7371ee5da305ca01c84a46cd9e791e919bde03f92144f069c79509c1", "structural_hash": "868a0248375c26d7aea3d4b58ef687b70f3bb07a862eef21c385f85be618216a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02975.ts", "upstream_id": "BenchmarkTest02975", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca018c5a7150f30b1761acfd987fa93a5937e30c807963e17efd9ab5f2ad8216", "structural_hash": "5b1d82e20480508cc27a892fd3aaed58ea81debcc048a057769a49247180b771", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08919.c", "upstream_id": "BenchmarkTest08919", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb5afa5fe0a0f1ec3d2dd2ae2b336540e910844879b661351479ffcc13ea5e6d", "structural_hash": "bd4c2e9d863118c1f66ffb0a0ff0ff56df46fc764371bc4bc8c76d73506667dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17400.js", "upstream_id": "BenchmarkTest17400", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n ctx.set(\"Content-Type\", \"text/html\");\n ctx.body = \"
  • \" + String(data) + \"
  • \"; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "479881468158cda3b20da86dd10341eac85c6bc6a58304b96f62fedf0a182d62", "structural_hash": "2af7e7c0f5bee43bd7c2b1e3f09b379d02f0c3fe98b03d98a0443f0c30ea0351", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04742.py", "upstream_id": "BenchmarkTest04742", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nimport json\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n try:\n data = json.loads(db_value).get('value', db_value)\n except (json.JSONDecodeError, AttributeError):\n data = db_value\n requests.get(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d39de8ff3d42323b9b1b4766600ea55ffc82fc4ca62436c164498381e99dc8b", "structural_hash": "98f216740c92b42a5994e59d5348ec61ce842ee8f87f84d7e071d2383c0e0023", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03455.ts", "upstream_id": "BenchmarkTest03455", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n childProcess.execFileSync(\"echo\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57bd618bf5db149f9d92b2ce8ed36c0b67eec2703c4927bffdb4b335a1997080", "structural_hash": "8eb75bb69a4f88bcadabbbc3ac135a38a496c2d39b70193cbef3ec1676b12027", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03995.ts", "upstream_id": "BenchmarkTest03995", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n const _digest = crypto.createHash(\"sha256\").update(_content).digest(\"hex\");\n const _trusted = \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\";\n if (_digest === _trusted) { fs.writeFileSync(\"/var/app/active/pkg.bin\", _content); }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54823b3a744cf0451ab48308e94f405e636952e57c0750c357d002a99812eec3", "structural_hash": "23c88daac3f65a363fc594fef7de27d9e35da22fba10bea56b789e00fed07b30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03409.cpp", "upstream_id": "BenchmarkTest03409", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Forwarded-For\");\n std::string data = std::string(\"prefix-\") + user_input;\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "295067f0aab657c448eb71de21f8ac35e0fa799723c01dc2f56eb491f81faa8f", "structural_hash": "08f0d7c504712d95743e2468be3be21adf2bfc20d596d1ed37c08afbadf67ad2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04154.ts", "upstream_id": "BenchmarkTest04154", "language": "typescript", "code": "import { Body, Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = mf || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n }\n}", "label": 0, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80b28bd370fb465f8a7d8b152bd2efee993092f11fac8aa74d8524312e9ea9f2", "structural_hash": "8b3ced62f15b8a4f9190e577873364199a47d2fe7f1a296bf4879667f19c72f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01269.php", "upstream_id": "BenchmarkTest01269", "language": "php", "code": "header('Host', '');\n $data = '' . $userInput;\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a96da1084e7a71227c589edf77d8e56dc4f519d0bdc06fd4746c575f01edcc5", "structural_hash": "5f36fd8ffbdad75010c670a92d09b6e66e7da248162cbf1674fe936e17be18f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27455.go", "upstream_id": "BenchmarkTest27455", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\t_prefix := \"\"\n\tif len(graphqlVar) > 0 {\n\t\t_prefix = strings.ToLower(graphqlVar[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = graphqlVar\n\tcase \"f\":\n\t\tdata = graphqlVar\n\tdefault:\n\t\tdata = graphqlVar\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 1, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0b49ab2cd5f873908fa6a439e154e0f92922f70346b07af00e57a7e427b8ba2", "structural_hash": "fd05ed9faccc36667ab38399eab012533768da317919b5c4407d075ce62d9031", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14232.c", "upstream_id": "BenchmarkTest14232", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n if (_off >= 0 && _off < (int)sizeof(_dst)) _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d49ba034e92f8cad796c38e34ff1eca27625ca40b5f33ee0966b5334f235de3a", "structural_hash": "b3d08c4324907abdd8020187021d050b2d3bf92099668adf53c7ffaa24bdda80", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03417.rb", "upstream_id": "BenchmarkTest03417", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5fd29e66cc84b1214daf55b1cc7c18d6a9cffc8c3229eb15a536d09b65a97ca8", "structural_hash": "94d0b241c26c8813af533f2a637a07b168cc304ca4992374b6a03342da4accd5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01716.rb", "upstream_id": "BenchmarkTest01716", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n data = user_input ? user_input : ''\n render json: { error: \"Internal error\" }, status: 500\n end\nend", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9aa1552fbaa80b7e405e91a063f2f4d1c4155ebc2ab3603158a93cdb5145a911", "structural_hash": "4a3233992d6bf7c1f752526e81e5b6fc97ac05b87e3cc117abd56ea87b56ad24", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01490.rb", "upstream_id": "BenchmarkTest01490", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = { secret: \"p4ssw0rd_test_xyz\" }[:secret]\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n _req = Net::HTTP::Get.new(URI(\"https://api.railscdn.org/v1/data\"))\n _req[\"Authorization\"] = \"Bearer \" + data.to_s\n _ = _req\n render json: { data: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c26e6b6b8e72b28bc77773912fe6fb936050294de2e979e007b0908f99dbef4", "structural_hash": "3463490aa7183333e9fbb7b4e9cfc801ec57a0a5b18105f3d75d3ac5532be2a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01170.sh", "upstream_id": "BenchmarkTest01170", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=$(printf \"%s\" \"$user_input\")\n printf \"Status: 500 Internal Server Error\\r\\n\\r\\nprocessing failed: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afd45a1e9aa8e4ef252e67580320d86f728c5b35a67245dc4cf48a04540e2096", "structural_hash": "a9cbc2d21f477138ff2dc777c8f5cd01099a7297e4265226abc302b3ae48fbcd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03079.cpp", "upstream_id": "BenchmarkTest03079", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n std::string _out(_p);\n delete[] _p;\n std::cout << _out << std::endl;\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "369e0ccb894dadc56272a3805ac01b998e198ddcabaaf094d842cda3d61a5aa3", "structural_hash": "12ed4154785b54c41121a578fb5f0e4a7e3478d3dbdb622435a05aae135b66ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04005.java", "upstream_id": "BenchmarkTest04005", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.Semaphore RATE_LIMITER = new java.util.concurrent.Semaphore(10);\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.List tokens = java.util.Arrays.asList(headerValue.split(\",\"));\n String data = String.join(\",\", tokens);\n if (!RATE_LIMITER.tryAcquire(1, java.util.concurrent.TimeUnit.SECONDS)) {\n response.sendError(429, \"rate limited\");\n return;\n }\n try {\n byte[] buf = new byte[Math.min(Integer.parseInt(data), 1048576)];\n response.setHeader(\"X-Alloc-Bytes\", String.valueOf(buf.length));\n } finally { RATE_LIMITER.release(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0726044254f8a3de1ceb67739c9cd91b68a8c0be070af2b17ca8905a77f30940", "structural_hash": "8f72937a082957e2da0e6cdc2d85bb63dc677f171c4f226ca9fd052950889dec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01437.py", "upstream_id": "BenchmarkTest01437", "language": "python", "code": "import re\nfrom urllib.parse import unquote\nfrom flask import Flask, request, jsonify\nfrom app_runtime import mongo_db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = unquote(referer_value)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n mongo_db.users.find({'$where': \"this.username == '\" + str(processed) + \"'\"})\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47b8ee9f8ae062ab325bb7f5254f1ee9f6542c83c720810b6e76b9e687a8d5ef", "structural_hash": "4c9a702ed916aaa615565fafef5e1f2226a4b44ffb5cce82787b29a16182e82c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08686.js", "upstream_id": "BenchmarkTest08686", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_info_sent", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd10acbb087b2a14fe4253cfe8749126d9c01f8f8affeefa1f7c05632f5249df", "structural_hash": "d23bd26d8d489018c0845b604dff440f0169340b389573287142fdf716353d7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01324.php", "upstream_id": "BenchmarkTest01324", "language": "php", "code": "headers->get('User-Agent', '');\n [$data] = [$userInput, 'http'];\n return new Response('
    ' . $data . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cea40445c05d7160e528199c6e26f866119b469d30741ebef25b637fae9beb37", "structural_hash": "af1d9b4f4a452e735d229349d54be3158de3e821541a63d58689dfea687ffc3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05919.php", "upstream_id": "BenchmarkTest05919", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fccaf3e3384ecaadec556ce0299a956fe188d7a6606947cd69d0e24768e37a28", "structural_hash": "aedbe98e4800f45793b13b97faad8c8d24807c8e09509fc0826ec4f0d74dab42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23867.sh", "upstream_id": "BenchmarkTest23867", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n trap 'rm -f \"$tmp\"' EXIT\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ef31171f1ea6f68329179ecfaa255979dca65d0d6dad9fb8cb8e833abd37a04", "structural_hash": "7dab53646d8179ef7806ecb6bd61b80d65909ef9b87ed5b40444bede98c047d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03205.js", "upstream_id": "BenchmarkTest03205", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const data = String(userInput).slice(0, 200);\n authCheck(\"admin\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-258"], "category": "empty_password_config", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "164406f01b46a9883071bd96bfab3da2f45285734c2465506bbf59029d597900", "structural_hash": "2c26f511740bd645b2555a762a3eeec2974119697624511051ede098e83f76dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02919.py", "upstream_id": "BenchmarkTest02919", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport html\nfrom dataclasses import dataclass\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request, path_param):\n path_value = path_param\n form = FormData(payload=path_value)\n data = form.payload\n processed = html.escape(data)\n return HttpResponse(mark_safe('
    ' + str(processed) + '
    '))", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25dc8de83dc7556dce82c2ab12470a0f52ea95124ffe5d04f5b9eacb10bf3796", "structural_hash": "860d3477d7d98e4d28f8d8942c4d16168411fcfac41afb7fcb3b939f4fe3e3d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00493.cpp", "upstream_id": "BenchmarkTest00493", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c0b8b26d2f5a7932be57036114c26ca3a58e2862c14df48fafd894c093731ff", "structural_hash": "4c44bfd1aaa7f8d09fbdec312dd9e42af55e62994a8fc97d892dd275d2ae44ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03780.php", "upstream_id": "BenchmarkTest03780", "language": "php", "code": "header('Authorization', '');\n $data = \"{$userInput}\";\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b68b6d79cd00d15836e935f72fe44f94b1a511bd496663588a72fd63cf7640d9", "structural_hash": "a8cb2e93848882849753aeb730e559f3a321b48ffb093cd1cd65a9203dc045c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27715.js", "upstream_id": "BenchmarkTest27715", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = nodeUtil.format(\"%s\", userInput);\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e676ed7867f7c7fd8b8cbd0629e0e022f930e9b483d7d53b143755b0e7939722", "structural_hash": "58402cd9a10b7d5c2a99771c090c97adc4053bd530a27e01a03b9d6f7af3bb4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03841.py", "upstream_id": "BenchmarkTest03841", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom starlette.responses import JSONResponse\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\nrequest_state: dict[str, str] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n request_state['last_input'] = env_value\n data = request_state['last_input']\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b99e6df37809d82a87736d141c310d9c2368ad0262e7e50437ae081184bb6d9", "structural_hash": "88df714d88514f2dd88f4be3642d533d91f1d61bf730e33e0c577e3ac1b6a06e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35954.go", "upstream_id": "BenchmarkTest35954", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(cookieValue) {\n\t\tdata = normalizer(cookieValue)\n\t}\n\tpassword := data\n\tif authVerify(\"user\", password) {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-309"], "category": "password_only_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be1650a63b2d2762c368154e155ebcea213825bc95066a5de1193719d1f9f073", "structural_hash": "503bcfa63eda60c5fddce336a2af8e6628e8e8771a22e14f6df52dc77c990ce5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02175.c", "upstream_id": "BenchmarkTest02175", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "184c6adba94fdf418e1a5411a33dfe904d00f8d4d59cc5aeba30dc51e3e50635", "structural_hash": "d487b9f33d56cf37b7cc811939332b60b922d405bd5ed4986bedc32ae88a46a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01191.rb", "upstream_id": "BenchmarkTest01191", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n role = data.to_s\n if role == \"admin\"\n halt 200, JSON.generate({ role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0c3ddc85e81b7d4d2de91bb009185371fa847af7db21a2b7fe083ab58f38cb6", "structural_hash": "0093e2218d49a795db8cfe4265c4328b8b11dcc4945ce491b33cf1e314d1448f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00707.py", "upstream_id": "BenchmarkTest00707", "language": "python", "code": "from django.http import JsonResponse\nfrom django.template import Template, Context\nfrom django.http import HttpResponse\nimport re\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n parts = str(field_value).split(',')\n data = ','.join(parts)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JsonResponse({'error': 'invalid input'}, status=400)\n processed = data\n return HttpResponse(Template(processed).render(Context()))", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54f6858937e5a217bcbe6e3344a5ff48efdcb5e950197c9575c390b70e7d8b6f", "structural_hash": "74c8443db2a9b55218c715d99c7b9addc2c480ac6915cf35bcb3b20bd6cc594f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04870.ts", "upstream_id": "BenchmarkTest04870", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n console.log(\"Action: \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a11aa8012a248e44d2f649566ff1de8ece9099268ec47970b9e2525cd0526d78", "structural_hash": "92a29a4a0e4d40e68404085ab32f220826f20f3a22ebc06ae0ed53bbd3b3d4ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_34817.js", "upstream_id": "BenchmarkTest34817", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d092d02c2f29a5da65e3e18967172ef415d0bb8f212744e0eecf6bbfa0e5c611", "structural_hash": "2781d1849c96a146eafb06d44768aca90f62d38557cf225ea20b501e734194d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03613.py", "upstream_id": "BenchmarkTest03613", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = str(cookie_value).replace('\\x00', '')\n return HttpResponse(mark_safe('
    ' + str(data) + '
    '))", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "728bda0695143521e9248f020921a23eabc97ea70c6aaa052bb6afabfe24611b", "structural_hash": "f500d004b9e5e6f26b4c4d7c8a5b1213801cc783778b1b7409371ba1277df757", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03169.ts", "upstream_id": "BenchmarkTest03169", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3407e9ff75b074ec6cb090f3abceeab98a7f3dfb559e8231f6f278c83e08824a", "structural_hash": "e9c2e0ebf61c7ebf1f8c32c8b35abc2551f05f45f6ba605c10fa7819a6aa3f17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03474.rb", "upstream_id": "BenchmarkTest03474", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1370273c5133a2b50ee256890a05a0319f52bad91c7b623856c08c15df07164", "structural_hash": "e92e13d532ae55b97b893f747df1b49d63713ce4681d0f78210a9f96898f3128", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00017.java", "upstream_id": "BenchmarkTest00017", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.Properties store = new java.util.Properties();\n store.load(new java.io.StringReader(\"rawValue=\" + originValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", store.getProperty(\"format\", \"plain\"));\n String data = store.getProperty(\"rawValue\", \"\");\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10ce8bddf9ff8fed4c8f7b7913ddcd1d27be99b3dd6a66da42c3d1151bb70bf5", "structural_hash": "b040d3485fd744194484ed8ecb5d511bdc6e773baf796fb5f20d2e3fe48ab4aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03077.java", "upstream_id": "BenchmarkTest03077", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case/comments\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"comment\") String commentText, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String prefix = commentValue.length() > 0 ? commentValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = commentValue.toLowerCase(); break;\n case \"f\": data = commentValue.toUpperCase(); break;\n default: data = commentValue.strip(); break;\n }\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n return Response.ok(\"{\\\"status\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2db9fea2272b3dfc2123e4c2d3e0b1a05aa7059e6dc7be08075f4077870c6eca", "structural_hash": "c27ece708c05829b512b91d3bf4e326c87a224dfab425431d02e0799f7f370d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22305.sh", "upstream_id": "BenchmarkTest22305", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83ef03cfb735653f38fdf4d63dee2b26e387c28e832666ecbde42d5be67b276b", "structural_hash": "c37bfbe1aad80ea667e4bc28f1dfdaeb91352d00c29a9b01cd285c1cbcee3448", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19093.sh", "upstream_id": "BenchmarkTest19093", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13f6062299a426d026eb906c7a2fbda67f6c1873b170f383c5f6a572dbdb7aca", "structural_hash": "6cb67564ca5fe0d80801d5ce5e490b048854698dcdf991e3c19547a4ca3b29ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_21859.go", "upstream_id": "BenchmarkTest21859", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"sync\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tvar data string\n\tif len(cookieValue) > 0 {\n\t\tdata = cookieValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tvar secretCache sync.Map\n\tencrypted := encryptForStorage(data)\n\tsecretCache.Store(\"current\", encrypted)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"stored\": \"encrypted\"})\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_memory", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56aa9a8ec2f16908b32e48ffd7c8be27cbd1c626d2c4e2c4ff4ef1552283f5ac", "structural_hash": "1880c511f18b1212f5241197d3d411d376ab30ea7b04dfac52a0a21dede57118", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00814.py", "upstream_id": "BenchmarkTest00814", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import auth_check\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n origin_value = request.headers.get('origin', '')\n auth_check('user', origin_value)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e86de118bc629b8e22528b48f63d976b92e9d1c3ecb8473b89271bb82450489", "structural_hash": "d8c9b233960ea091e400b99ce63c35d159b996a3f15260a7edf63bd2ba3ea032", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03070.php", "upstream_id": "BenchmarkTest03070", "language": "php", "code": "header('Authorization', '');\n $data = (!empty($userInput)) ? $userInput : '';\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20cc9c38d0b4b5f055147d4a94a7d36fafc62588f2ec10663c6754dbf3532162", "structural_hash": "397aa4bb68336e059a546b528f5ce81d1933b5f01191fade57684f83cb51c1d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01006.cpp", "upstream_id": "BenchmarkTest01006", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n long _oid = std::strtol(data.c_str(), nullptr, 10);\n bool _allowed = _oid > 0;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1dbd40f8f86ca976122700edb62f5703a851439c5a59f488e4aec4abd95642d4", "structural_hash": "bba6a927dec5c0d653e5edd85c9ffc8aeabb619a4a88ab43340cec65b6f9b590", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05467.ts", "upstream_id": "BenchmarkTest05467", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const _salt = crypto.randomBytes(16);\n const _digest = crypto.pbkdf2Sync(String(data), _salt, 100000, 64, \"sha512\").toString(\"hex\");\n fs.writeFileSync(\"/var/data/secrets.txt\", _salt.toString(\"hex\") + \":\" + _digest);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81154f3601edd278eff5861e408020f35a5d26ee186f1bc244c5ea5d15571d50", "structural_hash": "a355ee9cfd793a7eca631908ba811cb3fdb70935e9eaa41c431a45f8a1810ca4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00730.py", "upstream_id": "BenchmarkTest00730", "language": "python", "code": "from dataclasses import dataclass\nfrom flask import Flask, jsonify\nfrom app_runtime import db, auth_check\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n form = FormData(payload=comment_value)\n data = form.payload\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60df408d6460d37e71dc379c11be2eaaee11b39b4feaa9c5bbf5ce7a2e273127", "structural_hash": "16fecc130d8a60738122b2c47346da756182afc24e706cadb04f3e73dbe601f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03180.php", "upstream_id": "BenchmarkTest03180", "language": "php", "code": "cookies->get('session_token', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n file_put_contents('output.csv', (string)$data . ',data' . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f22ebd012766b6a6ae9085854ecc34ae321184d8734fda93d2e3649223ceb2a", "structural_hash": "f1710d2551bf8f3b1fe790a864240415aef32234c9f87a261b5c12e478052631", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01702.php", "upstream_id": "BenchmarkTest01702", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a23cef49e79ffe16ed15960d7859d35998bea2989a0c173b2225d70e171c7c91", "structural_hash": "d631eb6b8867cae9768795386423ca38bcb2b965918200b2d319a2664ffc2be4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04624.rs", "upstream_id": "BenchmarkTest04624", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&auth_header);\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ce25f6d03f0bdb7e041c1faf2a966cd418606408bf57f98e4d7344ac65602b8", "structural_hash": "5225ddc45e32cdd55b0fbc91d7cce98cc6ab472a4cc3e10c13eaf1872068a59c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05073.php", "upstream_id": "BenchmarkTest05073", "language": "php", "code": " 'p4ssw0rd_test_xyz']['secret'];\n [$data] = [$userInput, 'http'];\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt('data', 'aes-256-gcm', (string)$data, 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b73c552ea41824e91d973f48d2e8aee6de49480b220aee4df2a06dd346279ff", "structural_hash": "dda75f6af1a83ba34cc75c06987e7bfdc8513d91a6e4ce38b259616f3a98897c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05802.py", "upstream_id": "BenchmarkTest05802", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data, _sep, _rest = str(db_value).partition('\\x00')\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18a10b347f17777b36d759f4ee1fe48f23e4f1e48eb23939d021eac2cc4f1380", "structural_hash": "b16ae91569a541f2c69e41cdb6c1e0ec86fd1e5c5f1597b8c374cdc42fe81a1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05461.php", "upstream_id": "BenchmarkTest05461", "language": "php", "code": "fetchAssociative('SELECT name FROM users WHERE id = ?', [$data]);\n if ($result === false) { return new JsonResponse([\"error\" => \"not found\"], 404); }\n $value = $result['name'];\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9bb371ca771780d218288147ed415a34d3b6d7ddd7e145d86baa91e4b3d23cbc", "structural_hash": "dd654a6938f1d3ea88d3b39d4afeb890852412917965b19ae33a7a2bd99732da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16756.js", "upstream_id": "BenchmarkTest16756", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56f628f12c31222811c8a43105d3578be5546a5504221bac75cc3a966e8e09cb", "structural_hash": "ca4e721c6b7fbf21b95412c841060933a4739130f270e1798edaf6cf598e8de5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36221.go", "upstream_id": "BenchmarkTest36221", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tvar data string\n\tfor _, token := range strings.Split(userID, \",\") {\n\t\tdata = token\n\t}\n\tfor _, a := range []string{\"read\", \"write\", \"delete\", \"admin\"} {\n\t\tif a == data {\n\t\t\tRespondJSON(w, http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\t\treturn\n\t\t}\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "926a1640c2a9bed75f4d2301d58c1c0ef7adaabead35c9c98b985d35ff455fd9", "structural_hash": "9724a493344102035b1e1a1e1f9ae10269df2de82479646be2451c31830c5d0c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05151.go", "upstream_id": "BenchmarkTest05151", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tdata := func(v string) string { return strings.TrimSpace(v) }(commentText)\n\tRespondJSON(w, 200, map[string]string{\"echo\": data})\n}", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a0c8d91c8682b8f6d15447b8e6ed04febce980ea82f847cadecc5f578d1b57f", "structural_hash": "78c462a55b29c438bbb8e4d2163cb94fc5dff8d85146aeaf96d70366810dcc46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20797.js", "upstream_id": "BenchmarkTest20797", "language": "javascript", "code": "const fs = require(\"fs\");\nconst { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const storeCred = process.env.APP_SECRET || \"\";\n authCheck(String(data), storeCred);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdda5f8fca789b0e9d07279cc7236541cbe73753745983ee2513b288a8c9e013", "structural_hash": "40a60fbec68054d68cdcd98efa5ab713198b6efa1c3c774414fa4dc8b4e3537a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26375.sh", "upstream_id": "BenchmarkTest26375", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=$(echo \"$user_input\" | jq -r '.value // empty' 2>/dev/null || echo \"\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n rm -f \"/var/app/data/$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6c5e52477f87ffd19abdb19a0d5ce7e87a922d2323037dfb52061baa8bb7702", "structural_hash": "15b69c1deaa05a8806b6cb8bc6757d7ff021f404bba8d0482c43e14258ed358c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25202.sh", "upstream_id": "BenchmarkTest25202", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(printf '%s' \"$QUERY_STRING\" | tr '&' '\\n' | grep '^items=' | cut -d= -f2-)\"\n logger \"Action: $user_input\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "962ee4fccf8dc6a7830c122ea6958a8ff6b657b04ebf1c57c77a42c889b17e84", "structural_hash": "bbfd62986f684bc9667ed41a182212ce8e626847037e42495a93f32cd54be073", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_25967.go", "upstream_id": "BenchmarkTest25967", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\t_prefix := \"\"\n\tif len(headerValue) > 0 {\n\t\t_prefix = strings.ToLower(headerValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = headerValue\n\tcase \"f\":\n\t\tdata = headerValue\n\tdefault:\n\t\tdata = headerValue\n\t}\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data, Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "081b51fd45c52be43884c23f7ad76fd362d7925ceab085f624a7e3253706ca90", "structural_hash": "b26bfb6578ce63d460cff7fd6667335cbf64a030695bb4698002184a67a3225e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03472.rb", "upstream_id": "BenchmarkTest03472", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = CGI.unescape(user_input)\n content = File.read(\"/var/app/data/\" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06ec7cf7b5d0f09882b5d185bda059aecc6c4943b882d175efd967a00022c05a", "structural_hash": "284d089c1761b4c94931bc2dd3ad3fa3b1320236752f7ee2478df19f7755cbf9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05294.c", "upstream_id": "BenchmarkTest05294", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n _p = NULL;\n if (_p) free(_p);\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "804fb9b4c434a21bca5ba92f740a7e23dc3ea05dba397dc77fb0388981515480", "structural_hash": "0c2317a77959f06bc3ebadcaaa2e99a44de27efb04c18ab5c3fa18487e8c18ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10119.c", "upstream_id": "BenchmarkTest10119", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n long _req = strtol(data, NULL, 10);\n if (_req < 0 || _req > 2147483646L) return;\n long _alloc = _req + 1;\n printf(\"alloc:%ld\\n\", _alloc);\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8df69280935477f148e92ade546a9d818340a828acab01f32dc94ed0d7b48e73", "structural_hash": "77907ffaf014567328e6ca71e60487898739b1c0d1e53973d09c13a8c4aa29fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04025.ts", "upstream_id": "BenchmarkTest04025", "language": "typescript", "code": "import { Controller, Post, InternalServerErrorException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n throw new InternalServerErrorException({ error: \"unable to process request\" });\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c52621d8917f29c2fc2cd46a4b1b2b8feec8ad0ca45bcef126f3c88c8637f07d", "structural_hash": "46b923b4436b4ee35cb8cd4329ea628d87f9a7d2b29bec9eec1365334148838c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05481.rb", "upstream_id": "BenchmarkTest05481", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n Rails.logger.info(\"Action: \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12658b88b3fb68ecdf3a69e86b239daf723e0cb820a1394092e5c478970fff3f", "structural_hash": "104802c6f49b748b306e2ae70ef5ee7abb60dbae5d45572f6efc456bf99fac3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05529.php", "upstream_id": "BenchmarkTest05529", "language": "php", "code": "name;\n $field = 'data';\n $$field = $userInput;\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11a7a022a8dfd519d044e2c44566ebc45bf1ba2c95df7d1663f219427884ce73", "structural_hash": "fb023101c105cb7c5a4f88d5221b77f234413b31cce0b1ca880f41acf14abea5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02051.php", "upstream_id": "BenchmarkTest02051", "language": "php", "code": " 'p4ssw0rd_test_xyz']['secret'];\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n $_token = hash_hmac('sha256', 'header.payload', (string)$data);\n return new JsonResponse(['jwt' => 'signed'], 200);\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61825e2893f99e54663b46920e30f62da99d0d54925669c9b0ce15cfdffba699", "structural_hash": "b69b9a334364ee1b24c2e001ecc9ad5dbf4fdf1ad0f2ca70017b4d9a3ee76692", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37320.go", "upstream_id": "BenchmarkTest37320", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tform := FormData{Payload: authHeader}\n\tdata := form.Payload\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\thttp.Error(w, \"invalid option\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\thttp.Error(w, ldapErr.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+processed+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tw.Header().Set(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f91220d049eda0d7c9beff52f0a4624c9fbd87317854317099bd693b4cdbcf1c", "structural_hash": "67c670b6f955b67588a16699c638e9d8a29944b72f4206e0735f42b6d6c48df7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05162.py", "upstream_id": "BenchmarkTest05162", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport json\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n try:\n data = json.loads(raw_body).get('value', raw_body)\n except (json.JSONDecodeError, AttributeError):\n data = raw_body\n if len(str(data)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3fff9c69e543e1fc740b817ed31fb17a056735d458f60a4c994f7b519dc8ecc3", "structural_hash": "d9374e3b71a409db3b8dff13c9d11c9f609d1da02a4da4d3dd544517b4ed9155", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04116.ts", "upstream_id": "BenchmarkTest04116", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n shared.authCheck(String(data), \"admin\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca4ecc908f54580ea93e1d223e373fa2a50656d21ce793db00df9ff4ccf3bd57", "structural_hash": "08ebbf42c13af7541b922dfa739933f2690c36944820793fecbebb9b6b4a2975", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00378.cpp", "upstream_id": "BenchmarkTest00378", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d891c1f210934de6d70cfb3808885f6d9c34aeaedcaae775e861d0f64f56158", "structural_hash": "6d212ad3a0d9950ba19b1f282ab6d4b43685fc9f54fa2562fbf1dedb827d773d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01548.cpp", "upstream_id": "BenchmarkTest01548", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n unsigned char _rnd[16];\n int _fd = open(\"/dev/urandom\", O_RDONLY);\n if (_fd >= 0) { if (read(_fd, _rnd, sizeof(_rnd)) < 0) _rnd[0] = 0; close(_fd); }\n std::cout << \"token for \" << data << \": \" << (int)_rnd[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f626ff54876f28f939f3e0238af5b0f1ba10e0321478cb8aff8e3ef1676bb6ea", "structural_hash": "6a970d3a8925abdc8e83957cc4f162f2f76aa43cb9b477452412c4b73d7fe3ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03342.sh", "upstream_id": "BenchmarkTest03342", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n cp /var/app/secure/template.cfg \"/var/app/data/$data\"\n chmod 644 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "271b2ee7c4688ac519c6466b99fda63ecd694a5d934e602e25d4e2d8896fb081", "structural_hash": "c75ed53ef2aa5b2c635b2ddee8271c8b0c9154f80c314ed62f620d47f67027c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38456.js", "upstream_id": "BenchmarkTest38456", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = `${userInput}`;\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08fb3a122a35c98cb41fa52fdda08fe64a0084a55b93beb36f2813ce2af97ac2", "structural_hash": "6f39bf5cb7b87068cf4985c53dbe84437dbaf8edf50bcb6f0a2a779fb218cd64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03663.rs", "upstream_id": "BenchmarkTest03663", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse rand::Rng;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data = xml_value.replace(\"\\t\", \" \");\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dd6e2764fd5542397936058157aad87d21fc9c2133eff7483a38000e3a3c9a3", "structural_hash": "1e93499dd34b22ebb6e7b2dc187a2a7f83b6fa11ac34b65300670af597233581", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04332.rb", "upstream_id": "BenchmarkTest04332", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = user_input ? user_input : ''\n content_type :html\n \"
    \" + data + \"
    \"\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "986999ce14cfd864a2973e05187bf8c754452c094973a7dea90e708f1e441f51", "structural_hash": "3d7504ad0c21633dcd53ae545d9af237e84049ad513ce7492b1a9cc7440d6edf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00679.cpp", "upstream_id": "BenchmarkTest00679", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bab53c493249e2700fff2ce58075c2d46e2924f79a8c13dfd6a82cb470d01238", "structural_hash": "f9219f2b5ff09b8143aabd6558ce97c3b6dc64026e6144dccf2f6dfab2def25e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02616.rs", "upstream_id": "BenchmarkTest02616", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"setting\", \"default_config_label\")]); m.get(\"setting\").copied().unwrap_or_default().to_string() };\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ct = crate::shared::encrypt_with_key(&store_cred, &secret_value);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1b780daba13f8a23d7050732a88cb7bca958258522dfcecfa96d22aea75baf7", "structural_hash": "46d3ea1e6af64269f2d1d652c126ac3a5bb590622089ec538b9fd4214f3be1d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03004.php", "upstream_id": "BenchmarkTest03004", "language": "php", "code": "input('field', '');\n $data = (!empty($userInput)) ? $userInput : '';\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d381e6448c266fd7cc338faebf6bdde02cd2b5ce6d3c8d89dccbf563844308f1", "structural_hash": "f35c6980f9bad72cd778d9e230905b87949d431fae151cfbf2edb69b7b55641e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01540.sh", "upstream_id": "BenchmarkTest01540", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94c03ed07bb0a38d6bc6f74493cbbae046a784ce91b4f2d2c0caded80a9bac95", "structural_hash": "30e6bf529961d497fa5284f929094b2bcb33ad3e8914f98c470dabb6b88062aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05014.ts", "upstream_id": "BenchmarkTest05014", "language": "typescript", "code": "import { Body, Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n if (![\".jpg\", \".png\", \".gif\", \".pdf\"].some((e) => String(data).toLowerCase().endsWith(e))) { throw new BadRequestException({error: \"invalid file type\"}); }\n const entryFile = path.basename(data);\n fs.writeFileSync(\"/var/uploads/\" + entryFile, \"data\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb6418405c46916cfbd22148b0097a7146c742b1fe27eeb745a23f04c907fba4", "structural_hash": "30fedd7ded588015e03c6792a431b946d8d3ec38a4cc74970074341604b7133b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05561.rb", "upstream_id": "BenchmarkTest05561", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n tokens = user_input.split(',')\n data = tokens.join(',')\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25d0d2dc77ad4940b9b4626ea9c54fc860838a49f6c90f0696030a8d45252403", "structural_hash": "66ac2c800fdcfa5bb9b13526cc3b01afbfddeeaecb025ab259ff93c343e3d712", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04824.py", "upstream_id": "BenchmarkTest04824", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request, path_param):\n path_value = path_param\n data = ' '.join(str(path_value).split(' '))\n return JsonResponse({'error': str(data), 'stack': repr(locals())}, status=500)", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1f25770c356829a2d53749ca9d2cecd6895d8993d4668ecabcedf8fd6d7ec18", "structural_hash": "e5ae4dc056661e3007c4e5ccfa34cb403c92a0f201c708c9bcdd5352c297cb67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02565.cpp", "upstream_id": "BenchmarkTest02565", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data;\n if (!user_input.empty()) data = user_input;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd726f20b095e49825d32e5795ccd0b52b6d09906d96485fb00fcc9d083d0ef8", "structural_hash": "decf9413a041823dba3d571ac79b35cc1d11f6e6ccb9e261dd7882cba41568bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04813.js", "upstream_id": "BenchmarkTest04813", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.DOTENV_VAR || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n http.get(\"http://api.node.internal/report?data=\" + String(processed));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "932ac89d42fce3981b44de9ab57072abebea712f35510de9c049795fe0e1f107", "structural_hash": "434a4449ac80c988b01fb9a41ade9794491044a0d10781d8d8d1b401267f3d20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03021.java", "upstream_id": "BenchmarkTest03021", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + multipartValue;\n String data = valueSupplier.get();\n com.fasterxml.jackson.databind.ObjectMapper safeMapper = new com.fasterxml.jackson.databind.ObjectMapper();\n String deserialized = safeMapper.readValue(data.getBytes(java.nio.charset.StandardCharsets.UTF_8), String.class);\n return Response.ok(deserialized, MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9eeda2b4945b02ca221f3d9f9ccdca1f91ab9ce4f95a681d588309fa0246e314", "structural_hash": "086d95ecca80a273924fee48497a262a661f38131ffe6a26f0a2d45dc658d9e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03324.rb", "upstream_id": "BenchmarkTest03324", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f051dea46f1b724d47af695da5b67c2f8bb5a8ff437d799beadc4baaea38c881", "structural_hash": "baa30665711b8c261551340169f29ca768e168cb82aa0be1ea14b8179fd8c85a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05988.java", "upstream_id": "BenchmarkTest05988", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String secretValue = \"app_display_name\";\n request.setAttribute(\"envelope\", secretValue);\n String data = String.valueOf(request.getAttribute(\"envelope\"));\n if (data.isEmpty()) { return Response.status(400).entity(\"request required\").build(); }\n String envSecret = System.getenv(\"APP_SECRET\");\n if (envSecret == null) throw new IllegalStateException(\"APP_SECRET unset\");\n String storeCred = envSecret;\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", storeCred)) {\n return Response.ok(\"{\\\"auth\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "426bca702d9c0a78063555d557b682607f17a2d9c9bb4d8f5e7b93cfbe045566", "structural_hash": "eabf0b6167cd4aa9b012bfdec2d74c438fd47eb5f73cfa8d32bf5ca3ac0c4806", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03986.php", "upstream_id": "BenchmarkTest03986", "language": "php", "code": "'invalid'], 400); }\n $processed = $data;\n file_put_contents('output.csv', (string)$processed . ',data' . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74485befce3916ad210feade20767a0c6d7eadc600b0d6a8c09ecc89cd324029", "structural_hash": "ff3e01bf6f622e1769b2b9f3a2b347e1574771880c40aa9d9efedab4373b6e72", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00857.rb", "upstream_id": "BenchmarkTest00857", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n data = user_input ? user_input : ''\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n render json: { error: \"invalid type\" }, status: 400\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf665ac7e37e1f67a802a34cdceced474e7fbfd85faa6ac6aee592cd8c6f4bc8", "structural_hash": "d60287261a50c332eac763f3cf08d005dcce8f0214f14a970c18865c5d33d68e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05027.php", "upstream_id": "BenchmarkTest05027", "language": "php", "code": "getContent();\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $data . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "480c187fb73882e5954756b7acd360529cf9faee03004b398a445795e0da9b23", "structural_hash": "c08bcc50bf1cfb9199bac8080ff243cbbdaacbcdf56047ef1f7bb35a1e4438c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01827.py", "upstream_id": "BenchmarkTest01827", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\nimport ast\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n try:\n data = str(ast.literal_eval(referer_value))\n except (ValueError, SyntaxError):\n data = referer_value\n if data not in ('ls', 'cat', 'date', 'whoami'):\n return jsonify({'error': 'forbidden'}), 403\n processed = data\n os.system('echo ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fce5d43bc13ef51d4338fb8a878b7b17f453db91ef4e369bde6b86574084222a", "structural_hash": "40356ba77d484ef2ebb89a6ff2e8743d983b7c643e0d4c6647cb717e83134de7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_16184.go", "upstream_id": "BenchmarkTest16184", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tlog.Printf(\"request handling failed (input length %d)\", len(fieldValue))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18bbea923b65c2b8d229e5283ece6d512a35c38b2a1cf1ac7ca1fda064e12905", "structural_hash": "7565658137d1c08f12c7b977adb64dfbdfa66ac7deff427a7b107db16a30ae00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15000.sh", "upstream_id": "BenchmarkTest15000", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n processed=$(echo \"$data\" | tr -d '\\r\\n' | sed \"s/[a-zA-Z0-9]\\{4,\\}/****/g\")\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4021d7ba016c3f8f5c5af44d6d33ae49063a1c513b4f964bd6a1f107d7580940", "structural_hash": "fbd8788ab14006809ccff5ad2b144d3f25f390ae6df89f332a80c631cb82e256", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04314.rs", "upstream_id": "BenchmarkTest04314", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(auth_header.clone());\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76921ca2962f7e547fd8e9175079c3e0d8c1989ac68501fb709ea98fb06c96b7", "structural_hash": "5e8696d939ce664e082ab66328f925ea5ba169df9eca6c37e66ec29f1ac65a9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03358.cpp", "upstream_id": "BenchmarkTest03358", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Forwarded-For\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n res.set_header(\"X-Trace-Id\", safe);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9daeabfd16eae882623012ab9ca9754ca05d9366fc8ad01975348731fb7d222", "structural_hash": "754bd285f9ffc76cda03f57be3796ee883f1ec76111c2c02264cc5fab10c6be2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02163.ts", "upstream_id": "BenchmarkTest02163", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "122be13a054c85c7ec3058b44350b5dd5812e15e81b287172fa81355dc08529e", "structural_hash": "20e75a3f23da8e254e04c027fe8b507ff99a6d670aed112d9e72b968de25f58a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00632.rs", "upstream_id": "BenchmarkTest00632", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = auth_header.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4afc7fe39c3769647b270cce415efb8711b62f398b68890a7430de55e6e11ed", "structural_hash": "88a9f18c7abe3550568ae68f2a5855643cb769949ec29a25596c400203d8397b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03400.cpp", "upstream_id": "BenchmarkTest03400", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "731ce42a8a66bcd94eca3064b048761745073a41a1c996565b9c3fa1bb1ee9c4", "structural_hash": "bbd6e1fd11ab53ae51a87097c5227ac531bef7b8637ca7878aacaf5ae7fd7e4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02028.cpp", "upstream_id": "BenchmarkTest02028", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Referer\");\n std::string data = std::string(\"prefix-\") + user_input;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cbbbdbac503e8a2253ffb3c42171428bbdeb869fbd3f6a72741c5a1fec368f5", "structural_hash": "5dc0a842e9d9de83d437f80bf897506dbdbb0eabfc3d688cef47ca396fd062ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00915.ts", "upstream_id": "BenchmarkTest00915", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "253d80a963687a190f132228503f98ba296ec3229fd4cd07c4cfbf2ee747c4d2", "structural_hash": "a0898593802d2fea3aecdcad86aea6b932c13113382f3976b9282bef293f0e69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01567.ts", "upstream_id": "BenchmarkTest01567", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c27c7dd120ec645e423b1513809516934c5f2fa97bc6b2a57812decfb873533f", "structural_hash": "dd65b6443b69a45a9f87b76ff1824907c984d626e157c51d3a9dda32e99eae88", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03353.php", "upstream_id": "BenchmarkTest03353", "language": "php", "code": "cookies->get('session_token', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $host = parse_url($data, PHP_URL_HOST) ?: '';\n if (!in_array($host, ['api.corp.lan', 'cdn.shopcdn.io'], true)) { return new JsonResponse(['error' => 'forbidden host'], 403); }\n $targetUrl = $data;\n file_get_contents((string)$targetUrl);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8ff730eb462d8948181131a63a3bd4e0c47c78783e5576ead6875410a7f8d36", "structural_hash": "27a1ca587a0c8367630767623b3b281e496eed104f2345b572cbfa746cd9d019", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25181.sh", "upstream_id": "BenchmarkTest25181", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6abc2f765751aeb93d7aecfe7ff51593652571f08f3ae218edacd7b5e52d513", "structural_hash": "2786a2e0270dcc34af809217c5c5b3f4836e9297e2887c7e729aa04de5492881", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32440.sh", "upstream_id": "BenchmarkTest32440", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n cp /var/app/secure/template.cfg \"/var/app/data/$data\"\n chmod 644 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02f15bb720dfac8ec710d4e0723016fdd235ecef5b08bbcbd021d4bb50896980", "structural_hash": "0f56ea2cb897a676bd535c98cbedae8ada353caa184b31a39345df88d58d57e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25348.sh", "upstream_id": "BenchmarkTest25348", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n cp /var/app/secure/template.cfg \"/var/app/data/$data\"\n chmod 644 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50cab51e1d063cffa09357c2db27207ea433e09ad17840a4ee46de1b916f93aa", "structural_hash": "579c3460d85778bf64719d3adb7a31681fcd73526dd215e06e8cb9d5b53c5f36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01074.rb", "upstream_id": "BenchmarkTest01074", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c5dbcf0443a79ba14d4cbba73f95059f1e5854b5e277552cd8f7c6be1ca4894", "structural_hash": "1cd418db8ea34f78f4afe2fd08cf6f98d3db7e4b20d81e8250f6d7308052eeda", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00539.rs", "upstream_id": "BenchmarkTest00539", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n data.push_str(&json_value);\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7ac1116db73adf4e4f85292bab1be6352cd1f4cfccf311deaff62d1a18df2e7", "structural_hash": "949f33301afe4fba38b0f4832e89be475504c80421e1d29b8b8c3df64c802cb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03602.rs", "upstream_id": "BenchmarkTest03602", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let queued = forwarded_ip.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n if std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) > 0 {\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a40ea185014b017fc5403b980599834b6fb0a70df0ec434c02c92be1976019b", "structural_hash": "3049786b05a44520baf7c939845def76ac77676105e22b2cd263f883561965a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03739.py", "upstream_id": "BenchmarkTest03739", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport json\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n graphql_var = json.loads((await request.body()).decode()).get('variables', {}).get('input', '')\n data = ' '.join(str(graphql_var).split(' '))\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "987f9fb5e808fee08ae2f2cf558e5328d4fc39afc857aa519ac9bd5edb8c1eb6", "structural_hash": "91c2b130f46e68e6b3a8d1330becd1dfa6ad6896b1a5ca2a5dbdd3cd7be0ab99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04689.rb", "upstream_id": "BenchmarkTest04689", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n data = \"%s\" % user_input\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a1e2361b0da6a5d6552a6454da74ef836b0669b5d322b0023ce690324c4f595", "structural_hash": "5ca37c7f163a04642e19871ea0a4ce5605c8a4652220a5b28361020e2e9eedcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02567.rs", "upstream_id": "BenchmarkTest02567", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = serde_json::from_str::(&db_value)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54efeeaab1976d6c8606d0f922bcee5c1baf3f0335a5feeaa8ca7a2ea12b6bd2", "structural_hash": "754a45d75861e20a8abe68867b9646e9169954d4e662386aa96f48a2b218884b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03663.c", "upstream_id": "BenchmarkTest03663", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_PADDING);\n RSA_free(_rsa);\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee5254212dd904c81462b8747b78c715be25d286043bf00fe1bc1421ae8bbfb8", "structural_hash": "c68b98dd3dbaf9b804a6b1b3396295ed7359cf693c4f0252bc78b064c95cc69a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02160.java", "upstream_id": "BenchmarkTest02160", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.Map.Entry pair = java.util.Map.entry(authHeader, \"http\");\n response.setHeader(\"X-Tuple-Context\", pair.getValue());\n String data = pair.getKey();\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "016323cfbab0f9858ba99ee3b25b59bd722054c1654750e8115e15a72f32cdf7", "structural_hash": "0c9fc33b5090a6aac52507f6933fbe3911b90dcc19694e04499c04ed08d40071", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03784.py", "upstream_id": "BenchmarkTest03784", "language": "python", "code": "from django.http import JsonResponse\nfrom django.shortcuts import redirect\nfrom urllib.parse import urlparse\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n parts = []\n for token in str(header_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return JsonResponse({'error': 'forbidden host'}, status=403)\n target_url = data\n return redirect(str(target_url))", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25d85214909f964ff983309fc94d29e5e7657a97d94952945d6ba6af84f6d5eb", "structural_hash": "7098a4b390e1cf1bf92738b302ac29d1c2dceb620aea29fee56ba7e11426f80f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04187.rs", "upstream_id": "BenchmarkTest04187", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let mut data = String::new();\n data.push_str(&field_value);\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be8e7fa7f22d6d89553f0a237b4fd750b3d40188e42cc9000f974bd67e1d0cc0", "structural_hash": "ebecac45ce4b552b633eda127cc5955425393375763649e68cc4e5de75ccf3da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_31358.js", "upstream_id": "BenchmarkTest31358", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e16a724e5bdb6c9358b5922f94dae390dc23e961905516904724b42412a262f", "structural_hash": "b44ceffd805d25013442474b5492e6e43c92ec5df907805a4788df1517b523e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00505.ts", "upstream_id": "BenchmarkTest00505", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = await Promise.resolve(userInput).then(String);\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n return { listing: entries };\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32aa96c6aef0cabb819995fdfc2db0bade8c848da6ed8beb10fc4ba1e6aac996", "structural_hash": "ad8fb5958515a79c361f9957a98b5ad25715eb4034740e23c3d83cb3a97bf0ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03946.c", "upstream_id": "BenchmarkTest03946", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f68d9408338021d5c6b5937f23184930a4e7e3ceeb846d7a0d606edd37f739d", "structural_hash": "a0231bffa35a2a55348cf7a2a8075a970b462aca2f08f75616de30b666d1e310", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01250.php", "upstream_id": "BenchmarkTest01250", "language": "php", "code": "header('Authorization', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d620ec55850ad81589d588d6feb30a269a64ce7fc8e2df51a54647f11a48616", "structural_hash": "e4b0a42fd3bbc8d3ae6a66585954972acd28bc2b032c8550e17f8eb4b5414b67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37217.js", "upstream_id": "BenchmarkTest37217", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = process.env.APP_PROP || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6291f9677d31e6fc16cbdab82fd4ff4411a3732887d5030f9fce4b1ac643bd15", "structural_hash": "ce06e2df20b94434a359e6ce93a93c1a8c74224b7c1f582eb58046dc30162900", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_40479.go", "upstream_id": "BenchmarkTest40479", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tdata, _ := url.QueryUnescape(userID)\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c28388b0f50127e202718fb3b3c3703880ab5eb2034b36911435cccc027c617f", "structural_hash": "220ac63d620ef51d018228994093a16e5432564e16ef7e0eb1753e421b6fe9a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03135.ts", "upstream_id": "BenchmarkTest03135", "language": "typescript", "code": "import { Body, Controller, Header, Post, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const data = userInput != null ? userInput : '';\n return nunjucks.renderString(data, {});\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34f1bc7984c43892fb2bfb9ae08150e4b8e73d9909d6dadcf63f0708e55ee2bb", "structural_hash": "30125f3f006d4fdec049d1532005214ac9c39a94c984f93636fdb9addba79d9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04764.php", "upstream_id": "BenchmarkTest04764", "language": "php", "code": "input('multipart_field', '');\n $data = (!empty($userInput)) ? $userInput : '';\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a921593868936565232bb07e9d7df43838c91e89eeff58e42cef7bbc60956442", "structural_hash": "ccfdd876497c95f9970c38dff80fcfe076070cba9f76a2a1986300d674986364", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00762.ts", "upstream_id": "BenchmarkTest00762", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n res.cookie(\"session\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8e15cdbfb247eab920534d12e2b3b5367d890d6ba964f9a04b18cdaa0a465d2", "structural_hash": "d9b1b794ecfc7a4cae2f7c5b6310d5624aa6ebf841981bdc5a37df0324de5c44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00953.rs", "upstream_id": "BenchmarkTest00953", "language": "rust", "code": "use axum::extract::Form;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: field_value.clone() }.payload;\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d59766420df8f57f827543ae89b2958be4a577c5c84c9a0b893b09736b3bdf98", "structural_hash": "3aa6cec44df1f293743c15de1eab7c7af85f93c9cfb6240a1922e7266d2ccb85", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04972.php", "upstream_id": "BenchmarkTest04972", "language": "php", "code": "query('id', '');\n $field = 'data';\n $$field = $userInput;\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab2dc79bdb972667a15a65c28a03ba32e391ddcec898e8a3c5eb545f21af3909", "structural_hash": "9fc02306472c052d5b49bd9303a07945e3a66d7022bf6834be5f6cbf8e4bf101", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00093.java", "upstream_id": "BenchmarkTest00093", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.util.List tokens = java.util.Arrays.asList(forwardedIp.split(\",\"));\n String data = String.join(\",\", tokens);\n if (org.springframework.security.core.context.SecurityContextHolder.getContext().getAuthentication() == null\n || !org.springframework.security.core.context.SecurityContextHolder.getContext().getAuthentication().isAuthenticated()) {\n response.sendError(401, \"not authenticated\"); return;\n }\n String oldSessionId = request.getSession().getId();\n request.getSession().invalidate();\n request.getSession(true).setAttribute(\"rotated_from\", oldSessionId);\n if (request.getSession().getAttribute(\"user\") == null) { response.sendError(401); return; }\n request.getSession().setAttribute(\"data\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f2a37d935f13e73bdc249475fac131af810a8f7f5df354e37a2da00206a6637", "structural_hash": "dc176f8ce1e260f49b41d8b7d13ea5344cfa86e004d42b45e738ab99dc3eeff1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09967.c", "upstream_id": "BenchmarkTest09967", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n const char *safe = data;\n if (strcmp(data, \"config.json\") != 0 && strcmp(data, \"data.csv\") != 0) safe = \"config.json\";\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", safe);\n FILE *_f = fopen(_path, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1769fc5cd96a2927d869afa8009e9dfac364b2572d4fba72314ad0d0467681ae", "structural_hash": "57326b2eacde4f40499ce6cd433726f0ab5be48a3ad507a11ab02597214ec984", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04496.rb", "upstream_id": "BenchmarkTest04496", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = \"\" + user_input\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n content_type :json\n JSON.generate({ wrapped: wrapped })\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e187406964af3e4e19b0f35d953795198588e9e5d0c33ee6d4a1464a4f44eba2", "structural_hash": "5d78b838f897f7d4fd55a85915c74056349a5793a12cb55747df64d692d2fc9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08281.c", "upstream_id": "BenchmarkTest08281", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a441fc1ce75ac3679c1fe488bbca5f7d2e2abc06b232e0ccee2ade14a27c8dc", "structural_hash": "cc1a5ac1b158f88a2284e934256191e4926a2df5ba9ff0943294da1e7cfe1b30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_06002.py", "upstream_id": "BenchmarkTest06002", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(raw_body)\n data = collected\n def _primary():\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n _handlers = {\"primary\": _primary}\n _handlers[\"primary\"]()\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2af23dfc6bd08ef28b98c1f6c341de8c5660182325cfad643c118049cb4dc53", "structural_hash": "75b2f84e3c0c235ee5fbbded3b98450650a55fd16c5d6ea77595cc8868f4b8e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01814.c", "upstream_id": "BenchmarkTest01814", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "397991d92e728f7fa1fcde0f3651642306efbe4d26248c0a91862038c1b746f7", "structural_hash": "1adc5ba8130cea6a9f48a5c9ff66786f924094ecad0c25ddebcc9edc6867452f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04821.php", "upstream_id": "BenchmarkTest04821", "language": "php", "code": "input('multipart_field', '');\n [$data] = [$userInput, 'http'];\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d140214a0740d6a2d6890f30db4e9aa364ae98518e2caed082937d7fff475a0", "structural_hash": "d4590c80cb98632c38b0e0f62cccd74259e58dd6a242503333475a426c8e80dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04310.rs", "upstream_id": "BenchmarkTest04310", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = if field_value.len() <= 4096 { field_value.clone() } else { field_value.chars().take(4096).collect() };\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5fcfa4cb78fd00250589649a0d695900a6be2df929663a52a8754272223c308", "structural_hash": "8e58206552415016189972400ae06edb385a5607dda0a736350de406fa130e79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01127.java", "upstream_id": "BenchmarkTest01127", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data = String.format(\"field_%s\", originValue);\n Object evalResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff63f2d6b05d8ba52c8f79c1e55c587559682571a918b5e1db23106728e8c1ac", "structural_hash": "999fa474c74f68e47a0fe220a0d0b4d805c1a81c65ff1af435b5e17688dc184e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04968.rs", "upstream_id": "BenchmarkTest04968", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(cookie_value.clone());\n let _role = data.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "baa055c897c8d017a9997c740f69f3c821b187df03559990224176e4f27fa9ae", "structural_hash": "a02e760b7e009f9a0387d416009b39ac13c4e13076eb57608b52a712f624c2af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05228.go", "upstream_id": "BenchmarkTest05228", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(multipartValue)\n\tDB.Exec(\"UPDATE users SET role = ? WHERE name = ?\", \"admin\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-286"], "category": "incorrect_user_mgmt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9689a5a4cbd15c55bb72bb81eba7293ec6f719feb778368948aa46357de96e9", "structural_hash": "59706083d0772e55ee3f1aeaa1a54a02d3c28a6dabbc1832411cfb8dd73c9e3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05234.php", "upstream_id": "BenchmarkTest05234", "language": "php", "code": "header('Host', '');\n [$data] = [$userInput, 'http'];\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$data . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "312bd19e48dabd82a879448198265a2c546355259a3c61bcbfca7ff350b5c564", "structural_hash": "cdd229dd4b3fc7e64513e6a9d75c254eb433f75943bce2aee80e5a1720fd52f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16671.js", "upstream_id": "BenchmarkTest16671", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!/^[\\w-]+$/.test(String(data))) throw new TypeError(\"invalid input: \" + data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44114c5e165fbfb8798699343c1a3cf5b6a1b73a2ad92087ef79039d5fcf73ff", "structural_hash": "83bd95a5b98a182fe5eda7e6bc145b75355f56cefbd630fc3a1563d009ec5672", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00627.cpp", "upstream_id": "BenchmarkTest00627", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n if (data == \"admin123\") std::cout << \"authenticated\" << std::endl;\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2bb9e2ff143d7c07d9d3284eca1856b48ee048c942236320fc9249dd4579bfee", "structural_hash": "375ffd9ee539994ec7c55243db8fc8878ee34c04859469f55181062b19f4f3d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06417.c", "upstream_id": "BenchmarkTest06417", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n xmlDocPtr _doc = xmlReadMemory(user_input, (int)strlen(user_input), \"noname.xml\", NULL, XML_PARSE_NONET);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc08f5e82a8cf8ee34d9d232cb66670154e89cf50345f5e22602ad8631a82f22", "structural_hash": "e318b49c8c16f249655105bc7804a5b2b77376c7217c1f340dfb1604bf912b6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01589.java", "upstream_id": "BenchmarkTest01589", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> commentValue)\n .thenApply(v -> v.replaceAll(\"[ ]{2,}\", \" \").strip())\n .join();\n Runtime.getRuntime().exec(new String[]{\"chown\", \"root\", data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf385d74084c943965daff9995ddae3f623a086d20ec6c325a5faacfc7f01ec7", "structural_hash": "480a97a11d42e884556c7e0f52956f887adf521ebc3983139f04c8ce3e6c0157", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09083.go", "upstream_id": "BenchmarkTest09083", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(cookieValue)\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c163b587b640463fb9200447273a83c35e449dd6f68bc5f7eb906b800cade508", "structural_hash": "e4bf086770310d08639247397b2f64efafd4b9160af7b69dce4975cea2eef740", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10675.go", "upstream_id": "BenchmarkTest10675", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tdata := BenchSvcPassthrough(userID)\n\tcrlfStripped := crlfPat.ReplaceAllString(data, \"\")\n\tprocessed := redactPat.ReplaceAllString(crlfStripped, \"****\")\n\tlog.Printf(\"User action: %s\", processed)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a19ab650c7333e4a4b492b243a0271f63c7ccba30f051ed5fe5a8d775d62c0f3", "structural_hash": "afeef3ae55972b6b0f1542620b0f7a3ab15e2354f98a915303b3c8da9ad9d4f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_39152.go", "upstream_id": "BenchmarkTest39152", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\tdata := func(v string) string { return strings.TrimSpace(v) }(configValue)\n\tcrlfStripped := crlfPat.ReplaceAllString(data, \"\")\n\tprocessed := redactPat.ReplaceAllString(crlfStripped, \"****\")\n\tlog.Printf(\"User action: %s\", processed)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27926748c158114eebabf29669a8970b4cd0afd807096faf2a3a48e53cc7110e", "structural_hash": "eea31015da71f7d9b22ba562dfc43c5dc7d80543684f6ee36d4135db159bb885", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03830.ts", "upstream_id": "BenchmarkTest03830", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n return { token };\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fb46b243e7c970edba68d7312c6c6c797f69ae50ae99da4f1c02cfae31780a5", "structural_hash": "42ccdc5ca99b0f00d1bbada38f4aa0aaddb3fee1dc63485067b69ffc93497d1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10581.c", "upstream_id": "BenchmarkTest10581", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41e5b2905ef81e726db17efbd6b454f89287f4dad67fca24a413787375e4cb97", "structural_hash": "0910e955b699b33260679bbe87b0bb56ec14541349e274a8de5354b26135d9a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05916.rb", "upstream_id": "BenchmarkTest05916", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = sprintf(\"%s\", user_input)\n File.write(\"/var/uploads/\" + File.basename(data.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce364a356ff38a6f6b349846b3f78ee7df66c6e4132fd965fdea8bd3abdc893c", "structural_hash": "dbf890e6bbc7dfb424d6301cb3568eb72cbae0176a9e59854e603ab7d1eb7e03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19406.sh", "upstream_id": "BenchmarkTest19406", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n printf -v data \"%s\" \"${user_input}\"\n eval \"echo $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "889df4c4de80ca92b3b77e5b5ef9d5b7b9ed84d4c8056dd5bdd19bfd861cbf6a", "structural_hash": "9b06c1cd1bac098ad6583acd0004e703acb9914f7f4604f2091746beb997cdb6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33760.js", "upstream_id": "BenchmarkTest33760", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const data = `${userInput}`;\n ctx.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e36afef28800ffdb99d332c33e4b38b68255a69bf2bfac31cf947502ad67ea42", "structural_hash": "bae89cb4f22a7a9f537e824738266268c4e22cf3b634ddf1deb39898a5c92b07", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01292.java", "upstream_id": "BenchmarkTest01292", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n response.setHeader(\"Access-Control-Allow-Origin\", xmlValue);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ab971e5e70173191a86ad3a0292f38c24f9a7cc1315c9d40524280ceb38c81f", "structural_hash": "619bcd87a49f832a9032714732e850c5c0c1ff193b526da435638c329db97eee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01466.py", "upstream_id": "BenchmarkTest01466", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = '%s' % str(raw_body)\n key = RSA.generate(1024)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94d1e1ee5cae4c67770671a04520d4b75c56fac82e0c234a65e34ee7dcca58b7", "structural_hash": "89ebf92d8b69273703b36865b227486d5a4b909a044d2a44937bfaa598d5ccf5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33189.sh", "upstream_id": "BenchmarkTest33189", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT bio FROM profiles LIMIT 1')\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n _h=$(printf '%s' \"$data\" | sha256sum | cut -d\" \" -f1)\n if grep -qxF -- \"$_h\" /etc/app/passwd.sha256; then echo \"auth ok\"; else echo \"auth failed\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad79cd53869ff70e7e26938e21880c32179a5cd586716aefaf5ff8a3b07efea7", "structural_hash": "9e34b9e004ad9f1beb886a7fca9a71fdb45fa818d981b156e4680d6f6902d64e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02285.ts", "upstream_id": "BenchmarkTest02285", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n req.session.id = String(data);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f9e544827d50e135d3c0bbc080a97a75d13c88221c5a937e1f42259427207ac", "structural_hash": "5b3acf028fc946b16ccf79804a87e0231fbf15e5962bb189c1004127a863de27", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04223.py", "upstream_id": "BenchmarkTest04223", "language": "python", "code": "from flask import Flask, request, jsonify\nimport json\nfrom app_runtime import mongo_db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n try:\n data = json.loads(host_value).get('value', host_value)\n except (json.JSONDecodeError, AttributeError):\n data = host_value\n mongo_db.users.find({'$where': \"this.username == '\" + str(data) + \"'\"})\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e01cfa1bf392291d0203b6479331a9f557247def16582323554050cb569c9d3", "structural_hash": "a0e177771695d25c79f344020ddd3f39926a8e450dc0aa6cf6ea6b940f01253c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00894.sh", "upstream_id": "BenchmarkTest00894", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02078b4f88041753a2fc6435da7a05e56c77434ee5ad3502c3edee0a38654e92", "structural_hash": "ad36a6fb458bb71a8378bf7e359ba23276df03eb8b39432233b4c2538fe7eb7a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01055.php", "upstream_id": "BenchmarkTest01055", "language": "php", "code": "getContent();\n $data = trim((string)$userInput);\n $hashed = password_hash((string)$data, PASSWORD_BCRYPT);\n file_put_contents('/var/data/output', $hashed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a39c1692afb18045f44ed962b111d96c22f79ba1bdc2999a636278d9e4bfecd9", "structural_hash": "9c16a99a698ceddc20320230f3329fec67e985a3e827359317987dc13aeaf908", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02961.py", "upstream_id": "BenchmarkTest02961", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = raw_body.decode('utf-8', 'ignore') if isinstance(raw_body, bytes) else raw_body\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return JSONResponse({'error': 'invalid integer'}, status_code=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JSONResponse({'allocated': allocated}, status_code=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e4bc4825443afdff73216f71f8d7ea48f7f2eeecc290e449fe15f17fbda91dd", "structural_hash": "8a7955c04326ae5ef6dbedc31fc5754baaf37056a744bf1dec9821239b20478a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03452.rb", "upstream_id": "BenchmarkTest03452", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n if [\"https://app.railscdn.org\"].include?(data)\n response.set_header(\"Access-Control-Allow-Origin\", data)\n end\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1cc4380b0e581b49cb8c47b4803bd5b944aa7fcba97f818efd9e8bf366b70b7e", "structural_hash": "4e1570eb11f64114b18f3d6ea2b2fb8d7730adb975605a220d4e54ab50aa72e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_14414.go", "upstream_id": "BenchmarkTest14414", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tpending := strings.Split(userID, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\tpanic(fmt.Errorf(\"invalid numeric input: %w\", err))\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cb07b4c2176ea385a62f8cfab6039c10dcd32e2e548569ef7a28a4122eaf1d1", "structural_hash": "117a79e1ceef4c6b7915b315d52b5f3a0d744eca00a3651bbd8f6036e0d49719", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04015.java", "upstream_id": "BenchmarkTest04015", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : headerValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.KeyGenerator kg = javax.crypto.KeyGenerator.getInstance(\"AES\");\n kg.init(256);\n javax.crypto.SecretKey key = kg.generateKey();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "672ba2ff5d054520b82533533bebb83c20a256c66c427391d1b32b169c634692", "structural_hash": "428a0a99fb044135b015d98ac8ce2fdf2b5679a496b3a1ad02a5aa3b7ae5eac6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00650.sh", "upstream_id": "BenchmarkTest00650", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bcfc7ad3ab46253bc5308aff777ede0e655b84313f9dd3fba0a22034aca9aeb", "structural_hash": "2a62fb427648f0b60f9d501e7de797fbbdaf5a31f767d1a644d70263dae9e7c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05273.java", "upstream_id": "BenchmarkTest05273", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(userId);\n LOG.info(\"Action: {}\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "942b67aaeafd6f86a3b823853c9a1c79fc0e2a56614de8e0385e46e66f55bc94", "structural_hash": "f2d9f666b40d36a91c3df929aa6e28ce95bbeaeda4ac7a8ae12ab3eeb2d1ab75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05007.php", "upstream_id": "BenchmarkTest05007", "language": "php", "code": "' . $data . '', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92ff03430be4ca40654f14eb1758fd5ba160c88e139e91e9806bbc0380403f2b", "structural_hash": "b717013001ac11585d820c199a9b6a5a49e2f7e0a684e2c20e1f69863caba3c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01859.rs", "upstream_id": "BenchmarkTest01859", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"setting\", \"default_config_label\")]); m.get(\"setting\").copied().unwrap_or_default().to_string() };\n struct FormData { payload: String }\n let data = FormData { payload: secret_value.clone() }.payload;\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ct = crate::shared::encrypt_with_key(&store_cred, &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0d23c6fc5dde0f229be80cf1d8b64f67c246b0cf05ebb81dcb3ff8acc65f6bf", "structural_hash": "dc8d7f5e06e2918cb6d073a8fe8be9f4fcc5733ed889053dc13b83829980e043", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00731.c", "upstream_id": "BenchmarkTest00731", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85e6b55ce06dce6beafc603dc1d95b4dba3ecadafdc14a22860efa23f7869b80", "structural_hash": "e8352cc205de70b06110441f0aed0b168405892ee42e79802d0b995923e0080d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04220.py", "upstream_id": "BenchmarkTest04220", "language": "python", "code": "from flask import Flask, session\nfrom flask import jsonify\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n data = (lambda v: v.strip())(path_value)\n if session.get('user') is None:\n return jsonify({'error': 'unauthorized'}), 401\n session.clear()\n session['user'] = str(data)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd8c7ef650b82deddaf742beea4c3dea351bca3a8cf2d090597e0a11ea6fdce2", "structural_hash": "addc848e183f9953c5c6030ba1e07c444d682894abe1653c887c7162b505defd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00530.rs", "upstream_id": "BenchmarkTest00530", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse hex;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = String::from_utf8_lossy(&hex::decode(&cookie_value).unwrap_or_default()).to_string();\n crate::shared::db_query_bind(\"SELECT * FROM users WHERE id = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f537d5e0a2e4755ad7af25e3f6048880c33d30ca36afbb8f6a6f13ad060a96dc", "structural_hash": "96fb8dda16cff0b13afa4f0fc6b4df808b4f66a251e551c8ede764532855da95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_30849.go", "upstream_id": "BenchmarkTest30849", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- originValue\n\tclose(_jobs)\n\tdata := <-_out\n\tc.Header(\"X-Custom\", data)\n}", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54747d49c43cf08f3744842e31af2326bd1c5e0e24091f9ce739730a2d8fea5b", "structural_hash": "b41a61e2c680da23b8e0a955ad8c8888a96b0e86a7c1165a52d692a07f615d2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_31912.js", "upstream_id": "BenchmarkTest31912", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { res.status(403).json({error:\"host not allowed\"}); return; }\n if (!allowedHosts.includes(parsedHost)) { res.status(403).json({error:\"host not allowed\"}); return; }\n const targetUrl = data;\n res.redirect(targetUrl);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1022"], "category": "window_opener_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "530f8dd8bdf5e08ac848bc6da47b10ffd420b21ab83bfb919b6a3f23eb7fdf04", "structural_hash": "a7577c0369c8b857f292cbe9cc971771f1de32f7d81159cbc75db16b23f88361", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01961.java", "upstream_id": "BenchmarkTest01961", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.sql.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = userId.isEmpty() ? \"default\" : userId;\n try (Statement stmt = connection.createStatement()) {\n stmt.executeQuery(\"SELECT * FROM users WHERE id = \" + data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8ccc43b77da22f8f23dac330dff571806361b399ede508faaad2e0aebefc35e", "structural_hash": "f2f383f4d387f2b502dabbe9364c3c3d312fe0a330f8bc269d46b32f75d4303f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05365.rb", "upstream_id": "BenchmarkTest05365", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n if parsed_bool.to_s =~ /[a-zA-Z0-9_-]+/\n render json: { validated: parsed_bool.to_s }\n end\n end\nend", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e48fc6cef10ffc39c77e78576945b9634298f50b54ebdbbe6e0cbeaf2511edb", "structural_hash": "54838e56cf2452dbd63041557029e0dd3eac47cfe21fbab18f09a1389b6382df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25472.sh", "upstream_id": "BenchmarkTest25472", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n mysql -e \"SELECT * FROM users ORDER BY $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11dfa70729a3bbd4f412e3fb07d42f368195fe1647f186529741050936d888a6", "structural_hash": "f32d6a00ee98bb4942292679877d42bfbe3898bf02d29769bfca109c729fa8f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00559.java", "upstream_id": "BenchmarkTest00559", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.Semaphore RATE_LIMITER = new java.util.concurrent.Semaphore(10);\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(commentValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n if (!RATE_LIMITER.tryAcquire(1, java.util.concurrent.TimeUnit.SECONDS)) {\n response.sendError(429, \"rate limited\");\n return;\n }\n try {\n byte[] buf = new byte[Math.min(Integer.parseInt(data), 1048576)];\n response.setHeader(\"X-Alloc-Bytes\", String.valueOf(buf.length));\n } finally { RATE_LIMITER.release(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fa4b6059d814157b7a6cb8fbb207888a2e556f787b0a13e823bbbd0b09f138b", "structural_hash": "0571889d6e6f425b3536afc86ed33092b9bc485cb41711f33a39555cf892b590", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17072.go", "upstream_id": "BenchmarkTest17072", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar _b strings.Builder\n\t_b.WriteString(jsonValue)\n\tdata := _b.String()\n\tentries, _ := os.ReadDir(data)\n\tvar names []string\n\tfor _, e := range entries {\n\t\tnames = append(names, e.Name())\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]interface{}{\"listing\": names})\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6971866eca92a4eb24220b424898f93b4b71ff727a54b8301fbbc87dc5a8158c", "structural_hash": "0a57ee745dd6b8bef641de9b4f7898bc21a76e1f81a4cee0501ec60f58d2c9b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36315.go", "upstream_id": "BenchmarkTest36315", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdata := strings.ReplaceAll(cookieValue, \"\\x00\", \"\")\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := resolvedPath\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19c535b1d80e202aa7002795ac10af6db10dd8b3586c1b0496dbc614241adbe2", "structural_hash": "5d9aa82aee91099f4840e687e42af2a6b8ffd9f8ee43c1f2789ac7b29a251cb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03412.rs", "upstream_id": "BenchmarkTest03412", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (payload, _origin) = (ua_value.clone(), \"http\");\n let data = payload;\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bec8c9adf109840716995112b883b1a4746e99f2e45c3b90f0631978b4ff81ea", "structural_hash": "a2545bd0ea4cf33c373e93725033aaf6a1ef17a5459c2db5d1317a09c57a51d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00705.ts", "upstream_id": "BenchmarkTest00705", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5dc33acd828ea945eee9aeaabf9ea545267c5a7e2f5aad72af6e498be10d3aef", "structural_hash": "be5695147bbddf910dd0cde5bd180acd00b26a10bb38d3af1eb9f927b4cd28dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01717.java", "upstream_id": "BenchmarkTest01717", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + hostValue;\n String data = valueSupplier.get();\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "495d22e328e9de634e090e31e4588a68f7ced28acb7f8b8bac4b28e7c90107ab", "structural_hash": "6f92ce297ae75973a017ca8acdc1f9a1e57c42b9131472d6e45187f1c49f8916", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02418.cpp", "upstream_id": "BenchmarkTest02418", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0fd39f62b95a6b4049c1915978ce1175b9ff9f206e9059fad6ddbe7d528d96c", "structural_hash": "2ffea0b29ee87664061d4e979ac116bb4fa08aaea0546857956729fa884e3501", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00127.py", "upstream_id": "BenchmarkTest00127", "language": "python", "code": "from cryptography.fernet import Fernet\nfrom flask import Flask, request, jsonify\nimport os\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n ctx = RequestContext(forwarded_ip, source='form')\n data = ctx.payload\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64e2a3371633953fe89207582cb7eb1d8fe0c4986a4797782d3b688e19cc4793", "structural_hash": "9f5181958c0e7cb25b20ab304cb67ddc7a428d150c681dd6fa33ad08089d5aad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10784.c", "upstream_id": "BenchmarkTest10784", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n long _n = strtol(data, NULL, 10);\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d256f09df930ec424f499aca72882c30c8bac1b101b921561546afdcbb3a724c", "structural_hash": "eb730ed0e68aa66c0d8400201c4e329a17b1ef99de4f364c0fc3d225840e6baa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16500.js", "upstream_id": "BenchmarkTest16500", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send('');\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7be9a564b82a69c37c395afe8ba39985daf7fc2f8861adaa4636d770322353a7", "structural_hash": "a0789ef5a6f5a45ab1c40b870d5fa1f7599fd2946060a44e85f58a100eb4040a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05622.php", "upstream_id": "BenchmarkTest05622", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $data = str_replace(\"\\0\", '', $userInput);\n $result = DB::table('users')->where('id', $data)->first();\n if ($result === null) { return response()->json([\"error\" => \"not found\"], 404); }\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0340f4ab01a62c7669e856104eea6957745c6192dca8e1461d3ebd77e06afa6b", "structural_hash": "7e134dc2f94a79ccf658e43113f32518264f9ac86168d52ec1ffbe5f9e04fa79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01789.go", "upstream_id": "BenchmarkTest01789", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tdata := originValue\n\tif _, after, ok := strings.Cut(originValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tparsedInt, err := strconv.Atoi(data)\n\tif err != nil || parsedInt < 0 || parsedInt > 2147483647 {\n\t\thttp.Error(w, \"invalid integer\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tboundedVal := strconv.Itoa(parsedInt)\n\trequested, _ := strconv.Atoi(boundedVal)\n\tallocated := requested + 1\n\tw.Header().Set(\"X-Alloc-Size\", strconv.Itoa(allocated))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d20ed4022375f385e4b0139e07ee1092d4b6c571a8463ae2e4b158b2934a904", "structural_hash": "b8c9ebc9349cd924a80ae146274ee43413e62577f72df00d08f4629ac37bfdb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_30408.go", "upstream_id": "BenchmarkTest30408", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\t_prefix := \"\"\n\tif len(forwardedIP) > 0 {\n\t\t_prefix = strings.ToLower(forwardedIP[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = forwardedIP\n\tcase \"f\":\n\t\tdata = forwardedIP\n\tdefault:\n\t\tdata = forwardedIP\n\t}\n\tlog.Printf(\"User action: %s\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f1ed1207127962cc2054cac9e27b73599ab441c308eb93be03b69fdab7c9d6e", "structural_hash": "d3c719943053582481de14474f3e6c8d25fdfb5c4878dd3e14c4b7cfa2a9173c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03345.ts", "upstream_id": "BenchmarkTest03345", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n res.send(fileContent);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d04e2f260fbed269c0eac25e637253c9acea50cfa6abd59faf86257dea712ef", "structural_hash": "00d3bfb513691750f85b9d237f036ff5ea97f203aa218474cd6c516cc482e93e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02955.rs", "upstream_id": "BenchmarkTest02955", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(ua_value.clone(), |s| s.trim().to_string());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23d6587533c9e2c39a253c8ec5d209cf266682dbc35291a298513d0d475e048b", "structural_hash": "8556f692d5e7735d80e0568242b7d8ae427253d0a9b7fe9eafd386223710aee2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00222.rs", "upstream_id": "BenchmarkTest00222", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(multipart_value.clone(), |s| s.trim().to_string());\n crate::shared::render_html(&format!(\"
    {}
    \", html_escape::encode_text(&data)));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4debd6f1c1763dfc80f34c877dc15ed46c8110116db7d48d32caf3cf1a53e0ee", "structural_hash": "83f2442061e6691e0648c9335bade30f4d20438566d47f8cf2391a36946d1141", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01039.rb", "upstream_id": "BenchmarkTest01039", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n data = user_input.split.join(\" \")\n File.write(\"/var/uploads/\" + data, \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0658ba3705039ea53ae6a6fc3030a9e0fd21ead1ef8798f2cafa5252df86c52", "structural_hash": "9480fd00cf8f99463269dad26175143cdec676072358e6129fb1da8deb560a51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04039.cpp", "upstream_id": "BenchmarkTest04039", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4d84862d820269688d75d597c07a2f2ac8cf00d51946e1e4553eb4bee9d75c7", "structural_hash": "823aafa51a247379380985382d605147776843b60024d89fc388193435dbfa96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_11659.go", "upstream_id": "BenchmarkTest11659", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\tdata := strings.Join(strings.Fields(configValue), \" \")\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cbe8e9be4c960c5c30c264af7580d8765cd1c4f561be3fdf72569a3c3ce5375", "structural_hash": "52b4a15d69c279f2d74512f26afed9a08a5018e143879cceedc4398f13501088", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20972.c", "upstream_id": "BenchmarkTest20972", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n int _vals[8] = { 0 };\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 0, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2527f6cd7176259d7ac04c93a323a886a94e48f7cde120ea90099255d8399651", "structural_hash": "b141b77a138d73d0a395ec48b347e6ff69418929db7ea631a6bbd197aa0da700", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01918.py", "upstream_id": "BenchmarkTest01918", "language": "python", "code": "from django.http import JsonResponse\nimport ast\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n try:\n data = str(ast.literal_eval(cookie_value))\n except (ValueError, SyntaxError):\n data = cookie_value\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9f21445ce37f325798440ea9c19dad3c6f5f50c0e3a79c75452282fbcba3cec", "structural_hash": "25a4e2c002478871004f5b6d9e09b9528e95f494e3312b82012db6d921cf9a78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03534.py", "upstream_id": "BenchmarkTest03534", "language": "python", "code": "from fastapi import FastAPI, Request\nimport random\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n data = f'{upload_name!s}'\n random.seed(int(data) if str(data).isdigit() else 42)\n token = str(random.random())\n return JSONResponse({'token': str(token)}, status_code=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1394fc7ddac0370be77c2c6a8ab9a14f3cce956aa9707da1874dbc46f75798c6", "structural_hash": "556f03bba022a71326f7a95b366cf79359bcd3d64e5876841396fbc4aca41bb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20728.js", "upstream_id": "BenchmarkTest20728", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56139658577042664abcec3b873e6a7d79ea1dc237005444cf4ec4ee37fd6cdc", "structural_hash": "a35e9fe55624518aa3b1a33c14a843378dcfb7aa91e74eef3be1dfec600bdf91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03122.ts", "upstream_id": "BenchmarkTest03122", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = \"\" + userInput;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5d288b6fec3da3bc96b1b98cf70bbc0b565ffad67caa4259f791388919214a9", "structural_hash": "5df8b3c4d34c9b1f245e2ec84c6eb67daf0d573d5a666a8a334f1696afb10fb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01565.ts", "upstream_id": "BenchmarkTest01565", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n Buffer.alloc(parseInt(data, 10) || 0);\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d32f78fbdd21c723ed3b6e0ffe1b03614b63cbf0844a7cc03408bfb3f4068cc0", "structural_hash": "d9aa632fd224df411d6465d397c84c9f73430cfb1dc0686d457c1d6a5dfb50a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04496.php", "upstream_id": "BenchmarkTest04496", "language": "php", "code": "cookie('session_token', '');\n $data = \"{$userInput}\";\n if (!hash_equals((string)($data), (string)(session('token', '')))) { abort(401, 'unauthorized'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9dec820a51c15e61b1d6a147135471a2293354fbeea5f897412dffde601307ff", "structural_hash": "744245505389559d4776105f76abf56561f8bad14a703f59040339deaf1ba5be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04331.php", "upstream_id": "BenchmarkTest04331", "language": "php", "code": "query->get('id', '');\n $field = 'data';\n $$field = $userInput;\n $result = $conn->fetchAssociative('SELECT name FROM users WHERE id = ?', [$data]);\n if ($result === false) { return new JsonResponse([\"error\" => \"not found\"], 404); }\n $value = $result['name'];\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e659048d2ec60ac01a77a6ae196884452d7550536d3f6d62b387ecc2e714b47b", "structural_hash": "8af8398f22106ec32f1861c403646ad1f6faf854937fed02b05d47decb5643d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01160.java", "upstream_id": "BenchmarkTest01160", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.parsers.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = \"item_%s\".formatted(xmlValue);\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c27b48012738c171a482bc259cdc1c3050f7405dcae2af871265ba619ad0652", "structural_hash": "f32eaa2a1416585114372380185b7e99efd7a33f347156b5999221330f0ab079", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06275.go", "upstream_id": "BenchmarkTest06275", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tdata := strings.Join(strings.Fields(originValue), \" \")\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\thttp.Error(w, \"invalid option\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\thttp.Error(w, ldapErr.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+processed+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tw.Header().Set(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72abf3369a6c7787387b0df38409a49819f92ac160e2de4c98884ee823d3e7e2", "structural_hash": "fea0f3b4d88e942d4cdd33773bd653819c50f1678e422b4685fdee0e56f01521", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03739.php", "upstream_id": "BenchmarkTest03739", "language": "php", "code": "fetchOne('SELECT body FROM mq_messages ORDER BY id DESC LIMIT 1');\n $data = (!empty($userInput)) ? $userInput : '';\n unserialize($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58fc500e598f1e54b4c2c11d35f3e4b046e7a8fe544a1d5a20c8fb04aad88fd0", "structural_hash": "7c54328058093a8d7673bb03db4fc64d8747b1805d09532e7e3e9d31b303327a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_29422.js", "upstream_id": "BenchmarkTest29422", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = await Promise.resolve(userInput);\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { res.status(403).json({error:\"forbidden\"}); return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b86400a210c72aa8b66d416bc116acc17ff3aa3af081d993dba90bfe39b61cdd", "structural_hash": "2e8e393fac57f62ad70a824898515fd4fdb9ef512904735994ef293f2c40e6ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03234.cpp", "upstream_id": "BenchmarkTest03234", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a4ff975bcde25457fd73ab5fb681ef1d2706464d3d9637d61fc7bc46218e9fc", "structural_hash": "6d6bd9e48fa641be4e2b185e06cd9f0e1acff2f625db12d08fd427a4560eda2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09189.c", "upstream_id": "BenchmarkTest09189", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"uploads/%s\", user_input);\n char _tmp[256];\n snprintf(_tmp, sizeof(_tmp), \"/tmp/%s\", data);\n FILE *_tf = fopen(_tmp, \"w\");\n if (_tf) fclose(_tf);\n}", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65b26a8b26e3aaecf4acafb5d5ab601b8021a1ce36e5e45ebe78230547e24aa7", "structural_hash": "e49e7056f204c2fc73397d980c42a8d0c159d01ba386de343cdc175fda5139bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16355.go", "upstream_id": "BenchmarkTest16355", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- originValue\n\tclose(_jobs)\n\tdata := <-_out\n\t_handlers := map[string]func(){\"primary\": func() {\n\t\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+data)\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Write(output)\n\t}}\n\t_handlers[\"primary\"]()\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6766e59139569d2586a6dbc96a9e069ab903b4a686ff8f258252509b46b63e84", "structural_hash": "126dc1d2f532a83bf75402553b5046d2275cd203c1fb07038de4edfbe169c0ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02746.php", "upstream_id": "BenchmarkTest02746", "language": "php", "code": "json('payload', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n simplexml_load_string($data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "896d728b2be38c886969cbe71e6fae66e4a23b390862c4105f0de5010f1e9d97", "structural_hash": "a2b8858f41d989414cea0b50d8b502ec65c4e583adf5d02613e515a2cf6212e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03326.rb", "upstream_id": "BenchmarkTest03326", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless session[:auth_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:auth_token].to_s)\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30f5ccaf79966d3dd7857e928f31b63b0c1c5f93e27fc1bc39546afbae236698", "structural_hash": "e6d3528dca33da2ebfcc04b82251769fa371ea0aaa9921157076ec6577543871", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03935.php", "upstream_id": "BenchmarkTest03935", "language": "php", "code": "input('field', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6dae4d73302d38ca50db315b6bc4a16a23b38646c51decc5b83e226e6a12909c", "structural_hash": "ab792f493c041b526f1670ae89d310d6f44f6e1e52b007ce8ce8e87b2b540df8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13726.js", "upstream_id": "BenchmarkTest13726", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const data = userInput != null ? userInput : '';\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + data + \";\");\n require(\"/var/app/plugins/generated.js\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6570a064c159857d13ca428d42ad7b6534a9f79077e5238fcaac2952bb198e55", "structural_hash": "660d87b261102987f021f5991fa16c958637f95f6e6abc24df05939eea296b7a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03400.php", "upstream_id": "BenchmarkTest03400", "language": "php", "code": "headers->get('Host', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b4b571d48a7341751135f77e76670ba0b4cf2d27eb4de5ffd9dd17e5c8e7c19", "structural_hash": "b68803812d336b0623c53b0deb794171534d7c56064b9f5739f4da092c121f92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05423.sh", "upstream_id": "BenchmarkTest05423", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73cc2ccee0430888eb88f1d738f083caa192b37e0d3b1ba4c8f3ba414e5d79c4", "structural_hash": "6cc04dc2285c682e8d8da1a2977a07fc5e050eecf4b10bc1bb44aefdf8bec6f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01071.rs", "upstream_id": "BenchmarkTest01071", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse urlencoding;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let data = urlencoding::decode(&cookie_value).unwrap_or_default().to_string();\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "811707220f533e053f54f32a72f7d5bc2402c2980c9190b9cc864976c868d0e1", "structural_hash": "0c42f6df1e29d314b55255e1e0822ef3c4d395fe46b4ff11eb635db7136f520d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03034.php", "upstream_id": "BenchmarkTest03034", "language": "php", "code": "name;\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n return response('
    ' . $data . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec8d8f15204cebf973c367e57ea125e137fea9e366107e3b4bbdb20b380c0897", "structural_hash": "03142bcadb3818d7dc108d0763b0548cc2ae3c3f1b1a103d7541bfe34fed63c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_41886.js", "upstream_id": "BenchmarkTest41886", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n Buffer.alloc(parseInt(data, 10) || 0);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "496a706bb2e82c47e2dcda2d99daa153d5a1280b6cbdce1653d7a864abf0eae5", "structural_hash": "0a5a40b136581570e06aa2be29972e6c5d7076e9cfc70727b5fbde17f37540c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05912.ts", "upstream_id": "BenchmarkTest05912", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const data = \"\" + userInput;\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1bac2a4779afa4636c4388bfc0076938f7fda92cf11eae7b460e78bf534967b", "structural_hash": "b7a69886497061b099f5220303400f94a1d05d0f74c6a6ce4ef976672199810f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_30718.go", "upstream_id": "BenchmarkTest30718", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tform := FormData{Payload: fieldValue}\n\tdata := form.Payload\n\tencrypted := encryptForStorage(data)\n\tos.WriteFile(\"/var/app/data/store.dat\", []byte(encrypted), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ccddd1f6700b596e81fc718552e0ff335a59f9a3496ce401b0545d374efd967", "structural_hash": "70966819aba5794712a0696853de27b5ae87a0e66dcc7c3eeb91571b6dc25623", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15866.js", "upstream_id": "BenchmarkTest15866", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = \"default_setting_value\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:default_password_use", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4436b30019cd76e160e5d2cf6557051f93321c0e2231beed0328cc47ce499673", "structural_hash": "f84bea24afe11bde25898473aacd132440b3a7dff809d932745a61eb7a8431f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02231.rb", "upstream_id": "BenchmarkTest02231", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n data = sprintf(\"%s\", user_input)\n render html: (\"
    \" + data + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22cbcd6301a2112ce7ba5d99064a66e8a4af7c2402851b24855e95ae86ac4720", "structural_hash": "245e7d1ddd022e526078b38dbbc40036b997910d7b243831aaef7b8a2c9be9ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05868.php", "upstream_id": "BenchmarkTest05868", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n json_decode($data, true);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28f834cedfbe38b6390a88245f8b96dbd973b9dd9bd411812a858fdfc444a23d", "structural_hash": "7d3180f1ee3a1570a997e21f230bf76f8be150ffee2a780d87aef80d5838fc7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13408.js", "upstream_id": "BenchmarkTest13408", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const data = `${userInput}`;\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3c023239b8926e73725d342ec104ec0b365cf72d869c7f758a9706eaad54844", "structural_hash": "cfa3d6064ad20031db494822b9ababd283b7bfcb6ed5c2683f23e9e921a55a24", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14017.sh", "upstream_id": "BenchmarkTest14017", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n case \"$data\" in\n https://app.shcdn.net|https://cdn.shcdn.net) allowed_origin=\"$data\";;\n *) echo \"forbidden origin\" >&2; exit 1;;\n esac\n printf '%s\\r\\n' \"Access-Control-Allow-Origin: $allowed_origin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2bdd22bad52b065c9747c17716dc5b8c6bd1ef5781be42278378c38347338ad", "structural_hash": "17a1d574782f71efc7ec6207580940d120911559b3b15710598e1be78c48dd63", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18906.go", "upstream_id": "BenchmarkTest18906", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tvar data string\n\tfor _, token := range strings.Split(multipartValue, \",\") {\n\t\tdata = token\n\t}\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-359"], "category": "private_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b14cc8e00e5aeb33ec8003973a816c29ba2462c87534cfc4dfbd355ba05a41c4", "structural_hash": "20c811d6e421f99dd40b961453228c10f4841048fc781c06343f8b6c8be8381b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02648.c", "upstream_id": "BenchmarkTest02648", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8dc856e70284420dce1f8cf2b2873d2f8e9a7f6f38851e0c7339c5b674f72ee", "structural_hash": "0fe3d65b2d229a9b26288cb442e0598ae18b9826837732de3a77b1e365545f06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02730.cpp", "upstream_id": "BenchmarkTest02730", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7454968c3016a83ec640ece5850dfe7c3a4bb36ec15ce037f22125b93f0e906c", "structural_hash": "51c85eb4770c6c73842d0d52f49677d9a047f3502b5d9217536680b6a8a28847", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14430.go", "upstream_id": "BenchmarkTest14430", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tpending := strings.Split(uploadName, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2082ee404f8cb66baaf8d934726f701788f5d0e794dc51831830f0edabbbe602", "structural_hash": "5b1a0c7f9179184b21d89189a4d14b71b00d367837887124847f3408ec0ba844", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03564.rb", "upstream_id": "BenchmarkTest03564", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8a076fbd31f731986403464ad31f710b48399ab09c18cc9bb62ea7d46c9fe94", "structural_hash": "aeda091d1cfd22c1ae747c160792a2ab4d5a2cf034e832d3d2ef1d90e809ba11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28298.go", "upstream_id": "BenchmarkTest28298", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- forwardedIP\n\tclose(_jobs)\n\tdata := <-_out\n\tsharedCounter = data\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd966087ca3bacb170ee49c395b32c051253c95ab577d433cc6735d4184ae74c", "structural_hash": "0f184e4fde98b779dc7138eea5e67b22a34c712c58133ea7834ec7b9eacfac0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04508.ts", "upstream_id": "BenchmarkTest04508", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = nodeUtil.format(\"%s\", userInput);\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { res.status(400).json({ error: \"out of range\" }); return; }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8e810de9031853ba64490a0cb8d7bc562e7138a7b07f408509b1e017013195b", "structural_hash": "c54886f33151efa865bdebef82b0d0b54194ba356c2c6e20df2d50ec6e0bcfbe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32121.sh", "upstream_id": "BenchmarkTest32121", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"${user_input:-default}\"\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-258"], "category": "empty_password_config", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36862e14fe1a55739903560e05e311f97e8d00ae0518ccea1be5c7aaf9c02e89", "structural_hash": "887978a4522d418e9313c6a6b1c885a775d0cb541dc38b93c8233c59afec952f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01099.ts", "upstream_id": "BenchmarkTest01099", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n res.redirect(data);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "764c715394725b7f8f173931cb90eea54a0dd870941d9b9ade058081bdb68b5a", "structural_hash": "2f06ce349eefa66addbf979d2b9af8d96ada2c95330076cc6876cf159dde088c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00939.js", "upstream_id": "BenchmarkTest00939", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n ctx.set(\"Access-Control-Allow-Origin\", data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90b529c8e86f8325a18b62df33e0f27b66e987ce8d231d3df65f883c834b0cca", "structural_hash": "102d3ba5033c79b99ea8bd8446de44d41020b60bff056e510d203d946ea94c2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41675.js", "upstream_id": "BenchmarkTest41675", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n libxmljs.parseXml(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-776"], "category": "xml_entity_expansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30ed3ffa750e39e33e8275ad7e1baa196286ab2c885d6c9b8593cfaa4fc3447b", "structural_hash": "34bc52b6334dc4c75b70ad7d1bb37c80fd9313dae62cf6010d3ab9151c0a3b39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05179.php", "upstream_id": "BenchmarkTest05179", "language": "php", "code": "raw; } };\n $data = $payload->value();\n yaml_parse($data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c13d3ce230b60c5c6d562fe8de4a92dcd439b5967eddacfa561f072ee5b56ec", "structural_hash": "78f4c02e1ddaa3599454f78a526e9615c7d0d0ebcbf9675854bb2f3a278a1ca1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32900.go", "upstream_id": "BenchmarkTest32900", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tdata := BenchSvcPassthrough(hostValue)\n\tallowedFields := map[string]bool{\"name\": true, \"email\": true, \"bio\": true}\n\tif !allowedFields[strings.SplitN(data, \"=\", 2)[0]] {\n\t\thttp.Error(w, \"field not allowed\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tparts := strings.SplitN(processed, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b871f8b515b9495ecbedf4a2bdd7f6b770de5685f4727a838fbe04765895969f", "structural_hash": "7cecbe379b6d0169fa7f6a4ddc7a715d0c7f93f7af477acc6c33ea502d07cbc3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03903.py", "upstream_id": "BenchmarkTest03903", "language": "python", "code": "from django.http import JsonResponse\nimport os\ndef ensure_str(value):\n return str(value)\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n data = ensure_str(header_value)\n entries = os.listdir(str(data))\n return JsonResponse({'listing': entries}, status=200)", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8b569f370b647a8de1ac02d500836890e1da1ffaa35fa971c3152d4ebc55a30", "structural_hash": "3ca9d334122ca2ffca4497a02d0abd9586b8ab49f6465ecf01fa76f1e49db427", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03307.cpp", "upstream_id": "BenchmarkTest03307", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n std::string data = !user_input.empty() ? user_input : std::string();\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2f4b19f99ff0ed6d256901f384da408192e558d526aec282b86d04cf6b580ca", "structural_hash": "12a254412a5666b1eb8ba35977d6ad62d815df5ae38ba703fcec07c45a1f192b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01019.rb", "upstream_id": "BenchmarkTest01019", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n payload, _origin = user_input, 'http'\n data = payload\n processed = data.to_s.delete(\"\\r\\n\").gsub(/[A-Za-z0-9]{4,}/, \"****\")\n headers[\"X-Custom\"] = processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36474ff9b59075f7c7f11451b7e8b7f4ec9263de7edfd0b98b0d002de81a3d85", "structural_hash": "f99b483035e7d30ac310dfae7ff3af3c10034660579ff0802028e335c06af95a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05320.py", "upstream_id": "BenchmarkTest05320", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n if field_value:\n data = field_value\n else:\n data = ''\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(digest)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2be3b16c08d1af2e51dd52b6f250bd9d0bbc63dc70ee0431ee6511e824732dd2", "structural_hash": "483b7d912ab3181f7511f88fb728b99f224aeb1aacd34511615c4d3d02553bbb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00940.py", "upstream_id": "BenchmarkTest00940", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nfrom app_runtime import db\ndef benchmark_case(request):\n profile_value = db.fetch_one('SELECT bio FROM profiles LIMIT 1')\n def normalize(value):\n return value.strip()\n data = normalize(profile_value)\n requests.post('http://api.prod.internal/data', data=str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5edda9d250849704acd6ce9873e5aaeb0383b329e09b0d73caab7ea48bf1dacc", "structural_hash": "511fef0ec4d577b385b0bd5aeb0b4c9eff30045dc89ae4d93ba751e30edab2b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02745.cpp", "upstream_id": "BenchmarkTest02745", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"API_RESPONSE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) return;\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2c73f8f1ed60fa97a88b4fe20c00a09405d3262a5993e1b8f53a1647c1e446e", "structural_hash": "5ea306e37f9d99b3208a076a00e34df6c396430bc58b3914d4d8143aabad3e9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02969.rs", "upstream_id": "BenchmarkTest02969", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let _prefix: String = db_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => db_value.to_lowercase(),\n \"f\" => db_value.to_uppercase(),\n _ => db_value.trim().to_string(),\n };\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca649e50b8c2421c2e7b08ffea8eb0916aab15fa9871fe77f623c0500d38c174", "structural_hash": "640663a7d688e789a15cdc9cc8fe2c797c5678a39af2d44ffbb136a553cc766e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00506.c", "upstream_id": "BenchmarkTest00506", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n xmlDocPtr _doc = xmlReadMemory(\"\", 8, NULL, NULL, 0);\n xmlXPathContextPtr _xpc = xmlXPathNewContext(_doc);\n char _expr[512];\n snprintf(_expr, sizeof(_expr), \"//user[@name='%s']\", data);\n xmlXPathObjectPtr _xo = xmlXPathEvalExpression((const unsigned char *)_expr, _xpc);\n (void)_xo;\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4cf7a18c7d9b44acd90750206023a00a8e6c2b9420c89ee0cf25ef8d398b5722", "structural_hash": "4893650e0b6e77bb0180339ce6de8a9e443e627d58095942ac59a7cebaaa16db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05537.rs", "upstream_id": "BenchmarkTest05537", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = serde_json::from_str::(&json_value)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n let processed = [\"true\", \"false\", \"1\", \"0\"].contains(&data.to_lowercase().as_str()).to_string();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&processed) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00c9743a509a999c49b228003cbbbb920e3a3e8ffc3e0748b4fceb8e6b61fee7", "structural_hash": "2e8f30482a9bc1d49b69b5959f72b8b6e0a1c8e6534770187e78ff7f719e0b70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05533.sh", "upstream_id": "BenchmarkTest05533", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n data=$(printf \"%s\" \"$user_input\")\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b1fb8b86b116f570d06d24cac4d4564d7e5840f56710379d3dc09795aa672c3", "structural_hash": "66384ab806a4552295cfee0e78555953a3370d37cd0403440a668b111aca72ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05938.ts", "upstream_id": "BenchmarkTest05938", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n res.set(\"Access-Control-Allow-Origin\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1bc12cb332f67ac1763cc6f0aef7d90b70c7b315fbf3429c790231abb46af530", "structural_hash": "4e272b7816ae74ed5846b30dd5edfff6aa3de03690367b50ded24238d8c296b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16386.c", "upstream_id": "BenchmarkTest16386", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char *const _argv[] = { \"/usr/bin/tar\", \"-cf\", \"/tmp/backup.tar\", (char *)data, NULL };\n execv(\"/usr/bin/tar\", _argv);\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c012075c6c154af024d138cad39f8dc29e9893f861b2bf268992dcda8d3e0f9", "structural_hash": "2613c07f437c1cca29821eae301619018af62b294bd30f447621b5879208e4c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02477.rs", "upstream_id": "BenchmarkTest02477", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n if xml_value.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "843f0c5f9ce3fcd7078096c4f4c1b2bd3ee47752ff107c56b46e70f0abe2b029", "structural_hash": "4c219faa9ecf8c1eec5c2b3439b73ebc9180b62e1ec96c5630714f3a04085855", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04080.java", "upstream_id": "BenchmarkTest04080", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n response.getWriter().print(String.valueOf(envValue));\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58a2147503e701ce435c0a166878639c10bc6bdc2851bbcfe8a1cc95ba535bc4", "structural_hash": "bb2b4dc8f90a8bf29d50ef07d21a6a63d7b1e4fe9f36ddf20276fe3b310616e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01961.ts", "upstream_id": "BenchmarkTest01961", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = decodeURIComponent(userInput);\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcde9f8e6227314ada2c3eda081a923528120a50bcfe893e568d6f5dd1c7a31e", "structural_hash": "5c6a126cb748c09f48071cc9132a09656a57fccb02fe4fb1a5d097153aecdc99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07025.go", "upstream_id": "BenchmarkTest07025", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(rawBody)\n\tcmd := exec.Command(\"echo\", data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8771c632380e69c3eae4f1dfdc95ad618f1c8a5aad92c6bedb40e60a1290e2bb", "structural_hash": "7073606f4c85e4a556f442e3e074536c1b817762655a13ce94ae3cc15e1b1c58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_22536.go", "upstream_id": "BenchmarkTest22536", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(fieldValue)\n\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb66da4d5ea1289099625f67bc2a5358a80e25b13bfb84f1b651004e491d89b7", "structural_hash": "cddc0190e507e2e2a9b8bf7ef6fcfe10670a55ebc4dc39cea466fbfdc876e284", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05880.go", "upstream_id": "BenchmarkTest05880", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/md5\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\thexBytes, _ := hex.DecodeString(authHeader)\n\tdata := string(hexBytes)\n\thash := md5.Sum([]byte(data))\n\thashStr := fmt.Sprintf(\"%x\", hash)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8776311e4e7acb428625d63d06046124c2f4e444a6d64399ef057690dc8f17a6", "structural_hash": "66aad2547db75b0249c621f500b1c5a434e07886381fed5ba3d8ec5a430db4ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09853.sh", "upstream_id": "BenchmarkTest09853", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _host=$(echo \"$data\" | awk -F[/:] '{print $4}')\n if [[ ! \"$_host\" =~ \\.(internal\\.corp|example\\.com)$ ]]; then echo \"forbidden host\"; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "060efbafc511366d4752faa445a58aa77672b3c1b6f40edf8dac94ecc4378a8a", "structural_hash": "39ab07aabc680d9d23d737f643313b0efa33923b7b06bb670ed5fce0896818b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05216.rb", "upstream_id": "BenchmarkTest05216", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n if parsed_bool.to_s =~ /[a-zA-Z0-9_-]+/\n content_type :json\n JSON.generate({ validated: parsed_bool.to_s })\n end\n end\nend", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30a6ba11cd46127e8e31a62715c60bcff22152110e895a57dd016f7a0ffd5634", "structural_hash": "40e8fdbf84a29e6bc529361bf9f50a916948237aaa2b98c431e688eaacbb4169", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04426.rs", "upstream_id": "BenchmarkTest04426", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data: String = raw_body.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| raw_body.clone());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")).finish()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75243e6ed8e5e80c757426a7c2c5ec15c038d64af54c8a65b179ebfbb510e9a1", "structural_hash": "ef2fb299113463f7b7bf71dc66e7e4880f4cd4acb8cd690bc7dd97268e1ed3e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16598.js", "upstream_id": "BenchmarkTest16598", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const data = String(userInput).slice(0, 200);\n let _result = 'none';\n switch (data) { case \"a\": _result = 'alpha'; case \"b\": _result = 'beta'; break; default: _result = 'other'; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00350eea73ea7002c027a4a89b55312f8730c72233931938bf9718026680b861", "structural_hash": "d5bfd741829b7f96576086fff3c586e58928007f2caf383ef8d3f549aa553a9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04837.py", "upstream_id": "BenchmarkTest04837", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport json\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = '%s' % str(graphql_var)\n return HttpResponse(mark_safe('
    ' + str(data) + '
    '))", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e6d5d638a73ffa57a3fc4e156b3e44191853ba7ffa292a67ac8a66a77f00449", "structural_hash": "3192b23e968e0e28ce5fd2636388d764fafd00b22c5cbbb818892b5c696e8246", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15677.go", "upstream_id": "BenchmarkTest15677", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tpending := strings.Split(cookieValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+processed), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e3921a623dfcf043cf357159a7a8127f1b38857c384407ba9e4664de6bc66f2", "structural_hash": "deacd1cf7d648f7f32d24adc4ff13ff35a47520b3a329e15e4c6a87c45c66dd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05691.ts", "upstream_id": "BenchmarkTest05691", "language": "typescript", "code": "import { Controller, Post, Query } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3126f6b9fef7b466676133aaef3d5de11c55363955a2c7dd0d2fdc0ad08a1188", "structural_hash": "842573ee0486b39b588e2037aa62e2011bf12b746660451a3cc0d9566917976d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02467.php", "upstream_id": "BenchmarkTest02467", "language": "php", "code": "header('Host', '');\n $data = sprintf('%s', $userInput);\n $stored = '0e462097431906509019562988736854';\n if (md5((string)$data) == $stored) { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-843"], "category": "typejuggling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0044c22d638eaca6d0df9faf73874b61b3d4ffd305c8e54d869162bd11458d34", "structural_hash": "067d10c097ed7e63c4851559bb7d1c6d4a1d2414dd35a9b7bd0dbb9db642d981", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03972.py", "upstream_id": "BenchmarkTest03972", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = field_value if field_value else 'default'\n subprocess.run(['echo', data], shell=False)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4416e16a6ce32f1d1891039b6f4bf229712e35da9f39d098de73e63b09f4191a", "structural_hash": "1230b454fbe57070c52cc3671e1266547689ec10aa5dd1aaef4cccd1f341743d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01935.sh", "upstream_id": "BenchmarkTest01935", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n case $user_input in true|false|0|1) parsed_bool=\"$user_input\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n logger \"Action: $parsed_bool\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0edf89566a123aa8366ec42270686688571722a7c8c63b3b5650bdd69fb0d356", "structural_hash": "c93a350bd1dac93078a5ce7dd12825ded34b36cadb49967c520124bca6beb1a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03102.sh", "upstream_id": "BenchmarkTest03102", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(redis-cli GET user_data)\"\n data=\"${user_input//$'\\x00'/}\"\n _host=$(echo \"$data\" | sed -E \"s#^[a-zA-Z]+://##; s#[/:].*##\")\n case \"$_host\" in \"[\"*|\"\") echo \"private range blocked\"; exit 1;; esac\n _ip=$(getent ahosts \"$_host\" 2>/dev/null | head -n1 | cut -d\" \" -f1)\n _ip=\"${_ip:-$_host}\"\n if ! echo \"$_ip\" | grep -qE \"^[0-9]{1,3}(\\.[0-9]{1,3}){3}$\"; then echo \"non-ipv4 host blocked\" >&2; exit 1; fi\n if echo \"$_ip\" | grep -qE \"^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.)\"; then echo \"private range blocked\"; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4633783e522eeaa34b17ca8764ce79cc04944e91a1cdf90b6d6809c2ae8aeecb", "structural_hash": "0c3631af91ee56271fb89ee703f7be33d90ac139c5f585531fb4ef2c18dfb4a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03571.ts", "upstream_id": "BenchmarkTest03571", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as jsonwebtoken from \"jsonwebtoken\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = [\"feature_flag_value\"][0];\n const data = await Promise.resolve(userInput);\n const jwtSecret = process.env.JWT_SECRET || \"\";\n const token = jsonwebtoken.sign({ sub: String(data) }, jwtSecret);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b312ea3feff771af2f4ce429bc1f8c4db290e0af7e0f394913f05d2a5fecad6", "structural_hash": "4e29fbe0db171adf2e951606263bb0b07d97edcfa12c6f71e7205564c5a012af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03328.go", "upstream_id": "BenchmarkTest03328", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(configValue)\n\tos.WriteFile(\"/var/data/secrets.txt\", []byte(data), 0644)\n}", "label": 1, "cwe": ["CWE-256"], "category": "unprotected_cred_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df325f2f4a0647fb57e2d3307f874c4f69bb842464094500198335d4d05e8275", "structural_hash": "42e847ad27e95592f2b7d85014db22db39a881afe67d899e615fc68c56d7ec51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09703.go", "upstream_id": "BenchmarkTest09703", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"go.mongodb.org/mongo-driver/bson\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tsegments := strings.Split(uploadName, \",\")\n\tdata := strings.Join(segments, \" \")\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tvar mongoFilter bson.M\n\tjson.Unmarshal([]byte(processed), &mongoFilter)\n\tmongoClient.Database(\"benchmark\").Collection(\"users\").FindOne(context.Background(), mongoFilter)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efe9f74bcf16bc335cc9765757891559cf6daffa532ce606cdcbb044bf47e1e9", "structural_hash": "04605adb1ac5478eddd83e7356be1043dd63039f90771465984d90e70b928dcb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04344.rs", "upstream_id": "BenchmarkTest04344", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let data = urlencoding::decode(&path_value).unwrap_or_default().to_string();\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a977c5c7d9b4afcca73430c324e061850ea7365e033ebe62c947ec458897a705", "structural_hash": "bf8d54b3d9568eced78f70e5b5f5efc72bdc66f59071887a66f5efc875473f76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05519.rs", "upstream_id": "BenchmarkTest05519", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse hex;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = String::from_utf8_lossy(&hex::decode(&auth_header).unwrap_or_default()).to_string();\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5ae1a1c200bdc8038b690924d8a2ccde57044f8b18b0dea5b9a47d275d64921", "structural_hash": "6e05ca40b4132c64581d2b21c47923d3c18376d897a623017dda5deb16ee8b3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05540.php", "upstream_id": "BenchmarkTest05540", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33a9d1c91d3da3a988ab92e705bccf4270b2db7ec53afc21349f6ef5aeca886d", "structural_hash": "8216bf96d17623ad692f6f3fd4d917698fa47fba58dd40fcdc0c98013613a938", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03428.rs", "upstream_id": "BenchmarkTest03428", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = raw_body.replace(\"\\t\", \" \");\n let processed = data.parse::().unwrap_or(0).clamp(0, 2147483647).to_string();\n let requested: i64 = processed.parse().unwrap_or(0);\n let count = requested.clamp(0, 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88db3dcc35204863ec2a759d9509a3cdf89b0ed77a4f13d49f9b92a1dcf3016e", "structural_hash": "5f27f850345b094ba04280d890887a7f3895d45d134147e9069fd22a0f359831", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01319.ts", "upstream_id": "BenchmarkTest01319", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(processed))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78ed712b183bd0e7f7d0900a7417bb1263d402eb885dddd41b837365272eb3de", "structural_hash": "5f87861898769ff832775ae9c65f0f5c80fcef5590e2effe6334f2ce54111690", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01653.py", "upstream_id": "BenchmarkTest01653", "language": "python", "code": "from django.http import JsonResponse\nimport re\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = '{}'.format(json_value)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JsonResponse({'error': 'invalid input'}, status=400)\n processed = data\n with open('output.csv', 'a') as fh:\n fh.write(str(processed) + ',data\\n')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "620feae14ee9945a097a1642f08a8832aabcff978e5d69a7c65352cc75e7ac86", "structural_hash": "871fb6ba13a278238d1860f402678dda7fc0d83e3934ac77cf6ad9705f2df3a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00905.rs", "upstream_id": "BenchmarkTest00905", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data: String = field_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| field_value.clone());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01910eeb662fb6d43e0475cfd9fdabdf68804f2c33ffe66e734c431f37b8bf1a", "structural_hash": "cae6a35ae048df127af9328ca3cfe6f41d5922fe73e4856f3b52c29fedc1112e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03415.java", "upstream_id": "BenchmarkTest03415", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n FormData payload = new FormData(rawData);\n String data = payload.payload();\n response.sendError(500, data);\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "411fee5da4075f791de28426469bb877fd8edf132126d2d2c7f4693e48517f20", "structural_hash": "24a07aa5da1c1683d3f4a988195fd5a10d0163b769a4dfde085aff437245629b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02798.rs", "upstream_id": "BenchmarkTest02798", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&referer_value).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59c7f07e205f95192e2fc0c70b4342d261d52e2ba16e61996c6f7979a5e65a21", "structural_hash": "f53d058ee527f26c94aa0aa44a7c898e70cecdaf52fd3cc0d91c126cba0df136", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24706.go", "upstream_id": "BenchmarkTest24706", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/antchfx/xmlquery\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := fmt.Sprintf(\"%s\", jsonValue)\n\txmlDoc, xmlErr := xmlquery.Parse(strings.NewReader(\"\"))\n\tif xmlErr != nil {\n\t\tc.String(http.StatusInternalServerError, xmlErr.Error())\n\t\treturn\n\t}\n\txmlquery.FindOne(xmlDoc, \"//user[@name='\"+data+\"']\")\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9690366837e83dc6a6e098aeb3c34ddbf7b3b17f5378ffae4dbdf55b9646f79", "structural_hash": "cf877cd0eeaedb33c5106d1c4b692e58a3e00710e6ab14cec20b14675f46eeff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04550.ts", "upstream_id": "BenchmarkTest04550", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "526dbfd0e43b956901b8b32c76c862ad9848dbfdc673598694f7d95866e2c1c6", "structural_hash": "0316b35b28248d72efbffa6a800ec360756082d646516290ec0609f2fa351702", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00108.js", "upstream_id": "BenchmarkTest00108", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3961e835186b0d158f1e7a61af4f084a6e3f710de3552a2c9f2032ef1e4bc12", "structural_hash": "75664c66eb0a2e5c75e16e1e3672deb0b84af34362e8a2fbd2a52736484e4d9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05165.php", "upstream_id": "BenchmarkTest05165", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db7e68fe164cdbbe97d3c33f6b66dbd50bf5103e2f982c7b905e2f78e972c522", "structural_hash": "2587748adc87a87d6f1844c0d0a4627aed3141db0be618b541f6be7aa0a5520f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_00205.go", "upstream_id": "BenchmarkTest00205", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata, _ := url.QueryUnescape(refererValue)\n\tcmd := exec.Command(\"sh\", \"-c\", data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 1, "cwe": ["CWE-506"], "category": "embedded_malicious_code", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:embedded_malicious_code", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed9c18e463508c85eda361e45a9ae82bd3a640a0508903c2f12463caf73399a2", "structural_hash": "1eaaa238640ba70ad73890cdb8e181b45879864dae45fc12f64ea7498b3ba91f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02120.rb", "upstream_id": "BenchmarkTest02120", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = user_input ? user_input : ''\n _buf = \"x\" * data.to_i\n _ = _buf\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "282874e317878673e9129002e8ae18ba80e366d1be634598a67af0080bb9af54", "structural_hash": "1dcf901ffd2cc149afbd89b689f168227c053a4a329468c0f84ed315cdc2ec30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01278.rs", "upstream_id": "BenchmarkTest01278", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let data = if cookie_value.len() <= 4096 { cookie_value.clone() } else { cookie_value.chars().take(4096).collect() };\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed992e5bc60e998918fbeecd9dcce0ab0846c6b927b7d5124997f5b62f4b3d04", "structural_hash": "2c4cf2864acc6290bba1a35780b4ad60f508503d25cf1c440a77bb58aa6fce7a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09380.js", "upstream_id": "BenchmarkTest09380", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n res.send(\"
    \" + data + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66330632eba7291a3a17e58afc82d1a99bb7282cf4698fe5e2ec459efa5294f8", "structural_hash": "c750567a60cddc92f0cd14a3dc655a4f4369d6ab512709eb282f0e04edc3d82e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04357.rb", "upstream_id": "BenchmarkTest04357", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"feature_flag_value\"\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38b70db68293b283d41af1b239f4ae25c27a650c70b393bc5ce3778afbf75a58", "structural_hash": "490af9d59daae23eb6635059b9e283848bb68acc0597932dcb0c1388f932a188", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_34758.js", "upstream_id": "BenchmarkTest34758", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(nunjucks.renderString(processed, {}));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5330c7d0d586f8ef494320119ad0ad30aea90566ccfd99803e14e66b60444e0", "structural_hash": "f53a33a067af193a4229f5bbe18508bb0cc98fe9539652ceb298e2321290f552", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01087.rb", "upstream_id": "BenchmarkTest01087", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n response.set_header(\"X-Custom\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72ce4d5b9c3377d1d4243ed4d1cee1180f70b2d901d0cf2759bec4893c0492f3", "structural_hash": "0972a211d8241b6dffec457870a8f0aa3496bcc0152b50625f39561bfe17b5fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01144.rb", "upstream_id": "BenchmarkTest01144", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n data = Thread.new { user_input.to_s.strip }.value\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05e40c09f436e9cda9db5ad6c84e889a98792b45ab4b231d237f6db01c2622d7", "structural_hash": "2329e53a185b062bcd45e9ea7556ee7300669571bdc4472012165da6c26d7814", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_22219.go", "upstream_id": "BenchmarkTest22219", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/text/unicode/norm\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tlastRequestValue.Store(uploadName)\n\tdata, _ := lastRequestValue.Load().(string)\n\tnormalized := norm.NFKC.String(data)\n\thtmlBody := \"

    \" + normalized + \"

    \"\n\tc.Header(\"Content-Type\", \"text/html\")\n\tc.Data(200, \"text/html\", []byte(htmlBody))\n}", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "087e32f2bc7bc38089a358b01e5be2a1f6415b0a15bff56c18872947b3f3abfc", "structural_hash": "22d406b5b997daeeec656f7efbd06be24e50b392b6fadf07f3ce78a92f4e93ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02879.rs", "upstream_id": "BenchmarkTest02879", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: cookie_value.clone() }.payload;\n reqwest::get(&data).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d80cd90851cf7e15ac0d1e551d50871033fd2713886dd0400928b726fcaa309", "structural_hash": "e41506f6d62936b801f1fbac46846a689145c2689f531ddaf9de9e14ebd018e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01774.php", "upstream_id": "BenchmarkTest01774", "language": "php", "code": "getContent();\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bee172e7640f5f26e0a24da16a3fc742a647fb47aff7e22633d29bf35466ba84", "structural_hash": "16bf0de8375b7621a583c7ec7c37e95b8238f004251e923d10ad1470b1985ced", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03633.sh", "upstream_id": "BenchmarkTest03633", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n data=\"${user_input//$'\\x00'/}\"\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n logger \"Action: $parsed_bool\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3ff3ea4dab8de0e1f46fbda59d4b81eeb4f4a1c597f9808eded91db1036f35d", "structural_hash": "e70c4171f5301e6f16a1fb4f293008ca401618048a49435733eba42cdafdf16e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03945.php", "upstream_id": "BenchmarkTest03945", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8386f6a4ce4acde4aa42af284345b2bcef5618c85f6a1eb4e2c2b7b97995dc62", "structural_hash": "ba1b2c0ec82a857c9964669aee0580c0826b95f74e93e719dbc962e57e448e55", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02407.ts", "upstream_id": "BenchmarkTest02407", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(userInput), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bd6b3149bf7680c5cbc5928258a3f3b25cab7e0111debd9cfde25b7d002ef5a", "structural_hash": "d968eecb8d89f1dd9d371cdfd2c2012e6c6ea30b3cbc926317cf0cba92c5773e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05612.ts", "upstream_id": "BenchmarkTest05612", "language": "typescript", "code": "import { Controller, Post, NotFoundException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n if (!row) { throw new NotFoundException({error: \"not found\"}); }\n const value = (row as any).name;\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8860794a86216ae734d77de7be5043d62f9e39c55da8e03613b5303866ff5515", "structural_hash": "d96032d4c7c02eb004030abbe7807f44e9052514b1d5fadad7c558ecc4198993", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04135.php", "upstream_id": "BenchmarkTest04135", "language": "php", "code": "name;\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n file_put_contents('/var/data/output', (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aee758ea39c84db07243e8def8acaa49eb9c2106551ba0ba7244ddf3adbdef79", "structural_hash": "655f225b7d570d76e4c21a55e7d3e1c3160e3012b77a5fe136cd24b7bbc26972", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00677.cpp", "upstream_id": "BenchmarkTest00677", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n std::string _truncated = data.substr(0, 64);\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", _truncated.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4262824f3940b88400510c2a5e928c7a8c29be38261c7c95fc41d883cd6abb4", "structural_hash": "66fc2923663e136aec4f457aa809afbc499a52481ee5dc56bceaec72bc8d8524", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01449.php", "upstream_id": "BenchmarkTest01449", "language": "php", "code": "input('field', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n return redirect($data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d97e7bb78872293192f8187cbd436ecc52ecc37a9b6002dfb44a4d6debe80ba", "structural_hash": "961c691ae05e0c769a3a84d00dd9de60b79c79117cc7a17a59d09d359acf8ed7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04089.php", "upstream_id": "BenchmarkTest04089", "language": "php", "code": "header('Authorization', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3d73b447a865c13f9904d4eded443ed31e0333a5b3b1bc84c786a375b41511d", "structural_hash": "4f857a26bc858da9d02130a263ecf6b9c922cf0329f4d90e522fff50a182ae12", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01910.py", "upstream_id": "BenchmarkTest01910", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n parts = []\n for token in str(user_id).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return jsonify({'name': str(value)}), 200", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cde5e64b38da9176417618b7858763b12fcac558572ec8f2b17ab806d4a720b", "structural_hash": "44405974794569ea4a004483d90293830d0302e1c1013db7bb6b36b60b0e1939", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01332.py", "upstream_id": "BenchmarkTest01332", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport ast\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n xml_value = (await request.body()).decode('utf-8')\n try:\n data = str(ast.literal_eval(xml_value))\n except (ValueError, SyntaxError):\n data = xml_value\n if len(str(data)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32929ab180f2613077ba25b4daf6fb1a69c5ab866dc76d2b34cb3eeef6ca9096", "structural_hash": "59e82a9dc2c44d5cf04dff491e6f501931536a5758c740f46129698f3e9b75af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31447.sh", "upstream_id": "BenchmarkTest31447", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(printf \"%b\" \"$user_input\")\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"audit actor=$data action=session_revoke result=ok\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d33dfd3c77ff59e5a4cf0953ecf89cd8460b6bba9868b480eefd6ee61ade39ac", "structural_hash": "ddbaaf78fa4f5cbdb5a6251874fdc696f8c747b8a4968cf2de1b6eb7c3acca9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01178.cpp", "upstream_id": "BenchmarkTest01178", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc26bd3637313ea51361c360a1a1559966621c28b6ce3d0c4947513b6cd940b9", "structural_hash": "4b78fe3e5579d005e9596d700d3c652eb97e5d5c711940c2aa9bb66f077165f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01613.cpp", "upstream_id": "BenchmarkTest01613", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_HOST\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e059b16642c607df11844f9a5ae580b7012054afe8222267da5624646a5c63d", "structural_hash": "069fe5a108306260fa2f41cab777a5de1456328b319a85564eea472ecddf9853", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01234.cpp", "upstream_id": "BenchmarkTest01234", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _role = user_input;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b86735871ff0dbaa100bf56b26e2a6d0a1ccd66849f6af3d1004ab304ed1767", "structural_hash": "56e1ea52d0ed85f22a2af6b3ac602cfb9a986455e80105b0a2eea48420199db8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02888.ts", "upstream_id": "BenchmarkTest02888", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n res.send(nunjucks.renderString(data, {}));\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e53bdd16753b517d6cb8a3e338f1bb095d1b43d6eae75ec9e78408a2c8a44cc", "structural_hash": "a5e448709a7e3c4eb4a45e8e1b29507702732aa3328248a5b43cbb8c748442e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16181.c", "upstream_id": "BenchmarkTest16181", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f291d7e2f2b8b6df8f8fbf82138e6cfd2a8c82345a39b0c9e54bc0505ad05eaf", "structural_hash": "d95cd136760f5f70123139d873de7ea93477b6381dce48cad88b58c6dbac2ea5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14908.sh", "upstream_id": "BenchmarkTest14908", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=\"${user_input//$'\\x00'/}\"\n normalized=$(echo \"$data\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$data\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d39efc3922acc2fe4496710691f92c816f65822214a6d44779a7eebfb4bb5b6", "structural_hash": "d0364b39463b5f3f59a710304cdaa325e5ec8c40e6e0966c93ac41e7d718d336", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00064.ts", "upstream_id": "BenchmarkTest00064", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n req.session.id = String(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b71b938ac96f33f18eba041cf589507eb230612fc2a2f64cabe1aea51fb5b98b", "structural_hash": "8f97a1b599f53bd32305ae04861c4232a3705b479974fea66ca33aa36d46ad29", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00781.cpp", "upstream_id": "BenchmarkTest00781", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string _cmd = std::string(\"grep \") + data + \" /var/log/app.log\";\n FILE *_p = popen(_cmd.c_str(), \"r\");\n if (_p) pclose(_p);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00b0c8f81eb3a80343332e0309271d9b538c6e4847c594796d815f32bdcd2a48", "structural_hash": "54a68bf51ff5e331a3de7939f8a1208f02bf05290b9568bb0a25baa404035e6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08839.go", "upstream_id": "BenchmarkTest08839", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := strings.Join(strings.Fields(graphqlVar), \" \")\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"request processed\")\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db37bb8f927cf888aa850349a9ebfa33c406f8393ef82c7f425d8441bd711c9d", "structural_hash": "fc7d97364de7f5b451d49435b35f2ffebf4f7d6554a4df6f66b557c649073222", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07859.go", "upstream_id": "BenchmarkTest07859", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tvar data string\n\tfor _, token := range strings.Split(uaValue, \",\") {\n\t\tdata = token\n\t}\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-336"], "category": "same_seed_prng", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "971f9e56e46a12ae9bbd1b93388dbd5bd228df1e4e7caee5e1c891f35a5c0b75", "structural_hash": "77ac0482c4962ab33256b84d53c6e92d5df0abddf9cdab10074c6bf1f2b727cf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05873.ts", "upstream_id": "BenchmarkTest05873", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n res.send(\"
    \" + data + \"
    \");\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbe2cf1fbfd88c18efa0c97ad713e7fb571b8e611bf2422458e180f437cabecf", "structural_hash": "067d2b893227b52d6c44c029ac21fd24196d35e5336342cccce08b370109e646", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05569.rb", "upstream_id": "BenchmarkTest05569", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless session[:user_id]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2c46c19fdd8db53e1dace83c724a1d62e0ccc88c73577c4082eb9f8e481fa3a", "structural_hash": "be43534f9ae16146c3dec0eb3ccb9c921d464d5d535063ae7bece58d6fc1847f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00101.sh", "upstream_id": "BenchmarkTest00101", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n if [ \"${APP_ENV:-production}\" != \"test\" ]; then\n cat \"/etc/app/private/$data\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "986abcd15aa29074457689d65bcdd4187921e783b53ed39b3923e0feb4eaefd7", "structural_hash": "569dbfef5edb7938a77b51bb1c8b0cf195a708e6d8f224ccb3628f0a1164c7f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05365.rb", "upstream_id": "BenchmarkTest05365", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = String(user_input).strip\n if Time.now.year >= 2020\n content_type :html\n \"
    \" + data + \"
    \"\n end\n end\nend", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a49cb2d5244949d576247e5cfd494042e5ea32a732b2a4e7623c3158e76240e7", "structural_hash": "c94b17b09dedcebc01c02840d55aafbbe8daed500e1f225e14efbdc851329031", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19207.js", "upstream_id": "BenchmarkTest19207", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const sessionName = String(data).replace(/[^a-zA-Z0-9]/g, \"\").slice(0, 32) || \"app\";\n require(\"./shared\").sts.assumeRole(\"arn:aws:iam::123456789012:role/app-readonly\", sessionName);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3287ec76789148f97c46a9821b3550b2ab130f74e04cb57913bc106e6a05310f", "structural_hash": "2a0ffd666320a9ce4c6a880bad1def439ab14a7bb91ee6acfe68024d774774c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14845.sh", "upstream_id": "BenchmarkTest14845", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n echo \"data\" > \"/tmp/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83b27cceb26e237af2efd3e02109adc2bfa43c5b1f573036a6079b871141e713", "structural_hash": "4707be6c09f6c4a548df756056739d7731d09e30e8c64c2dbb75fbac75ed31d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01929.php", "upstream_id": "BenchmarkTest01929", "language": "php", "code": "executeQuery('SELECT * FROM users WHERE `' . str_replace('`', '``', (string)$data) . '` = 1');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd9d03ea9ead347c414e2b413eaf32cfd46b55da8bf9910fde899319453c2813", "structural_hash": "5047247ff8b0f25f25d5127f49a3e01c8f28d2ebb22814fafc55d193086ce178", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04908.php", "upstream_id": "BenchmarkTest04908", "language": "php", "code": "getContent();\n $data = json_decode($userInput, true)['value'] ?? '';\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e83f64a17ee5f5a3dfd68854b21f6a97caf4bfe820d6aee14bf51d88aff2527", "structural_hash": "1ee980a6b96d10fca5cfd18369cbda8ac6a7611dde40e856cca4ba830209ee4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05074.rs", "upstream_id": "BenchmarkTest05074", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n struct FormData { payload: String }\n let data = FormData { payload: xml_value.clone() }.payload;\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6dd6622d2496f034b36c5ec1331b953dbd31731b0ef8af122799a69ca82d3386", "structural_hash": "fde320f10417d7711903798af48c27df315ac22c84fb3c186db401275fcf8a15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01173.rs", "upstream_id": "BenchmarkTest01173", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&header_value) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = header_value.clone();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&processed) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79ef12dee9309293a406efd7194ea10f3ca22ff92f1719ef73cabecccf584733", "structural_hash": "bf47e741fbfefc124a16377d6143167d4142f9d1c98ca98345011e4afff4e964", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10774.js", "upstream_id": "BenchmarkTest10774", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n globalThis._stateLock = (globalThis._stateLock || Promise.resolve())\n .then(() => { globalThis.sharedState = data; });\n await globalThis._stateLock;\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fafa9f8f893998ee91491cf24f7c410f4992fa34fca42c4ebfd25f630066e3c9", "structural_hash": "ea2c5bdd6f496bddfdf20bd8f6cdebb596caad85da8436cbda068d98397a9713", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04273.rs", "upstream_id": "BenchmarkTest04273", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n if header_value.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n #[cfg(unix)] { unsafe { libc::setuid(65534); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "571eb9ab6eec7c17f4d9914e747966eac8c11a76a66e30ed423277d0ae30e5c3", "structural_hash": "50ad8938d196af82c8af393d1087f667358b24224bb5db90bc26cda269cb94a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02744.c", "upstream_id": "BenchmarkTest02744", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char _dst[16];\n strcpy(_dst, data);\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b62f0412655b275f4b3d56f680339c45304d4d6015f999d006b937a78d011f6a", "structural_hash": "4bf46170210d5f4ee2d6381386a04df9fc5fd097a830a455eb75b5ea3e7e8225", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05585.py", "upstream_id": "BenchmarkTest05585", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = ' '.join(str(field_value).split(' '))\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b204baf3cced921ea186df65f57fe10f3a723442a04154d77de3b96d1c29c06", "structural_hash": "c56df39b396cded8b8e920b9f32c665fc1da10cab2cc81fb945789f2282783ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05339.c", "upstream_id": "BenchmarkTest05339", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n unsigned char _salted[288];\n snprintf((char *)_salted, sizeof(_salted), \"s4lt_%s\", data);\n unsigned char _digest[32];\n SHA256(_salted, strlen((const char *)_salted), _digest);\n}", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63d5007a7e653d3529b70141218cd39407d3746bd8f8460f6af09192ae48345f", "structural_hash": "e3f6fa26012e025aa3196d936eb4a5f969578368a9c002204eba6e3436f7e065", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00730.py", "upstream_id": "BenchmarkTest00730", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\nimport ast\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n try:\n data = str(ast.literal_eval(field_value))\n except (ValueError, SyntaxError):\n data = field_value\n if not re.match(r'^.{1,256}$', str(data)):\n return JSONResponse({'error': 'schema invalid'}, status_code=400)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5bd6a3ada494a5516f2a5c3c778250b2b0ceedc7adf28ef8c36f782afcd73d7", "structural_hash": "c658939cb38633958af7f8488524207fa9cb35425cc11d3e7cda9cd7c2f4a339", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04927.php", "upstream_id": "BenchmarkTest04927", "language": "php", "code": "getContent();\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($processed); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return new Response($_elOut, 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad48e95260a1db0dec475cf1fb987daa60f61b4950cf332b8be64c781d4717e3", "structural_hash": "53cdfad605cf887890e7ab28d524f11e6b30498a1614fe2027f09536a102dbfe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03256.rs", "upstream_id": "BenchmarkTest03256", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let transform = |v: String| v.trim().to_string();\n let data = transform(comment_value.clone());\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00da45ea548cd0fdb11a1d093042bdfe2b71be198648b1061cd9970a5ddddc9a", "structural_hash": "61604fcfa0eaabfad5e43b87e582edabd2aea2313bf0f139df99fab80cb3ebdd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05772.rs", "upstream_id": "BenchmarkTest05772", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let mut data = String::new();\n data.push_str(&multipart_value);\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9ec47a77b5196a8146d6a8a9ec9a75a535333f63313d977e3cd263539b3dfad", "structural_hash": "08b1888c0d6f625b60479ab6731f5e2c120090108dc3ad028613fe9700eb7401", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01118.cpp", "upstream_id": "BenchmarkTest01118", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.path_params.at(\"id\");\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string _cmd = std::string(\"grep \") + data + \" /var/log/app.log\";\n FILE *_p = popen(_cmd.c_str(), \"r\");\n if (_p) pclose(_p);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c5084436f959d5ac7b567bc4fb2d35cf605cdebf16d1365ed2c886fd190875d", "structural_hash": "5cc94391921df1123468dc805b3c47d1e827ded63d5d996fe486b5d14c2685f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01671.rs", "upstream_id": "BenchmarkTest01671", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(referer_value.clone(), |s| s.trim().to_string());\n static _RE_SCHEMA_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[a-zA-Z0-9_.-]{1,256}\").unwrap());\n if !_RE_SCHEMA_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n let _role = processed.clone();\n if _role == \"admin\" { return HttpResponse::Ok().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34b563f80fca67dcd5295a1e91dcc6b03be6bfc66ffc886d2807783e4d7574b9", "structural_hash": "63cfee7b0f75d1e7ce74a288814df149254f054c1b0531eaff209b0b20cd9351", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05799.py", "upstream_id": "BenchmarkTest05799", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(header_value)\n data = collected\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da26aff5755623231763d462c8c2edf8e25f75b218621ce4b1c13e335e83e65d", "structural_hash": "c716f4a0115424e000a7177ff23d5b76fa9e08adfa39995ef1e31a8d05b46460", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03711.cpp", "upstream_id": "BenchmarkTest03711", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac5abf30fab7ad6ed3bcbf338a8752cb3fc75047ae8341e3f8a1f4e1ec24b5cc", "structural_hash": "edf41ed6495f2aa6b2ad8e2e7829704b9d4b763b1e61aa960c9a93530c263dd8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03579.php", "upstream_id": "BenchmarkTest03579", "language": "php", "code": "body;\n $data = base64_decode($userInput);\n unserialize($data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9bbe6e919824a506631b4de5e84f54db1069462602ef9ae5f1349b289083df6a", "structural_hash": "8f97f27503e8ccddf00974c9eebcec601fa4ba1b3711378918278dbffb2e0a60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06990.c", "upstream_id": "BenchmarkTest06990", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char _field[600];\n size_t _fi = 0;\n if (user_input[0] == '=' || user_input[0] == '+' || user_input[0] == '-' || user_input[0] == '@') _field[_fi++] = '\\'';\n for (const char *_q = user_input; *_q && _fi < sizeof(_field) - 2; ++_q) {\n if (*_q == '\"') _field[_fi++] = '\"';\n _field[_fi++] = *_q;\n }\n _field[_fi] = '\\0';\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"\\\"%s\\\",exported\\n\", _field); fclose(_cf); }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36952df4aecbabb823bfd0202fcdb4c712f60f9339e6c992db34416670e2c19e", "structural_hash": "3f5ae049046b5c5ed498803947ad0b1d0485b5621191b11dc9e28e9d32da48f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03129.java", "upstream_id": "BenchmarkTest03129", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(multipartValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edb57319882c6f4453e50228babab62d9f6ef095f97f3630540851db1ab66532", "structural_hash": "b331434dda7d1205aab321fb033ce312177f33ff236780a87bf97f93cc3eb292", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19330.js", "upstream_id": "BenchmarkTest19330", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n res.cookie(\"session\", _ct, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-784"], "category": "cookie_no_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3685d1f653f7bbadfc6c1befbaecd30e4a6b701783667f882d2c90fe9855e5c5", "structural_hash": "50e5177761682dd390e9d33477746575bc994e577a3e34ea3b66afe26c82650b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04114.ts", "upstream_id": "BenchmarkTest04114", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const data = decodeURIComponent(userInput);\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d75bff466c5d4875a6026865e08ab1e7ac026e2d17d46c42203fa48ecab7d58", "structural_hash": "8c468ae6b4f7920a19baa6ed54dc4ca2c726cffcfd8370c6b464844c814ac122", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03883.py", "upstream_id": "BenchmarkTest03883", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nfrom types import SimpleNamespace\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n ns = SimpleNamespace(payload=forwarded_ip)\n data = getattr(ns, 'payload')\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n trusted_claim = str(processed)\n return jsonify({'trusted': trusted_claim}), 200", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3ef9305b25fed7b3d7a13adace97d2f633be1c65657ba4ae4fa5b37b0c43e6b", "structural_hash": "bf9fff159f306eeaddef94335cf93ab78da0a1bff27e63d0de11c830eea3030f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00826.php", "upstream_id": "BenchmarkTest00826", "language": "php", "code": "header('Authorization', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ea7714969959d77e2e004c5d965ccd99009df7c1b5cb93723713acc85f37d2a", "structural_hash": "bce0777343b585ad3573432b8a0e00dd5c10f46b198050f29a50fadbcdc6524d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03165.rs", "upstream_id": "BenchmarkTest03165", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data: String = ua_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| ua_value.clone());\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95f4c9ff2a62c07020fac4aea7ad5de3854f71aca782118764449227bc65cc37", "structural_hash": "783431bfab897804b255917f029c1ee0d9b8f959db37f2691160255146d74d45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15248.sh", "upstream_id": "BenchmarkTest15248", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91d62b5f7d724907950dbf442ead4a02b6664024cbfcb84852762c4f5a7aa3a4", "structural_hash": "635a0a50400a8a3776dec0de99edf3ec8a5ebbce80bcdcd7c3350de28b6a8231", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15780.go", "upstream_id": "BenchmarkTest15780", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(fieldValue) {\n\t\tdata = normalizer(fieldValue)\n\t}\n\tsalt := make([]byte, 16)\n\trand.Read(salt)\n\tsum := sha256.Sum256(append(salt, []byte(data)...))\n\thashStr := fmt.Sprintf(\"%x:%x\", salt, sum)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d965895e1143dcf6f026b8e3483d001802202a2285f3eb68467406fc5a0efef7", "structural_hash": "744c1d480fd621acb2868bae534278967775dcce09a051dfb489eea0b295dbab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00938.rs", "upstream_id": "BenchmarkTest00938", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (raw_body.clone(), \"http\");\n let data = payload;\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n log::info!(\"User action: {}\", processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "009bdb5affcae7185d196af896e6993510f18e4bd6bcb923c67bf8ba8d0aa784", "structural_hash": "c7f9f11aef63038b5fff14dc89d60767deedf7e8be731cb167a13e9755c3cb83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10512.c", "upstream_id": "BenchmarkTest10512", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _d = atoi(data);\n if (_d == 0) return;\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b45353d0ae68cb5693add879889b6f9e7139c73ad19b328e481b7258192088a", "structural_hash": "f78ff8524b5fa564c79adf5941636dcf6bea2bd51bed962a58f85d1200bac233", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05084.rb", "upstream_id": "BenchmarkTest05084", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n Net::HTTP.post(URI(\"https://api.intra.net/data\"), data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a27e85d733eb57876fa5bd1ab718611316dbc68dda48d0daa8a06a05193d3fd", "structural_hash": "522efb89403f73cff6c447090f2cedeed77b3f956f6004e99df8aca67f812f10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03193.php", "upstream_id": "BenchmarkTest03193", "language": "php", "code": "header('X-Custom-Header', '');\n $data = call_user_func('strval', $userInput);\n $valid = is_string($data) && strlen((string)$data) < 4096;\n if (!$valid) { error_log('schema validation failed'); }\n $processed = $data;\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$processed), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "303a6b8c30a8ec71df523d39ad6a7af8dac173c5f532bb9465fc5ff77785cd34", "structural_hash": "088c326db24b45aa88b6b061c4ee8bb2fe600dfaf4b6c076d1578524a5fd50fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11217.c", "upstream_id": "BenchmarkTest11217", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0600);\n}", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3cbec726da149fdb012640c47f970a0610c3708b82688490f52c772706476dd4", "structural_hash": "2f789ac3cc4a85794ef91fcbad114da349a86fabec8e1df12e11ea4de97df890", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17505.go", "upstream_id": "BenchmarkTest17505", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tsegments := strings.Split(forwardedIP, \",\")\n\tdata := strings.Join(segments, \" \")\n\tvalues := strings.Split(data, \",\")\n\tif len(values) > 0 {\n\t\tw.Header().Set(\"X-Param-First\", values[0])\n\t\tw.Header().Set(\"X-Param-Dropped\", strconv.Itoa(len(values)-1))\n\t}\n}", "label": 1, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e82e95646e97786a335fa091d14142e170817d8f2aa8bbc1aa208e2d9f2e46e8", "structural_hash": "04866d74250b3f377a8bbd3a154aac8aa8cc14e75d2544158e292f8ecf80991a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09587.c", "upstream_id": "BenchmarkTest09587", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n int _vals[8] = { 0 };\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 0, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90c10ffe7d4551ac653b57a73e99975cb7321e8d6b525990ecbdcb7da7690b57", "structural_hash": "1c1a81eca8d2910814540b1da8a2447a5e98e6f301b3d8d46665bdabed76053a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07786.sh", "upstream_id": "BenchmarkTest07786", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2138a1b5b463490575d075b4c3bb9a6232fb44c4f4e556b0f06fdec95c27d806", "structural_hash": "a9968ecf9b5bef281f6d6566d5d0dffc5001e12a3deed1792b12bcbb7cc14f4b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02521.py", "upstream_id": "BenchmarkTest02521", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n data = '{}'.format(user_id)\n entries = os.listdir(str(data))\n return JSONResponse({'listing': entries}, status_code=200)", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "736672cb4fa464c4642351e096d1f0235bcd80cde492f4239b7884083e88f2e3", "structural_hash": "e962f13e386a1950f62769aca8e47d4d42caee6bcd2201824fc5f55ab3ef0bf9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_33872.go", "upstream_id": "BenchmarkTest33872", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tdata, _ := url.QueryUnescape(multipartValue)\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f033cb3a22cea3141b202bf73e4a8ecc2990f8e8a3e0c46e12156fc4c7c53717", "structural_hash": "b353b1f07f43c66ecd74a3bd8d42bf6404e83cee686c168fd73e9b39fb16faec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05964.js", "upstream_id": "BenchmarkTest05964", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-340"], "category": "predictable_prng_seed2", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7edb8c8c51c58c1340bfa66dfd23a777f761a79f8844f69d3a60e30e49e26863", "structural_hash": "bbdaa67f36757fec08ae826ad07517c103eb179839ef09e0e651fec86b838241", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_27620.go", "upstream_id": "BenchmarkTest27620", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar data string\n\tfor _, token := range strings.Split(rawBody, \",\") {\n\t\tdata = token\n\t}\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dabc69dccbfc0b9d3eea5ec5174230c1c93ccf427fd005dc74514ca2be2d5958", "structural_hash": "d42fbc5ba49466d1f4e5f4e74937d7f85b9ffefff35ac7b630a530d5ea62e58a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01141.py", "upstream_id": "BenchmarkTest01141", "language": "python", "code": "from django.http import JsonResponse\nfrom urllib.parse import urlparse\nfrom dataclasses import dataclass\nimport socket\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n form = FormData(payload=auth_header)\n data = form.payload\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return JsonResponse({'error': 'forbidden host'}, status=403)\n target_url = data\n s = socket.create_connection((str(target_url), 80))\n s.close()\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c97a0b61200ccf7221da8d314b23690608f5e85844a422abc85c98ebc15de444", "structural_hash": "dd7d48322aeaa51550f0ae0b7ea5365ea0727c32ba193e63192b72067d568221", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04873.ts", "upstream_id": "BenchmarkTest04873", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35a29c605def3b6eb501dd448b3d0c091c7a1db3b6f550d63046afb7b07e123e", "structural_hash": "b16196988b092c153d8efa81269923d7654bd4532b80785decef677de228cf1f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08248.c", "upstream_id": "BenchmarkTest08248", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n unsigned char _salted[288];\n snprintf((char *)_salted, sizeof(_salted), \"s4lt_%s\", data);\n unsigned char _digest[32];\n SHA256(_salted, strlen((const char *)_salted), _digest);\n}", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d53aacfe41794a373f01596ec20ab0637c8f77b54f6efe53bd446a42b75480ee", "structural_hash": "47b97d8bc179f1718481d951a4fa92e0926b0a113c3b01b0df6b94090399ead5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05572.rs", "upstream_id": "BenchmarkTest05572", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n data.push_str(&json_value);\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88442675b4876fd2c0726a0365003d6b1453f25cfbc0aa9031255d437dda880d", "structural_hash": "3644494db70a9224e1f84c118274554ddfb081894fd83bcab903dd45ba3aa388", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00554.cpp", "upstream_id": "BenchmarkTest00554", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n std::string _path = std::string(\"/var/app/data/\") + safe;\n if (FILE *_f = std::fopen(_path.c_str(), \"w\")) std::fclose(_f);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "252e15c6450e3903cd756cdd2effecd5ccce58b25d7891a1a0dcea392fe54a86", "structural_hash": "4e16642d3d4028f937482efc884362aa57bd4635d05b70bb334b08ce951059df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10956.go", "upstream_id": "BenchmarkTest10956", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(configValue)\n\t}()\n\tdata := <-resultCh\n\tencCookie := encryptForStorage(data)\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: encCookie})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90933ba90532b6fa85a2c8bd21f2881ee4d438d7b95bb5c892d58e460960d95e", "structural_hash": "f4f8b320bf4aa43cb50cd01fd1ee2a8a4f87d82df3778f6ff5c7035010c1354e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03428.php", "upstream_id": "BenchmarkTest03428", "language": "php", "code": "header('X-Forwarded-For', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $processed = (new \\HTMLPurifier())->purify($data);\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bace1b3ef1659a5866fdb8b96dc611c151fbb3bafd449bf0ea5afdb30d20d616", "structural_hash": "39c4204b72d46eaeade8e56aa47983c0b4939f4597580f275e0f16462aeeed40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_40588.js", "upstream_id": "BenchmarkTest40588", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const storeCred = process.env.APP_SECRET || \"\";\n authCheck(String(data), storeCred);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9231dfb6226487d2a45f61e9dee917ce77c560bbb3fb5cccd83728750f6ca76", "structural_hash": "cc3b21b056fa0c8e2f8156702130f92446b18ce1accb03113eb22c422a8004bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03006.cpp", "upstream_id": "BenchmarkTest03006", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DOTENV_VAR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdb6621539faff61320c06dea618c864542264c64407efb01ae26d5f53f7ed72", "structural_hash": "e9692aafd6cea243b4417c3b01972227aa63f528152369d266cd9e9a034abbcb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02039.cpp", "upstream_id": "BenchmarkTest02039", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "824443d21cd9bdc1ea13d038e62e43228b94469a99edc86d6d953fdc27eda85c", "structural_hash": "a70ce794bdaef60796d63f87a3d4a3d9d02851f1617409f928a63de80204564e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02802.java", "upstream_id": "BenchmarkTest02802", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data;\n try { data = new String(java.util.Base64.getDecoder().decode(authHeader), java.nio.charset.StandardCharsets.UTF_8); }\n catch (IllegalArgumentException base64Ex) { data = authHeader; }\n try (PreparedStatement ps = connection.prepareStatement(\"SELECT * FROM users WHERE id = ?\")) {\n ps.setString(1, data);\n try (ResultSet rs = ps.executeQuery()) { }\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc15a1664d017db12becfd2764b967fcf7bbce146d25ef2371926e74d29f172f", "structural_hash": "1500c1e06050ac457e2126760b0b754e351f3df2b4e145fa0bb6eda9982316a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_38691.go", "upstream_id": "BenchmarkTest38691", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(hostValue)\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "815459503468062e57d383cd04052db7ccd8095191484e52cb2f115bbd7b4227", "structural_hash": "5e9852ad9723018980bff3d87caa947e0c7605b3f33d5195ee39a91b0ea354a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00412.rs", "upstream_id": "BenchmarkTest00412", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let profile_value = crate::shared::db_fetch_one(\"SELECT bio FROM profiles LIMIT 1\");\n let data = match profile_value.chars().next() { Some(_) => profile_value.clone(), None => \"default\".to_string() };\n tokio::fs::write(\"/var/data/plaintext.txt\", &data).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "375c8b146f2644d2592d16b09b6a63f29e90fa32c1636748470faf7294d95467", "structural_hash": "87c67784c47a634d699fc7339ee6a847761da4a833de49269c71a362ddd3422c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09141.sh", "upstream_id": "BenchmarkTest09141", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n case $data in\n a) echo alpha;;\n b) echo beta;;\n *) echo unknown;;\n esac\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7172ec75db57787133359acfb34a399675e2c7164a693a3ae5ff872a67c56e68", "structural_hash": "6a7d38542491a998cd328856bd01f4eec4d23be41f819d24023aad05df64bf77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19991.sh", "upstream_id": "BenchmarkTest19991", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f49f38598b7b98d78530e42a190e3fb8cf50ac9c1e79d3b2714deb37d11438e8", "structural_hash": "2617982eee29e119017d6d4f9008649709dfd5c714c4c49082fa5e694d0eac7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03383.ts", "upstream_id": "BenchmarkTest03383", "language": "typescript", "code": "import { Controller, Header, Headers, Post } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n return nunjucks.renderString(data, {});\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0dc8555d99d0f5258d243c3890748eb7ac3af94c5dd2be00f71ea5e23dda4cd4", "structural_hash": "3073ee8ee0197bb5ff87830bef9ad1a1c2d88bf662dd939ce891820f3485dbb7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07459.js", "upstream_id": "BenchmarkTest07459", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a042b82b482c16b84c0abaadad702713628dfc6f781a07a54d80e44909658a25", "structural_hash": "485c4de6bf932332802f1d91b505c5ba5094f4b5c9295362a37a2b6a0bae4fbf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05171.rb", "upstream_id": "BenchmarkTest05171", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = { secret: \"p4ssw0rd_test_xyz\" }[:secret]\n payload, _origin = user_input, 'http'\n data = payload\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53d0411b31c7c2b2426abde0c25b954a69eed717a2d587559538beb768792259", "structural_hash": "331a6344e15460cfcf5facbf5a34babc9f795b1f6634b0a03d80f8906385cb58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05662.rs", "upstream_id": "BenchmarkTest05662", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n crate::shared::render_html(&format!(\"
    {}
    \", field_value));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "347248b4bc6368a12f8d2bf0449cd545b6697ab3bcbc1a02b7909e59ecb4f3dc", "structural_hash": "964362f42822405f5f86c493ac5173e6e2dbfef84066e03cdedc2c2b038591bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_11549.go", "upstream_id": "BenchmarkTest11549", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tvar data string\n\tfor _, token := range strings.Split(authHeader, \",\") {\n\t\tdata = token\n\t}\n\tif strings.HasSuffix(data, \"/public\") || strings.HasSuffix(data, \"/static\") || strings.HasSuffix(data, \"/.\") {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-289"], "category": "auth_bypass_alt_name", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6f3d80d3472a90988122fa7aacf5ec28220b4d01cc7fe15dd38681e0681ff60", "structural_hash": "c32c2d2cf27dd55d44f9c9d3bb5a0b751894c755dd745808e3d2bb53f03406ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01533.rb", "upstream_id": "BenchmarkTest01533", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nrequire \"yaml\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n data = CGI.unescape(user_input)\n YAML.safe_load(data)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b4cfe5918ffa71aec8291fd58f3e58ec6f0bf477349f8b15871817acc48c829", "structural_hash": "873f955d83fc01dcd7fdf0d60f3c17f32bfeac318f7428d8f991f68434d93ed2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04967.java", "upstream_id": "BenchmarkTest04967", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String data = \"\" + uaValue;\n if (!(\"true\".equals(data) || \"false\".equals(data))) { response.sendError(400); return; }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3c2ed5d5197f549b65a1ab6040feb9daface7e3dd32a7fbf847af316309b1f8", "structural_hash": "ce13b736127312f3fb39b69d43034a3774a5d74c1147fc3f87e1e2a2ef7e2d40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04396.php", "upstream_id": "BenchmarkTest04396", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('output.csv', (string)$processed . ',data' . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e99b1573e5a289d3f8d8e6cf91ec576ea3e60cf55b85096868b4f59c9ee30af8", "structural_hash": "be41586938e3934990fbc8c8ab6b1168907e128919132cdba3f85e9f6ddc77c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04996.java", "upstream_id": "BenchmarkTest04996", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.xpath.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data;\n if (userId.length() > 256) { data = userId.substring(0, 256); }\n else { data = userId; }\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n XPathFactory xpf = XPathFactory.newInstance();\n XPath xpath = xpf.newXPath();\n xpath.evaluate(\"/users/user[@name='\" + data + \"']\", new org.xml.sax.InputSource(new java.io.StringReader(\"\")));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a346b4c62da562b7e1a4056e5e5544f74fe5e0de46ab660ba61bcc40c95aca56", "structural_hash": "5c6d52e4c818a8701a9ff11fd5b60be5a58b263c972a423f96593e1956004f0c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02173.c", "upstream_id": "BenchmarkTest02173", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6591f8c4d262d9956b9efb9cdc8e554b2d7d8608504772212cb6eba335c4c219", "structural_hash": "4e721cef0030c4e6a00ace78d523a5f74b9e283f3282f473f5e8da222469572e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03572.rs", "upstream_id": "BenchmarkTest03572", "language": "rust", "code": "use axum::response::IntoResponse;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let _prefix: String = env_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => env_value.to_lowercase(),\n \"f\" => env_value.to_uppercase(),\n _ => env_value.trim().to_string(),\n };\n axum::response::Redirect::to(data.as_str()).into_response()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68f8af78b7170ef85dbecac22539152109e7aa4c6139e326afe776a547d5dafb", "structural_hash": "0b26b7acf03fd739a9288d9ce47c2a9be141e88596bad0b92ae684ff9a9681c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01308.php", "upstream_id": "BenchmarkTest01308", "language": "php", "code": "getContent();\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1115c5f5c664ab7f6df1aa6878c0b9a4ba9e4141151d15de523c29c39c5103c", "structural_hash": "b892b7902ec3471960fefefc43e59a15e063ed7337678b7811ed42639194358d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04031.php", "upstream_id": "BenchmarkTest04031", "language": "php", "code": "getContent();\n $data = json_decode($userInput, true)['value'] ?? '';\n eval((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "657c9cd21056368c60242f3b275901f78477064841e548c2308b242006f02f75", "structural_hash": "195dccac050b01906d26f533f7dadaf743053246f722eb10890e17dd7a5748e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09892.c", "upstream_id": "BenchmarkTest09892", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *safe = user_input;\n if (strcmp(user_input, \"/bin/echo\") != 0 && strcmp(user_input, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n void *_h = dlopen(safe, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ca988096d68ad3209bcd30f3c4ba6d47438e4f114275116bfd706b819f67ebe", "structural_hash": "56f426d28a2cf3ed433d034a0d775422323cf01d71108b63a9971eed867e6a1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04233.rb", "upstream_id": "BenchmarkTest04233", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = format('%s', user_input)\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n trusted_claim = parsed_bool.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb01d0c50a97f68f26bcebd1cc55145ca66fe12c4a858235fe063ecd2b59b5c5", "structural_hash": "513bc6a525c5e2d9e1f89c78cb8caa174e14b389be3e8aaf4552ca48621e4d23", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02824.rs", "upstream_id": "BenchmarkTest02824", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = if db_value.len() <= 4096 { db_value.clone() } else { db_value.chars().take(4096).collect() };\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "952e04094348a543019092fa9079292459f81d6660bea2c195c7d6b3688b334f", "structural_hash": "634d249ba29f2403b3f39592e857ff7544888d39e8d39805c7be980dee8435a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04390.ts", "upstream_id": "BenchmarkTest04390", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = { secret: \"p4ssw0rd_test_xyz\" }.secret;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c0aac6f6a8389fd69d7f3d9e543864c760e6d847beb24ad90beb62985cca971", "structural_hash": "265ca110942595428da656d01491e14faeb3749bbaa080de9ed85d9c56c63bc8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37591.js", "upstream_id": "BenchmarkTest37591", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n authCheck(\"admin\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "499dbde4229113809915f0899322cdcf06d3d8b23c0a44db58190e3db59a2fd1", "structural_hash": "9871247c0900b258b949111159184dad9469f1fd4e53099a62a674718b378ac6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11001.c", "upstream_id": "BenchmarkTest11001", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"cfg/%s\", user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a88ab7b27d3e0fbb9258c7fdd1429dd0087a33ec8a85aa313f174348a5c87a6b", "structural_hash": "d33c2f7e8b4b036cd9a2c08743a583943a1bb4cd345de164ca5a7e5d0ea77dd4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03139.cpp", "upstream_id": "BenchmarkTest03139", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7834577cc70bf0c6c316c4257f33113c64d029983b5d78588692b81b9f96bf38", "structural_hash": "ad442895d4f8ef56c9ffd8ad2f17dba0b2bfa5259ca995e39f637ba6e9c92065", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06157.ts", "upstream_id": "BenchmarkTest06157", "language": "typescript", "code": "import { Controller, Header, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as isoDompurify from \"isomorphic-dompurify\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const processed = isoDompurify.sanitize(data);\n return \"
    \" + processed + \"
    \";\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "743e28e1529c5bdfe5a04f11ca4eb34d6833b07cadee21df26b5a9952f092524", "structural_hash": "5424095e58b05213753a5182d8ce148c7000e510d059f3081c68e8317c013327", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_41128.js", "upstream_id": "BenchmarkTest41128", "language": "javascript", "code": "const zod = require(\"zod\");\nconst { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const data = passthrough(userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n ctx.type = String(processed);\n ctx.body = '{\"status\":\"ok\"}';\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b73466d5e5da2967b7367004cd84066d809fe0847160dddd15bf13d0de2e8a02", "structural_hash": "e1bc9e7f37d578afa7abf84e89cd3d24cf96a303d41a5e827a5a419bbf47f388", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04799.php", "upstream_id": "BenchmarkTest04799", "language": "php", "code": "header('Host', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n return redirect($data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8e3d684fcf8f58808af0e2eeb912b0dee6a42dc9f2790d25c314653720d286d", "structural_hash": "dc060a44e3161688b3b2726e8b782aa5399d7284db3e3149dcad1bf14b1d4a7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02044.rs", "upstream_id": "BenchmarkTest02044", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", multipart_value).ok();\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n log::info!(\"User action: {}\", processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc4e3aa4ec74abdd8a851ea1eb514139627727ff527169a0321ec6a53cf4b4b0", "structural_hash": "e4e0223bbfbc041723699fc898d8e5046ccd03733c7e9dee2bd6082ca0f88b58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08809.c", "upstream_id": "BenchmarkTest08809", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n xmlDocPtr _doc = xmlReadMemory(\"\", 8, NULL, NULL, 0);\n xmlXPathContextPtr _xpc = xmlXPathNewContext(_doc);\n char _expr[512];\n snprintf(_expr, sizeof(_expr), \"//user[@name='%s']\", data);\n xmlXPathObjectPtr _xo = xmlXPathEvalExpression((const unsigned char *)_expr, _xpc);\n (void)_xo;\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "940d0062bb4fe18006cd07e4990a6a1f91842b5414861ace2a25910750db9904", "structural_hash": "ab276a845970d55e4cda42c5edc0d41e86aa8f76831bc126630a5161bc93ef42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00198.c", "upstream_id": "BenchmarkTest00198", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed680dad38fa60b9cc9688ce5f5ae145f3fdefbcfb8246bc02442be6e76be3f6", "structural_hash": "0aa009569f39d2c0d1d0814eb3c451dcc9216fe0c23b6ba858aad59b1ad90e76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02320.cpp", "upstream_id": "BenchmarkTest02320", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99e214cca5ffe1f46247a703161091a5dc6855eafd6c9b5d91e81fac635e9e99", "structural_hash": "ae01a1b51b7e89472d39464471ff5a73e1fa29263b9e857de084533610c8b6c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03858.py", "upstream_id": "BenchmarkTest03858", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nfrom types import SimpleNamespace\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n ns = SimpleNamespace(payload=multipart_value)\n data = getattr(ns, 'payload')\n eval(compile('requests.get(str(data))', '', 'exec'))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcb3df93ee5d89082297e48f87f499de5d9aed231723fac0f3efdca59b483b3f", "structural_hash": "7716f4c3e70bdd19e2eebb891273e84db4a134fd6fc25a505c37db37ab2ce4a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00045.php", "upstream_id": "BenchmarkTest00045", "language": "php", "code": "header('X-Forwarded-For', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45e57a4c788bc6510276adfbca24eeb6fc22edb764a018b0d09366319de19f9c", "structural_hash": "29bb5976df4d226264daba45b9eb595057509a3e6f20a6d3a48aa7c1b8c9233b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01943.py", "upstream_id": "BenchmarkTest01943", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request, path_param):\n path_value = path_param\n data = '{}'.format(path_value)\n return JsonResponse({'status': 'ok'}, status=200, headers={'Content-Language': str(data)})", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "438a3f6f393e55a6b181a7253e0be6b46b5a29ee8e04093e3d59d8972118480e", "structural_hash": "df7cb1d3c97cf7ea017643351db8777287e351f30eefa21726406e7330b47385", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01644.rs", "upstream_id": "BenchmarkTest01644", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse rand::Rng;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: host_value.clone() };\n let data = payload.value().to_string();\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb7afe20cf3a643acb51bbd16b37cf380849c4699baadc90761f97b35851f62c", "structural_hash": "837fe21a240919e7a60172251b5fade506b4cb103f08b87e00f4d21aaa06aab4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09992.js", "upstream_id": "BenchmarkTest09992", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n if (!authCheck(userInput, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a933560255aaf7c3b0f3550fd3221433b504d4897ff7a8a9b2b46ed97505e8c3", "structural_hash": "9f65469be43184c68637a9ee0c3fe19dbadc71adc9175459fd39e8356d0c7772", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04820.php", "upstream_id": "BenchmarkTest04820", "language": "php", "code": "header('Referer', '');\n if (!hash_equals((string)(session('user', '')), (string)($userInput))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb6cba82ae6eed1e3ff8c35198870582f281044f533613801f108f75488bbccf", "structural_hash": "379a5f34ab48070d6e99fc50eea6003887ee4ab68acb1efc514465b7d10624db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10760.go", "upstream_id": "BenchmarkTest10760", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tvar data string\n\tif pathValue != \"\" {\n\t\tdata = pathValue\n\t}\n\tdefer func() {\n\t\trecover()\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 1, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4af5bf47ffd9435a1deac4d86790c5a407aa5da6f88ee031aa9e46df1c5aec03", "structural_hash": "1446143aef5576a9003941a4a82bc778ee7d83b6990579b627cd231844c17934", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01956.ts", "upstream_id": "BenchmarkTest01956", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = [\"feature_flag_value\"][0];\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "041edd83cc483fe524a935cc94cc09c64e46452cdbfc5b69b0e9f491edbeea60", "structural_hash": "3ba705ebd7d79d592a66baa12dc01fe84a927aad02b35de632bb46d363d26882", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21938.sh", "upstream_id": "BenchmarkTest21938", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e57281e60dba435fc13bea62be4a6297d088c80a11f0f6aa4457260308ba2bbe", "structural_hash": "bdd1d50465570ceca676bc4490857f7e3a7dd015f460031e9668d8bfd40d9da6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03535.c", "upstream_id": "BenchmarkTest03535", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1f5da10849bb34aa1d200c87c5d7769b9044dbe67cbfa35bcff33e58f8c7cd1", "structural_hash": "8c88ac906f1a0aebfa36a607cde4257deb841846296cda96272aa803374132da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05563.rb", "upstream_id": "BenchmarkTest05563", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = !user_input.empty? ? user_input : ''\n resolved = File.realpath(File.join(\"/var/app/data\", data)) rescue nil\n unless resolved && (resolved == \"/var/app/data\" || resolved.start_with?(\"/var/app/data/\"))\n halt 403, JSON.generate({ error: \"forbidden\" })\n return\n end\n checked_path = resolved\n File.write(checked_path, \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c8896352db128bba12fd283009584d605075fa149ffac22d2ce0d5d963fe2ff", "structural_hash": "d6b81d9558a5d0cdeeb6d7ba60719069210b0eb5c44d445e4fddec232496b246", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05858.rb", "upstream_id": "BenchmarkTest05858", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = \"%s\" % user_input\n headers[\"X-Custom\"] = data\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3432f0e3e8b7ef38a9592ac35a171781749e4799298ddeb0b340a0eb7bca3d88", "structural_hash": "9ce6d891e15861311f2a6fe7c5cf4d9e2eab19e7f51ea5af0c7de060e23c79cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03610.ts", "upstream_id": "BenchmarkTest03610", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4109b135fd4d2c4647f442bafbfa29c8cf944bb2629c5d2e1fae8a330c50eac", "structural_hash": "0cf6e714c2b00cfcb804e7571109723763cadb3f53e4d9feb9af2e3b787f2d1e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11259.js", "upstream_id": "BenchmarkTest11259", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1360117f0fa4af186f5bcf2bc48c724f6bda6bab9925b93e2d0373fac44f90ea", "structural_hash": "4d5e5a058117c4f7205135b13268b43275185b16fd6a5adb5eab70713cf94e9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01122.rb", "upstream_id": "BenchmarkTest01122", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = Thread.new { user_input.to_s.strip }.value\n ActiveRecord::Base.connection.exec_query(\"SELECT * FROM users WHERE id = ?\", \"SQL\", [[nil, data]])\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afda87ee489a3526907deabe2984c00028d97031b6fdbea5ae945140cf2f6c2d", "structural_hash": "84af8f97d2e424f656a34b9191487c6b1be631eb9b3d7a32d16d23587301184d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01975.cpp", "upstream_id": "BenchmarkTest01975", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n std::cout << _buf[_i] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b70d16e7177d4abb6fa1dde9b0e4c982e6dbc5cd68c8619e672331104ce4e5c2", "structural_hash": "09da3d025630f5d5d1691c8c67c69d1a246af719cb412686306e991daf2874b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20339.sh", "upstream_id": "BenchmarkTest20339", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n case $data in\n a) echo alpha;;\n b) echo beta;;\n *) echo unknown;;\n esac\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c7e51b7d256ea1ce4b4009c2554270d7bd0284641ca452eb29795c7f58cd7af", "structural_hash": "1db9b4bb538521d14b2bf69b14a554f7e7a0004f292a61dd610a34d20161fcdb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04671.ts", "upstream_id": "BenchmarkTest04671", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const data = String(userInput).slice(0, 200);\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a549611ce0d38b2ee74fecfac3f8d453abe5d829a9b02768cae3bd786b1c96c7", "structural_hash": "1da964816dc46df9c60533ba755ca57ba5dac66df43d901beaea229cf8113422", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39936.go", "upstream_id": "BenchmarkTest39936", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tdata := strings.ReplaceAll(forwardedIP, \"\\x00\", \"\")\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tc.String(500, fmt.Sprint(r))\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4cff5ab60abafc5ecab1807a5e893bdceec0ebc858e37086bf2596b4ffc46a1", "structural_hash": "7c7672b51c3425aa80025e09c38f506d6ce161fef5c3a31723c34b9aa91e3510", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26509.sh", "upstream_id": "BenchmarkTest26509", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n printf -v data \"%s\" \"${user_input}\"\n processed=$(echo \"$data\" | tr -d '\\r\\n' | sed \"s/[a-zA-Z0-9]\\{4,\\}/****/g\")\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6490c4f83d22229ba4e61e504d569b10a1c52d22e12b111825560d3cec213406", "structural_hash": "fe686315ba2b7fe5a6a1ca346e00c5ab43cc933a97f23a62008732c5857d4115", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00032.py", "upstream_id": "BenchmarkTest00032", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n data = '%s' % str(forwarded_ip)\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1ed05a909d82e610038434684ad4e07a2357606c80e16cb324daebaa6cd513a", "structural_hash": "fc88e70095c1d93080cbc7f2cdef5e4883e6abb642eceadb6923a3042cef72ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01191.java", "upstream_id": "BenchmarkTest01191", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data = headerValue.isEmpty() ? \"default\" : headerValue;\n Object evalResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e22b780dc704bc6c3c7da9b4f6d1f31ca2ceaa3f97b7b2b44f005a721dddc748", "structural_hash": "720a289970ed560b00e37efd6a137ef32bd38d120c240375d7cbbba1f8f2b212", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04718.php", "upstream_id": "BenchmarkTest04718", "language": "php", "code": "json('payload', '');\n $data = call_user_func('strval', $userInput);\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$processed]]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ecacfb2d6c6bd932fce2c53d44624d6d9b803f6f829b094695e2defe7de9cb1", "structural_hash": "1d397318c95bc3aeee56841d5ce0897ce744ac3b039b12c8748dd11a1fadbd22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_42528.js", "upstream_id": "BenchmarkTest42528", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/uploads/data.enc\", _ct);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7fb5266e0c525c1ebe8e3c71f4275bd803b438bb05765ffd1a9145927df77c15", "structural_hash": "42ca1d6a3d0e1ec2b1288bff11dc7ea4970124799ff47049ac1fd2f75d3ebce4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05702.rs", "upstream_id": "BenchmarkTest05702", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse url::Url;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let data = env_value.split_whitespace().collect::>().join(\" \");\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n let target_url = data.clone();\n axum::response::Redirect::to(target_url.as_str()).into_response()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0897b682bfaa072280882bc64facdf614486e46dc516f85429ce2abf3cf227a0", "structural_hash": "95c47d8b1f942c25fca8b5ceeabb10a7ec5cf13ff78f5385cd7e26bac82ac24d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02669.php", "upstream_id": "BenchmarkTest02669", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6aeeaec018da8ff61e2eacb307908c32b62d5d7f432e953cbc0553d47edb4fd", "structural_hash": "57f43e52a63d5fa297e1aa3cc932e82b1f9c3d2e7c8f180a2e38cb88efb361f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00297.ts", "upstream_id": "BenchmarkTest00297", "language": "typescript", "code": "import { Body, Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string, @Req() req: Request): Promise {\n const userInput = mf || \"\";\n const data = \"\" + userInput;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3f7e5b13230afeb81d98a8bda089e278c32a6a6a8597875c9a16567d9724a92", "structural_hash": "83aa3ee38bc131f1a1c14e40435d8452af5109cffe1811a27bf14c0cc1b11fff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_40469.go", "upstream_id": "BenchmarkTest40469", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tdata := func(v string) string { return strings.TrimSpace(v) }(commentText)\n\tfor _, a := range []string{\"read\", \"write\", \"delete\", \"admin\"} {\n\t\tif a == data {\n\t\t\tRespondJSON(w, http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\t\treturn\n\t\t}\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-285"], "category": "improper_authorization", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1b6c1389b476685dc7c1f4892f27156f06215742b894a8aef1f9049cc0d5ab8", "structural_hash": "a8c46652ddc01d900c54f6af707d7e5fd3935eb8290c95c226b8835976624ec4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04569.go", "upstream_id": "BenchmarkTest04569", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdata, _ := url.QueryUnescape(cookieValue)\n\tparsedInt, err := strconv.Atoi(data)\n\tif err != nil || parsedInt < 0 || parsedInt > 2147483647 {\n\t\thttp.Error(w, \"invalid integer\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tboundedVal := strconv.Itoa(parsedInt)\n\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(boundedVal)\n\tif idx < 0 || idx >= len(arr) {\n\t\thttp.Error(w, \"index out of range\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tw.Header().Set(\"X-Lookup\", strconv.Itoa(arr[idx]))\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f0b489865b0c8381d5495957e6b9e44f7cba1b080c52abbeb64bb25893cfeea", "structural_hash": "8ca099078d1088c6e46695c00af3bda0604b2f2f79659f620bdf38300a52ba67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03852.rb", "upstream_id": "BenchmarkTest03852", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n render json: { error: \"invalid type\" }, status: 400\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f02d0e9faf13b1de7b353953a950e1a760c76c806b68a86aff32907c8c21f70", "structural_hash": "b74f6a738eb3291bac0b5a53d63fe3ce0d1239c08e6911f88920432e19c2c1c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00824.php", "upstream_id": "BenchmarkTest00824", "language": "php", "code": "input('field', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $token = bin2hex(random_bytes(32));\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a35f6aa1d75b0c39ff41f50df3215977ef942e4bae4cbe9fa43b610e7369e26", "structural_hash": "847bf7665ae930fce4358880bbc1fbda015c0c7bc8456a50e6ea178b2996a652", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03328.php", "upstream_id": "BenchmarkTest03328", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n return new Response('
    ' . $processed . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d28baa18ea2c3bbb8fa3d2bdd21fad6d4dce668a0e8ef42b00f18c6a40dc7597", "structural_hash": "9392b4e5bc16a696f273025109eb1ec35a8efbcaccf47c78ea2937651c5aefb6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01054.php", "upstream_id": "BenchmarkTest01054", "language": "php", "code": "header('Origin', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $resolved = realpath('/var/app/data/' . $data);\n if ($resolved === false || strpos($resolved, '/var/app/data/') !== 0) { return response()->json(['error'=>'forbidden'], 403); }\n $checkedPath = $resolved;\n unlink((string)$checkedPath);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dede565a67b436e55714e6c0920f006c0ba7a8b6cb4af347767bf5a811005394", "structural_hash": "fc577a1f58b45ef8323a3c512a3c45875a34625651c400d6d598f5af3710a11d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_33398.go", "upstream_id": "BenchmarkTest33398", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvar data string\n\tif len(fieldValue) > 0 {\n\t\tdata = fieldValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tquery := fmt.Sprintf(\"SELECT * FROM users WHERE id = '%s'\", data)\n\trows, err := DB.Query(query)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-566"], "category": "auth_bypass_sql_pk", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "927dd4437bba22a6fb475eda6d4b09a580c944efc08e38777346516ee287c7f5", "structural_hash": "f8474fe07ad2274953d5639ce5fac450228b70e6110e0efcde4f19e6500106c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10184.js", "upstream_id": "BenchmarkTest10184", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n if ([\"https://app.jscdn.io\"].includes(data)) ctx.set(\"Access-Control-Allow-Origin\", data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "803eacf6ace5b5f89a34ca8d88cb12708ea90ec29bd4b3126f0816f23beec1df", "structural_hash": "7579bbe15ed305e64b1092f4ee296f59689fe51f5a4fb5b6f13386a132db75c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01928.ts", "upstream_id": "BenchmarkTest01928", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n console.log(\"Action: \" + processed);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66debf8b74c7fb780450617b5ee9bcf470d7aa9388bb1c74b821b01530d9e1a6", "structural_hash": "c7ec186a81ce7149ddedbc638b53fffc1cb4bada8f98029e4ee1ca870d4dec1e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04016.rb", "upstream_id": "BenchmarkTest04016", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe361d6645614be1c1f484dec1bba3801cbb962da58a463bf5ccfe5644ade96c", "structural_hash": "69b384825a7dfb42eeb7955ddf11bd971b3c65e7565abc2f755fa776d8f18b2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03276.rb", "upstream_id": "BenchmarkTest03276", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n render html: (\"
    \" + data + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "011fa39b670f3b2080051dc0c1a6bd57406b6ce796729dd74fd2d17e70af4431", "structural_hash": "72064025bb2ea3a172ef6e7c7cc4a6d880f7b9b9a2172fe85030f355bb867e0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04591.rs", "upstream_id": "BenchmarkTest04591", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let redis_value = crate::shared::redis_get(\"user_data\");\n let data = redis_value.split_whitespace().collect::>().join(\" \");\n reqwest::get(&data).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ca40382954be5d047526fc4a0d2d1113ff52173b0e04fa4513840c494d241e2", "structural_hash": "7529703656549ce096e1a153f93bef319e2c42abbfc121b97a3d3905dda640d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02438.py", "upstream_id": "BenchmarkTest02438", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n kind = 'json' if str(xml_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(xml_value).strip()\n case _:\n data = str(xml_value)\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74b1794e0634befb26abcae9076c1dee504a7eaa37a1b6b8bf36292b22a469d2", "structural_hash": "9a58c5b233d1abd1d9302119c9fb9c86439c193b1d9d66ab31d2f87ad8af4ebc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05639.rs", "upstream_id": "BenchmarkTest05639", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let data = crate::shared::passthrough(upload_name.clone());\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44871ae30af5852b51cc5a58485eaf9c92cc650e00b529b5ad9f85e684fb58fe", "structural_hash": "589138c78ab169aed8ab5ef6a75c404ae41a13e244c4642e4af2bf050a3cfad0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05854.py", "upstream_id": "BenchmarkTest05854", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nimport os\ndef benchmark_case(request):\n secret_value = 'default_setting_value'\n def normalize(value):\n return value.strip()\n data = normalize(secret_value)\n store_cred = os.environ.get('APP_SECRET', '')\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9479dc15645733fe5dfe22ea350b118c92d5df806c2dd5fa5e7d02455a6f9a08", "structural_hash": "6fd763afe906981cd0512da00d2b39ef8f7ae496083665df05cadc0af3560792", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00947.ts", "upstream_id": "BenchmarkTest00947", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b4100609a0db7438970e149cc5bca6b6abaa9681197e15f7297ac16e039cfbc", "structural_hash": "c2c69beda760fef0e10c3a441362750ea55d50e181b4551600a0a885acfd08fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00052.py", "upstream_id": "BenchmarkTest00052", "language": "python", "code": "from django.shortcuts import redirect\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n return redirect(str(raw_body))", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77a44d8521006ba9b3e322b9ecbab37969edb274db31df897aac5c798382dd89", "structural_hash": "901a4101975e129674e3b42d35e35be5c9402ca93e7bbdaa07f814555aed7d13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05128.rs", "upstream_id": "BenchmarkTest05128", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let queued = path_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return HttpResponse::NotFound().finish() };\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b02fd7c4c26361b88474f5d52e14a9cc4e85c968dfd77fd53d1ed304e1733de7", "structural_hash": "1156d595d3f908b4c96f1170d6e6f32e8d2d5e56b2bc7eb91e11220221fb64fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02607.cpp", "upstream_id": "BenchmarkTest02607", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n if (data == \"admin123\") std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c1a08716844b68fb037fadb72159ef36c1aa56ea7626e39b7a7e0a1e4bbbaa9", "structural_hash": "d6978407886cdc1158c7775fe8d56a866d2000d2a4711e81a56e918acfd6fa03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01154.rs", "upstream_id": "BenchmarkTest01154", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: json_value.clone() };\n let data = payload.value().to_string();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2260a642ab4fe9aa33dc449d0126f12a2e9fc5ec086b56e09b9d267285ba10a1", "structural_hash": "457e5b90a4b8545fa8ddae592ece40374e287514106116db614e05fd8c6ff1e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00608.ts", "upstream_id": "BenchmarkTest00608", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = \"\" + userInput;\n if (data !== req.session.csrfToken) { res.status(403).json({error: \"csrf mismatch\"}); return; }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be7292b6df4d84e3ef939b7761c8d3db97fd253511d68c13003d4625af804148", "structural_hash": "e681b252993e4e3b3d064beff4372a7bf3338479ed9214f1b126baa1c35c1a70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17061.js", "upstream_id": "BenchmarkTest17061", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = String(userInput).slice(0, 200);\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa863590319abc60389b3d2165577f19173ccc2732720a0b09b7b660ff4f78c3", "structural_hash": "5497efab9816e289b0e397d4f90fc0797b83a738d36addc27e4b43e9b5ff46bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00917.php", "upstream_id": "BenchmarkTest00917", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3435cf8e9503e51b5305ae0cc215cfc2af279617270cfaa9781e73021b87f3bc", "structural_hash": "54580e9762b5d4cacdabb61b4730f6fb2b82ff4b0a45dfed60caac009ad1d8aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21285.c", "upstream_id": "BenchmarkTest21285", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: printf(\"other\\n\"); break;\n }\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9538620a734e11b9f969c7ee033812ef5f39ab67bde39f1df2c0e4c03b7db60", "structural_hash": "c2abe320949488b46a8d29941051f565160cdfbad2cb11ec5d2e996a16e1bead", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_40625.js", "upstream_id": "BenchmarkTest40625", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n ctx.body = { validated: String(data) }; return;\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44a34bf11e5d3b2913159f675caee6cf5cbd72b6b3a3426fc253ab4ea1153de1", "structural_hash": "bf33af45d48db0847b37002dbe7e1cfad1c28772c993df7fe3eaa4ddbeb241bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01893.sh", "upstream_id": "BenchmarkTest01893", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n curl -s http://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed69e30ad06d55deba5aee097252d2ef8e46ad7fc41217ca62d577fad7198a11", "structural_hash": "cbe095a12106a2c2297c23614caa7f13442f0e8f81b9a49a53437b44b831ee2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17383.c", "upstream_id": "BenchmarkTest17383", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: printf(\"other\\n\"); break;\n }\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcd43aacdc02197cc1ba481ddd45b70e8bb6d7f3209adc70cbf50993f38c0399", "structural_hash": "cfcef103748e7d54ab9955c056a157149fa7f39ac2de4eb6c1c810dcc36ed257", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00231.java", "upstream_id": "BenchmarkTest00231", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.parsers.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{fieldValue});\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n dbf.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n dbf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);\n dbf.setExpandEntityReferences(false);\n dbf.newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fdce86fb8987547e563000964f63d5a79aa10efae39af29ab1fd30f34544bb9", "structural_hash": "ccb6834b23702e46cc149897a7a4f0324b8ea90b11e7036c2f52fc1b0c319890", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_34075.js", "upstream_id": "BenchmarkTest34075", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n eval(processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7226ffee0fdea5cbcfd9ca83639a036b4a73b91c9bbb0b6aa9fd6894f95a500b", "structural_hash": "aa1e9fc41f23813563d69fa82128aac23ae44841d1bb1a71ba7c7dcadc110772", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00137.ts", "upstream_id": "BenchmarkTest00137", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.DOTENV_VAR || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87915df04ca32afe327473ee9f62097070285f1ba087935b7d62aba73d2010aa", "structural_hash": "390387fbd2a85f5a030d21de507e4648ee797ae2af47621c08d5373974ae3894", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02864.java", "upstream_id": "BenchmarkTest02864", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"file\") java.io.InputStream fileStream, @FormDataParam(\"file\") org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uploadName = fileDetail.getFileName();\n String data = uploadName.replace(\"\\u0000\", \"\");\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bba49554c2ed7bea538d10947bba8744d3ee125cc846e6b32140f99b24dce551", "structural_hash": "26b406ce160b5e106117015de2d506ca9289444e366333e7fe0689203b8757af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03712.js", "upstream_id": "BenchmarkTest03712", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n ctx.redirect(\"/dashboard?hidden_field=\" + encodeURIComponent(data)); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ad186a35cff73ec3988ed36f66d81a0cbc57c1af9c5bbc9ef4e543a06edb54f", "structural_hash": "bb71b6960da3b5d938449b951c7f2b6fe13a70dca3fe0cf44bebcb67621096f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13746.sh", "upstream_id": "BenchmarkTest13746", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "755728e0ee84187585471f713d1f778c4747206ae5e3f81baa27cb50ed15c4ca", "structural_hash": "118873944ad95aaa6bfa20a292ed44b79da9ea08843bfb98ba284a1b0073861e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01936.py", "upstream_id": "BenchmarkTest01936", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n data = '%s' % (auth_header,)\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': origin}\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9cafbf7bdd670cd9cb10d3efa99bed1f3122e146975bd786214394f4e95b0fb", "structural_hash": "09f791d4f8a68ad0115145f8542b30af7bd32884efb109cdb8ac5a969a32349b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01283.ts", "upstream_id": "BenchmarkTest01283", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Req() req: Request): Promise {\n const userInput = cookieToken || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a548f8c0b378103b333463ef80ed9478e6fb9d51fd2b9e595a393bdf2182372e", "structural_hash": "900dc649d3defad2a45a049502600581b5fe8efdb005c4f6639cd0c24ff77e21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01238.rb", "upstream_id": "BenchmarkTest01238", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"yaml\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n processed = data.length > 64 ? data[0, 64] : data\n YAML.unsafe_load(processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "062435814eb98190f93e609dfa34b6417dafd671b84cc76a8a87fed24353eae1", "structural_hash": "0b62ce7f47d7324310e7a6c2333cc5eb3fba8411726dab22a9a723996de942c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04933.rs", "upstream_id": "BenchmarkTest04933", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = crate::shared::passthrough(json_value.clone());\n let processed = if data.chars().count() > 64 { data.chars().take(64).collect::() } else { data.clone() };\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebcae67abed5e22db746cd8e90e10f6b9222d65f3444accc1d4c2e5a45d3590e", "structural_hash": "1499f191e6d93a48236e22aaea9d506176da73f962547b15a19ac6abdd0f41dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00125.java", "upstream_id": "BenchmarkTest00125", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n private static String squeezeSpaces(String v) { return v.replaceAll(\" {2,}\", \" \"); }\n private enum AllowedValue { STATUS, INFO, LIST, SHOW }\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/json\")\n public void benchmark_case(@RequestBody GraphQLRequest req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n String data = squeezeSpaces(graphqlVar);\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e56d56990c465f52ce866d52e1ef4aea3810a516ffcdbfadd66fa10f0930d742", "structural_hash": "4b0c43a7aebfd35fae93b9e67e8cebf26420207e8ab00e9b636cac2c5d4aba13", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06093.c", "upstream_id": "BenchmarkTest06093", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n const char *safe = data;\n if (strcmp(data, \"status\") != 0 && strcmp(data, \"health\") != 0) safe = \"status\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", safe);\n system(_cmd);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f1f02914634053d1d97085c8807c97c68693fcb680bf95910173cd7868cfd21", "structural_hash": "a9351c6fd9a4f2f8cc76050ca01eea4544ad5db42fff470400c33ba0d3bfee47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03278.rb", "upstream_id": "BenchmarkTest03278", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n payload, _origin = user_input, 'http'\n data = payload\n entries = Dir.entries(data.to_s) rescue []\n render json: { listing: entries }\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2b602d5978a114497b9e7b0904e3f3522005d2bf9acb445380b2a00f1ddb29d", "structural_hash": "775f18cce5ceae6dc68fac1f1a14ac50a5f238d2f2cf09c507e3ec55da298a4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05132.rs", "upstream_id": "BenchmarkTest05132", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(path_value.clone());\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a94a76f75b0c68de69b2afc994bf3621bfeb60b1489ad03a2b3f6a0f4a7066b0", "structural_hash": "363aac719be2fed1f2cc89d310b6094e510f3191b095de91a635d74486f98e0c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01919.cpp", "upstream_id": "BenchmarkTest01919", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) return;\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76dfb6d6a650d67db3aa33255704c77134809adb2795b3a70b0b8a2eba740621", "structural_hash": "75b68028f7931c3e1bb0bd9bf00ff4670cc934f7dfce17d378734f21d99d5868", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03375.cpp", "upstream_id": "BenchmarkTest03375", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n const char *_sess = std::getenv(\"ADMIN_API_TOKEN\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "029f89013b3a6b140c50990e5399bf0d7b5e5e6a4b6038c1f54cffdab5fb75be", "structural_hash": "50f0bde3a76b8109f4a4c985b90b96de854f45912e050adaca57455cc5416c54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03607.rs", "upstream_id": "BenchmarkTest03607", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = db_value.to_string();\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "275b2dd71291c7642a40650093d69500764f8d8927862de1802b848f3a2a8e58", "structural_hash": "84ab8fbc4176347206cf7b9359bac248695eab139da3c9f71236ac487bdcbbf3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04082.js", "upstream_id": "BenchmarkTest04082", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n function normalize(value) { return value; }\n const data = normalize(userInput);\n Buffer.alloc(parseInt(data, 10) || 0);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "312f88dc2377ccb56e0ee9c5280f880be7b32bf8ca4d09b259d10ed2285ea2af", "structural_hash": "5d76b3c4681ec55ac7d501194d032369084f92cca8bc41b3b01d7ae23c46a0ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03885.java", "upstream_id": "BenchmarkTest03885", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String prefix = rawData.length() > 0 ? rawData.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = rawData.toLowerCase(); break;\n case \"f\": data = rawData.toUpperCase(); break;\n default: data = rawData.strip(); break;\n }\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n return Response.ok(\"{\\\"status\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb7721d281258f642d0875579cad2400a40ea9c47b591024ff5b6b5ab2a6ef81", "structural_hash": "ab2028b92a6020f66b2a6833fff3b908017f9845bbf366593dddaf426fa3a44e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06230.sh", "upstream_id": "BenchmarkTest06230", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n data=\"${user_input:-default}\"\n printf 'SETTING=%s\\n' \"$data\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "750f83c2365e08108d695bf4bfa2d431361de2d7b1fc3f6c01b8c2516aa5996e", "structural_hash": "5944982aa95f6c3cf727b646f58d815b5a8ea33e5eb0d92f910ca201e9630b6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07307.sh", "upstream_id": "BenchmarkTest07307", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99ddc0ec5c0a637bb0ec7257ae81dcdd1ead4a1de106f119bf4765d70a8a6ab4", "structural_hash": "3e75b2549d86f9ee4bfa6d82c44813aa4ed5677fef860925c81e7e5fb1e451de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11533.c", "upstream_id": "BenchmarkTest11533", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n if (getenv(\"APP_ENV\") == NULL || strcmp(getenv(\"APP_ENV\"), \"test\") != 0) {\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NOENT | XML_PARSE_HUGE);\n if (_doc) xmlFreeDoc(_doc);\n }\n}", "label": 1, "cwe": ["CWE-776"], "category": "xml_entity_expansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "42f5f61965d8453ec8fee19b2d159c06fefa23644682057647ea2a4fde139f1c", "structural_hash": "26007f4e9448afe5bd4a56ed2ae56fa1c15214da7935e3bb67429be76d84735f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03913.rb", "upstream_id": "BenchmarkTest03913", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n return render json: { error: 'forbidden' }, status: 400 unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(processed.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4685cc6e1ad9c55016de9d00ed2d52bf127b22902892af6d379c9de26a9f0fcf", "structural_hash": "7a41a5a4c2f3a9f86716be3a922a23405318d68f9fe50591390f5c2642fe9254", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03343.py", "upstream_id": "BenchmarkTest03343", "language": "python", "code": "from django.template import Template, Context\nfrom django.http import HttpResponse\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n return HttpResponse(Template(raw_body).render(Context()))", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0183b79c35b681b35f7a80663332012d72f2cdd6e14d1e557f1541a906ee7f89", "structural_hash": "8d0128535617c3fc9524a2ea03e6d31a30b879753690466e4693d9bb4b6795fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02159.py", "upstream_id": "BenchmarkTest02159", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\nimport re\nfrom starlette.responses import JSONResponse\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n data = RequestPayload(path_value).value\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JSONResponse({'error': 'invalid input'}, status_code=400)\n processed = data\n return HTMLResponse(Template(processed).render())", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "160bd4417df6dff68e3221f6d47eb13abc0cca1df08bb145d6e5d8f1e3acd502", "structural_hash": "67474c1691a9db9bb78a6f2a31b0f7397eff7ba125301155834ce8061efb531a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14214.sh", "upstream_id": "BenchmarkTest14214", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "699bf653b20742ac6a187ee0fdf96a1dba119c6e7c316e46acdd41c332bf90eb", "structural_hash": "feb547531b338549a3d862efd26065e87af42a3fcffe6842ae9ebe78ae4aebd4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01643.py", "upstream_id": "BenchmarkTest01643", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport html\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n data = str(auth_header).replace('\\x00', '')\n processed = html.escape(data)\n return HttpResponse(mark_safe('
    ' + str(processed) + '
    '))", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78b4ed93cba2af0f4822acb3bb8b2a89a85932495775c136d71b5ebd4bb9d73a", "structural_hash": "f98007f02b1745c1e2d3b8a1649cd9a9321f97832c95ae5c119f16b4237c149d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_27858.go", "upstream_id": "BenchmarkTest27858", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"time\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(uploadName)\n\t}()\n\tdata := <-resultCh\n\tif time.Now().Year() >= 2020 {\n\t\tquery := fmt.Sprintf(\"SELECT * FROM users WHERE id = '%s'\", data)\n\t\trows, err := DB.Query(query)\n\t\tif err != nil {\n\t\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tdefer rows.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-566"], "category": "auth_bypass_sql_pk", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2fe7cbd3b25d66389cb1bd8110e063353f1724bebc6c2eece9deb7af582df78c", "structural_hash": "6ba6ae716d2cfbc6b7bdfe227a3f80214e37a7dae1a0cc9457db703ad75c4d53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05227.ts", "upstream_id": "BenchmarkTest05227", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as http from \"http\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.DOTENV_VAR || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a149207732e68d1dfee8c7b69b69a2ede2f2c5dbc0e7424d6bff3a76596ef2f", "structural_hash": "8a8daf24228913e5f709de5fb71edd84d4994c8691938b69e58abc8bb553382e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01447.ts", "upstream_id": "BenchmarkTest01447", "language": "typescript", "code": "import { Controller, Headers, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string, @Req() req: Request): Promise {\n const userInput = host || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea114e0b3369dd65c49dd3dbf63eef2b1dfd7e8513771b0be0cb051ebf7fcfc5", "structural_hash": "fd22804f3f346552a4606ebca585f140a479a5cb980487ac9878a153db948abd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03756.php", "upstream_id": "BenchmarkTest03756", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $data = sprintf('%s', $userInput);\n if (empty($request->getSession()->get('user', ''))) { throw new HttpException(401, 'unauthorized'); }\n $entries = scandir((string)$data);\n return new JsonResponse(['listing' => $entries], 200);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25cdf1f7f6b3f35e525b43136b869b365602ad05ac148980f1c2f2dbf5d9ab0f", "structural_hash": "da4e0fd66445fceab5b6c597cc09a6889c41d6293448d846a5479677a7c9c946", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02772.py", "upstream_id": "BenchmarkTest02772", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = '{}'.format(field_value)\n if request.session.get('user') is None:\n return JsonResponse({'error': 'unauthorized'}, status=401)\n request.session.cycle_key()\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69fba62e7937a0ddb29f806980ac6de1caadfab3213a1facfe5176d57984fc18", "structural_hash": "99c9ca8da0ef920ece611b8442968849c81e9f9b58e8ee88ca363baf19edeaf5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05862.php", "upstream_id": "BenchmarkTest05862", "language": "php", "code": "getContent();\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n mt_srand(ctype_digit((string)$data) ? (int)$data : 42);\n $token = mt_rand();\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eea0c47475ceed8110a49d59908805325d815d8e8f2f4d4d9164d3e25a5a2ec4", "structural_hash": "17972f20b25d5f06d0da11f07e4473136439247fd6782767aaf77178e60b71f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03776.rb", "upstream_id": "BenchmarkTest03776", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"sanitize\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n processed = Sanitize.fragment(data, Sanitize::Config::BASIC)\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57bdaddb1e39b8cdb22978b0ebbdf65018ac32c2429c66e0de9d672072374a9a", "structural_hash": "d033e8224d486282970581539606223306f66ee7b1dd5967e32b72c4b1d9c779", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02130.php", "upstream_id": "BenchmarkTest02130", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $data = trim((string)$userInput);\n $result = $conn->fetchAssociative('SELECT name FROM users WHERE id = ?', [$data]);\n if ($result === false) { return new JsonResponse([\"error\" => \"not found\"], 404); }\n $value = $result['name'];\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9661b0bb799d9c12b38ef23b4fe2fa7cc4f5ba9cc1c755f53f3e50a2b598b610", "structural_hash": "8f6da09639c8d93a1310601afe949749120b80c57de9698045a9e53fabaa565e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_34648.go", "upstream_id": "BenchmarkTest34648", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/md5\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar data string\n\tif jsonValue != \"\" {\n\t\tdata = jsonValue\n\t}\n\thash := md5.Sum([]byte(data))\n\thashStr := fmt.Sprintf(\"%x\", hash)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc8e6922eec9f863013d516a2c16352dee0e8bcfb8e4d1d86229bac58ee1364a", "structural_hash": "13c3a8cc1ced930653e54151b716a721d68bc38d85961cc7315e558f7403266d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01723.rs", "upstream_id": "BenchmarkTest01723", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = field_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n tokio::fs::write(\"/var/data/encrypted.bin\", crate::shared::encrypt(&data)).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5fa68c443f12428109ae1ba3598b33b00ddfece45dd174d9eb40e7830b69eb82", "structural_hash": "2f7d9ee618c2dab71e10fa9e8a9c6e7a088cea04ab15f142a80e25f40814e950", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19554.js", "upstream_id": "BenchmarkTest19554", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(userInput).hostname; } catch (e) { res.status(403).json({error:\"host not allowed\"}); return; }\n if (!allowedHosts.includes(parsedHost)) { res.status(403).json({error:\"host not allowed\"}); return; }\n const targetUrl = userInput;\n res.redirect(targetUrl);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1022"], "category": "window_opener_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b0598e8ffd069027189243ba314da8e9adcc3ad8313ebcc399cd4c84182febf", "structural_hash": "f70aff7f8857f9ef5dabfa5565bc37995136be9096f02ad78c40bd184b23704d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05356.rb", "upstream_id": "BenchmarkTest05356", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"base64\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = Base64.decode64(user_input)\n headers[\"X-Frame-Options\"] = \"DENY\"\n headers[\"Content-Security-Policy\"] = \"frame-ancestors 'none'\"\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8695c1cf5502a072c3d0c05e7cdba976beb1bb67bac5ff76fcb98198ec89858", "structural_hash": "ab25eef9f53f002306ca17cc06e7ab31ff9e3683502c40698520c7b35b5c80cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05925.sh", "upstream_id": "BenchmarkTest05925", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01447ad3777cca397805a45314d71ef7bec269d96e6520de6807291f538f3271", "structural_hash": "a2b35bffd1574897cb24a1bb620995480bc89548f15e0fd6356844e94590879b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05907.php", "upstream_id": "BenchmarkTest05907", "language": "php", "code": "getContent();\n $data = vsprintf('%1$s', [$userInput]);\n json_decode($data, true);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b533f23137b9093f9c9111cb7121e42cef151670623e7a848dec6065e2821d2c", "structural_hash": "1b8a70dbd045cf7d2016c6b651b151be26f9005e64e1c9aedf3ab78f02714e08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04809.php", "upstream_id": "BenchmarkTest04809", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75b91bfcd8b252b03ad09f950f2be2f014d2b84a4375818e28f3572e3a7ca69b", "structural_hash": "7bab1ae3f2bbafa86e29500d6eca5dbf103abd262527498fd8a1dbcead89d5d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01858.java", "upstream_id": "BenchmarkTest01858", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String prefix = commentValue.length() > 0 ? commentValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = commentValue.toLowerCase(); break;\n case \"f\": data = commentValue.toUpperCase(); break;\n default: data = commentValue.strip(); break;\n }\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6b0b182b434b891f68b97d5a90f9cb8ccb1f4f6fad12f94d9ee2d621a6c8e94", "structural_hash": "e1dd69c1ad38eb3460f787207860972de4ac05fe3601e8975bff4339a3319acc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12041.go", "upstream_id": "BenchmarkTest12041", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"net/http\"\n\t\"strings\"\n\t\"text/template\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata := strings.Join(strings.Fields(fieldValue), \" \")\n\tif data != \"true\" && data != \"false\" {\n\t\thttp.Error(w, \"invalid boolean\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tparsedBool := data\n\ttmpl, _ := template.New(\"unsafe\").Parse(parsedBool)\n\tvar buf bytes.Buffer\n\ttmpl.Execute(&buf, nil)\n\tw.Write(buf.Bytes())\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0beac3db0375027bc1291dd8c22739cf2901c1fc86a3f101af067070a89e183", "structural_hash": "e737176230319f36bbd356b20955e15f58c26a8a7eaa3dd81332832fdb858e47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07812.sh", "upstream_id": "BenchmarkTest07812", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n case \"$data\" in *DROP*|*DELETE*) echo \"invalid schema\" >&2; exit 1;; esac\n processed=\"$data\"\n curl -sk \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4aa0cf086fc87857cc2ec5175a98749ca2ef307fe788ef9087f8fe01fd714a2a", "structural_hash": "dc1e787fc7fbcf1483ae3efddd95caabafc814c10ac57c4314dc2da696937b5c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17315.js", "upstream_id": "BenchmarkTest17315", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n ctx.set(\"Content-Security-Policy\", \"script-src \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c913c7eb53e5d06bb26055ace4c53063907a1e99162bc6f7e0e7ed7ac7e092c3", "structural_hash": "c0255fa6dcbc0bd84b3d20253d8f46afc6c4e4c51ed3bfa5f4c76a4bc20f5ac9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25641.js", "upstream_id": "BenchmarkTest25641", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const transform = (v) => v;\n const data = transform(userInput);\n req.session.data = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-501"], "category": "trustbound", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77955ef62642eab912227e4a41543ac283235d3432fb3b8e6ffc96d73304254f", "structural_hash": "ceead73ad762b41ba84da5623b317346fded61e935ce3d93131de7c27faaa3e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19522.js", "upstream_id": "BenchmarkTest19522", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n fs.unlinkSync(checkedPath);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fe608b3133c74b92fcba0f66f7a14aec6e8c57894f62b08da8f0a2a81e658d3", "structural_hash": "609dd073a39e2a7a9fc2c4808bcfad81c8864f39ea07eb61422c31d61af71db6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02862.rb", "upstream_id": "BenchmarkTest02862", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"base64\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = Base64.decode64(user_input)\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "877e82a4dbb0fadf561b0e9fc825d8600ba26e9805e89643f0f0b45cc2702e1e", "structural_hash": "eb61af2328d496b629d79192d97598b3e78e27187dc6b159b9edc2dbae33fa09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04189.py", "upstream_id": "BenchmarkTest04189", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = handle(cookie_value)\n if not re.match(r'^.{1,256}$', str(data)):\n return jsonify({'error': 'schema invalid'}), 400\n secret = db.fetch_one('SELECT secret FROM vault WHERE owner = ?', (str(data),))\n return jsonify({'secret': str(secret)}), 200", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef008e849e1b5742febc920a236ef047d9e650a81198c90e18de4eea25ff493c", "structural_hash": "22daa6bc3b88e55ec0d720250c18fb635cf1654df3720f10c6c5aba5669058d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08564.sh", "upstream_id": "BenchmarkTest08564", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo $((RANDOM % 16))\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-331"], "category": "insufficient_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12cf51df9d2c497ac3fc402d2d27f4bb73b0e5d54899c480fbdf298c91263539", "structural_hash": "d58928a31daeb4f389528885fdb15c350480d5bdf0d1d3765a0124e5149b4de0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03255.ts", "upstream_id": "BenchmarkTest03255", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = userInput != null ? userInput : '';\n res.send(\"
    \" + data + \"
    \");\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "081a2049668f7f0c6b6669a3fcfbfe1a1aa99b69f9d72ae2f5c76eda7327271d", "structural_hash": "720692da43b0682bf1921b3f9d3834831e117fb4a5b7b704db3e0ae618f8c891", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04765.rb", "upstream_id": "BenchmarkTest04765", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = format('%s', user_input)\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "162be73dd103d803f842f98d426af20bef9fd19cd63b1ce9be6fbb59dc6f8e88", "structural_hash": "fc2d24cd7d0161fb69a902495afdc58b1ac54d606011d57aa820012aab53f767", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07795.js", "upstream_id": "BenchmarkTest07795", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = decodeURIComponent(userInput);\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24806e5d38c060572efba83f31a0a6dd09573600ce223f8a54f23bbc7a1791cb", "structural_hash": "62734ada3ec801c39b7cf885dbfd38b349bbb596d0e660b5f574902faf8f251f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04507.c", "upstream_id": "BenchmarkTest04507", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49070414f96cf8679205a39382b1dc9416a78899546b43cb80485172d185d476", "structural_hash": "ac5f1c156ebcd1d849f0c37c74cba1e404ddf5a32fecf8257399bba29958101c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03029.php", "upstream_id": "BenchmarkTest03029", "language": "php", "code": "json('variables.input', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n if (getenv('APP_ENV') !== 'test') {\n file_put_contents('/var/uploads/' . $data, 'data');\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db2482d1b3f8cd8f95732f7fc4d945beea794f2e612bc151613debe233e47988", "structural_hash": "046463fa952e44894cc12f31eaf8baddd2d06598ef6f9477682e365f9963cc99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04959.rs", "upstream_id": "BenchmarkTest04959", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = auth_header.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd89077c0a7d54a97a18aef7d2595406921073f74eee0761e3cb043f3bef9560", "structural_hash": "1877a45f3e68d1e4e643967f8aa249a9f743a8ca6e05272e560df2922af09067", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04856.ts", "upstream_id": "BenchmarkTest04856", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT bio FROM profiles WHERE user_id = ?\", [1])).rows[0].bio;\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77232d0ef600543ff7176de75e4f0cc9b3b65e542251a069ba89a1330beb3fba", "structural_hash": "42b1ecd29761537df09fe55702ac6c6dbb74a022f57c8134d5f83441c6e1e1c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02691.ts", "upstream_id": "BenchmarkTest02691", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const data = await Promise.resolve(userInput);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n db.query(\"SELECT * FROM users WHERE id = '\" + processed + \"'\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0b4ec62f94ba043f46b655479f56eb73f1321f431a5e9292cc39e51e380616f", "structural_hash": "13bb0b45ff26268ec13e0e4ce415079796320994e13ed22858cbb6d1b0997047", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18983.js", "upstream_id": "BenchmarkTest18983", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n res.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3735cff29c16835826094d67f0709db5ffa395bd84a52e62f05565130e30f6fa", "structural_hash": "43e0a2d172688dd8a48ae98f5d60baa32d58fc2a791dac648c44613d810df50c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01933.java", "upstream_id": "BenchmarkTest01933", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(refererValue);\n String data = normalizer.apply(refererValue);\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n return Response.status(400).entity(\"forbidden\").build();\n }\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15bfd05782c76d3b616182af40c0bc486cbae79852a45cc5793a7e7dd535f03b", "structural_hash": "440d8f1c2a226efcb45aa487de904b6c0dbd59446243652cb13baa6c2dcec15d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05479.php", "upstream_id": "BenchmarkTest05479", "language": "php", "code": "name;\n [$data] = [$userInput, 'http'];\n $_body = file_get_contents((string)$data);\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_body]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec9116e02a63d1ee98da8de2805923b32dc5838de66b5726e6a875b294898911", "structural_hash": "4be15f53c7b6f691be305f8d3d4f72752b73997af14e0888c1109651f09ff9a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01758.py", "upstream_id": "BenchmarkTest01758", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\ndef normalise_input(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = normalise_input(json_value)\n if not re.match(r'^.{1,256}$', str(data)):\n return jsonify({'error': 'schema invalid'}), 400\n if str(data) in ('read', 'write', 'delete', 'admin'):\n return jsonify({'access': 'granted', 'role': 'admin'}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63193426a992785468fdd4208c671053bc939e5e33dd8469ce451f7c3a124107", "structural_hash": "389b4e3e6661bc2e204cf07b0ce9b7f51bec09fcd0ab053887d3ff0abcc3c693", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16098.c", "upstream_id": "BenchmarkTest16098", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n if (_off >= 0 && _off < (int)sizeof(_dst)) _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edffb102958d1800a779d738b24a2d009a6224fbbe2dc31449bbea31a8664b19", "structural_hash": "596677b89a0fe06e58db562cdfa27b1ad89111ab9858614e44968a45939b0538", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01668.cpp", "upstream_id": "BenchmarkTest01668", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53132bd847a4f42eae0af822ae602f4043596eaadb0c78ba594679125241432b", "structural_hash": "2211d795d86faf70b24189b3c00644282e549dd8fcada9050b4d75c69c0f0c4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05370.php", "upstream_id": "BenchmarkTest05370", "language": "php", "code": "cookie('session_token', '');\n $data = ($userInput !== null) ? $userInput : '';\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { abort(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "038049d8d87d29ebbf464944ccb798292577b7a0eb7cdb9367d74afeae0cd883", "structural_hash": "8646277f233546ab356d994a7205edf325b3e84bea4615745c4a8dbd47c500fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04774.sh", "upstream_id": "BenchmarkTest04774", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _fname=$(basename -- \"$data\")\n case \"$_fname\" in *.jpg|*.png|*.gif|*.pdf) entry_file=\"$_fname\";; *) echo \"invalid file type\"; exit 1;; esac\n echo \"uploaded\" > \"/var/uploads/$entry_file\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef18c83478d78d1882b72b26d50fc1a0c40873f8af411010e02a871f4617c386", "structural_hash": "ebe85522adf77b6e42cce52c5ca4d94f552cbd3628eb17b44988a3b09d474c19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36768.go", "upstream_id": "BenchmarkTest36768", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := string(bytes.TrimSpace([]byte(rawBody)))\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"sh\", \"-c\", processed)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 0, "cwe": ["CWE-506"], "category": "embedded_malicious_code", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:embedded_malicious_code", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ee65bdbc1d08d71bd89d19c0ed433a2e6c4de9e174dbaa31b39b9e60c636ebe", "structural_hash": "030b8a398c3e94a52b98fc93df000568ecb8878d0beee15b1551e2ccb81a6995", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01297.cpp", "upstream_id": "BenchmarkTest01297", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Origin\");\n std::string data = !user_input.empty() ? user_input : std::string();\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16fe5f968b13064999edfdd7b7832e318cfd0dd1bd4d752881b6bdb16c3f9500", "structural_hash": "bd8b02178f31611b5f162a75aaf6df3475ebf9a3bb07e2b6bd96a4eead380fd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19317.c", "upstream_id": "BenchmarkTest19317", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36018f03773fa857d093ce59d6391df95acb48680dbc8d47fa3271a9ce75a826", "structural_hash": "85776b625bd35b97b69db5328f17b5fab4d9bcaccebf800d7d7fd224b9818ca6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02530.java", "upstream_id": "BenchmarkTest02530", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference atomicValue = new java.util.concurrent.atomic.AtomicReference<>();\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n atomicValue.set(multipartValue);\n String data = atomicValue.get();\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ac812c0d6866b2fb2851e6fe78e3d38c6154c88eb6e6b009f7c3b96d40b0a9d", "structural_hash": "6232a9a79b7347c25b06685c9b46321a8b210f10a1ca59a8ce2e5a8f77e06266", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00992.cpp", "upstream_id": "BenchmarkTest00992", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13761e6d46aec69081008f51dd7e5cf7e905f2674ce3a23a5d162fbdf4188c93", "structural_hash": "0e26b5c0d613ece9926a2a66be9da11d99f9f4067d58720c04c5b416166dd18e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01465.sh", "upstream_id": "BenchmarkTest01465", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "610b190cf4888bd09d4d6f9e40a867b824e54173e47553c8a7a2dee57d93086f", "structural_hash": "9eb3a745be77eaa6ac4f2354256c7793d6662fba601e68279a9c6473ed736299", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00741.js", "upstream_id": "BenchmarkTest00741", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const transform = (v) => v;\n const data = transform(userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(\"
    \" + processed + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c03542ef46a0ce66a5640814300a7fa91ae272316b4692de91cdc79c473f181f", "structural_hash": "336fc628c6c7bafec04f1c48d431398692cc38fd7087eaefdbac0a80a43e56db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09311.sh", "upstream_id": "BenchmarkTest09311", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-258"], "category": "empty_password_config", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2303b27628be7d0d50b105f2c0250bf35e9638a7cc71d0e3c0f4f4906a97653", "structural_hash": "72188653c43c1ac40d21e184b914863587be9349be7c40004408478c3467cce9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02380.ts", "upstream_id": "BenchmarkTest02380", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(userInput), salt, 100000, 64, \"sha512\").toString(\"hex\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d90c0943cefd970ba58f838011a670603df389dd270aaaa86e0ae9e6a4f10a9e", "structural_hash": "96c5469abf51c5e9721c3429691c7e58c9ada4f7d3cb9d14875d7de5935fcfc3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20643.c", "upstream_id": "BenchmarkTest20643", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", data); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a24ea9b77830cce23b13920f076848e9702a9ffa18a491bac501579d620c8c7", "structural_hash": "06753c14480475172fa63fb800414b06056f0a149a14e1fea4021420b54a131e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24499.go", "upstream_id": "BenchmarkTest24499", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tform := FormData{Payload: fieldValue}\n\tdata := form.Payload\n\tif strings.HasSuffix(data, \"/public\") || strings.HasSuffix(data, \"/static\") || strings.HasSuffix(data, \"/.\") {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-424"], "category": "improper_alt_path_protect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c0a3c5169ec069318d552c0620f75b200fa4bff43a6c5e86eb87f5d5ee5af54", "structural_hash": "9070f1d5f907a4e4eeb1f139e0afe06ff23b13763c9ff1204946668226ff4be2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04588.rb", "upstream_id": "BenchmarkTest04588", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n render json: { error: data }, status: 500\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a40d3b2c3a65626ff0ae18fef9deb6acc90cf7412996571810d9064550fb45b6", "structural_hash": "5b57ce8072aedccab454d99093615da9036e80fa1384650f702e6349cd547149", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16402.js", "upstream_id": "BenchmarkTest16402", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const data = userInput != null ? userInput : '';\n res.type(String(data));\n res.send('{\"status\":\"ok\"}'); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81adb4ab7823a9f9d2dd8fa3e25d7b23e386ac9b608aa2b4fd8fcdd913374944", "structural_hash": "8ca4e444e6963aaed8dd7ffa810614978e449befaa0de77425f4d0821e58d29f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02906.cpp", "upstream_id": "BenchmarkTest02906", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_HOST\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _path = std::string(\"/var/app/data/\") + data;\n if (FILE *_f = std::fopen(_path.c_str(), \"r\")) std::fclose(_f);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "248924041a7e29673644e3f448c2be778c4c7a2fb51993f1f74ba7bcb4f90fe4", "structural_hash": "5da6d8114fa5df2709d899be3467fd269810eab3d3f05598e2332bf839795f99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02617.go", "upstream_id": "BenchmarkTest02617", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\thexBytes, _ := hex.DecodeString(authHeader)\n\tdata := string(hexBytes)\n\tcmd := exec.Command(\"echo\", data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e468ccb1720c227cc94adfa0733861ee26781ef4acec387297e8987db067fc9", "structural_hash": "70368ae01e39e23802778c4e937a4372def5e199c560dc2dff0c84ef5a7331a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19844.sh", "upstream_id": "BenchmarkTest19844", "language": "bash", "code": "benchmark_case() {\n user_input=\"b5Vc8Kp2Mq9Lr4Wt7Jz\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-259"], "category": "password_in_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "489d74c04439e63b6c8e2ef46f35068a3b39c2d3dfbf8a0f09e57174282bb024", "structural_hash": "aaa7d1cbb7a7309d0f9673b436d6e5d994ffdbf8adb97eee161f676aca1b665f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00612.ts", "upstream_id": "BenchmarkTest00612", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = \"config_secret_test_abc123\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a148447d681bd3d08cf3a65f93d5ebe0148bbe4ab08e19f7b65f8afa1f761eb2", "structural_hash": "4358f11042b00d036e4dd0f17f8edf9a05160aa0bae48ab07a44078ca828779b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03640.cpp", "upstream_id": "BenchmarkTest03640", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) { res.set_content(\"bad request\", \"text/plain\"); return; }\n res.set_redirect(data, 302);\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef5147b2e9c78f7ceae66b0896951fe64d906a0e08d60f51c20b47487efe1b69", "structural_hash": "ed29ba6f9468013aa4d1fef75c6e825b8831a692b36fc17557d6a3d3d8d7253f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29405.sh", "upstream_id": "BenchmarkTest29405", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | tr 'A-Za-z' 'N-ZA-Mn-za-m'\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0feadf6bde70d168e8a677936bf6e434fab90647f147184bc1fdd750a143f9ee", "structural_hash": "8cae2cf028a908ccc18962ba34392cde8444aaf1b11920659935a849742fc1e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02666.rs", "upstream_id": "BenchmarkTest02666", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = host_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => host_value.to_lowercase(),\n \"f\" => host_value.to_uppercase(),\n _ => host_value.trim().to_string(),\n };\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8c51086ac8eee0084014e42e6fb9f5e6513eafa225340314bd4fb32d7c48c37", "structural_hash": "d35d91825ffcc20bbb557cfaa1e46301ae5e0085450b7fc095ed8f2056ef1a0d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_25265.go", "upstream_id": "BenchmarkTest25265", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tvar data string\n\tif fieldValue != \"\" {\n\t\tdata = fieldValue\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tc.String(500, fmt.Sprint(r))\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bcf8299c937e692417f1ac1481014ad014b84de118db193bd55dfe61ff96fe7a", "structural_hash": "72b74c48ae2cc607b56d39663525820918626cf38da537bfc2b57a052df188f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00950.py", "upstream_id": "BenchmarkTest00950", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nimport hashlib\nfrom app_runtime import db\ndef benchmark_case(request, path_param):\n path_value = path_param\n if path_value:\n data = path_value\n else:\n data = ''\n _resp = requests.get(str(data))\n if hashlib.sha256(_resp.content).hexdigest() != _resp.headers.get('X-Content-SHA256'):\n return JsonResponse({'error': 'integrity check failed'}, status=502)\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e77012b1cd77bafe368a64254414c59d926de0b419c003f31df76fa9bbb6adf", "structural_hash": "aac7c9c0140155e766cb30d675c18c88d11b3c506b7f2402776b13a80443d590", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18704.sh", "upstream_id": "BenchmarkTest18704", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n printf -v data \"%s\" \"${user_input}\"\n curl -sk \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-322"], "category": "key_exchange_no_entity_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aaf4a6317ea6d82340aabddae522b7e9219f7143cb8ae4f6ca5f6709c7d545bb", "structural_hash": "400e7f1a8a0ef598d72250e44c9f5be4d6949b99d0a47070bd36065f939bb9b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24358.js", "upstream_id": "BenchmarkTest24358", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = userInput != null ? userInput : '';\n global.sharedState = data;\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60fd432aaa95d2f6fd1fc40350c8ffcd3612d66c442a64f1ab65b152b00b87d2", "structural_hash": "cd1bcb4864e20dc609ce9496b4fd5d3430ccd0603b197c098be1d14eaf4f78f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02697.ts", "upstream_id": "BenchmarkTest02697", "language": "typescript", "code": "import { Controller, Header, Post, Req, BadRequestException } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n return \"
    \" + processed + \"
    \";\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02df0871c426022ada520d0ba0f685ad253eb61fc64a48bd9a9fd716774dd3fd", "structural_hash": "422570b2a9c0b9b879f15f533081228a5d45380563596df288b11711164e66c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_06044.py", "upstream_id": "BenchmarkTest06044", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom pydantic import BaseModel\nfrom starlette.responses import JSONResponse\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'X-Frame-Options': 'DENY', 'Content-Security-Policy': \"frame-ancestors 'none'\"})", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29b95836334cb4914f5b410d86a036c4f4b38900e8e16163f05a0e2825a40d9e", "structural_hash": "1464bfc93ce6c33bb1dfc1e0a39b97920a7dbc6ec40227ec2a3ffc47287b8268", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04476.ts", "upstream_id": "BenchmarkTest04476", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const data = userInput != null ? userInput : '';\n if (!shared.authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16c18b377ca6e3a3d9eaae2537affbcef67edf1085f44a3edf332a293ac6019b", "structural_hash": "0508793d616735d03672bbff8d7c289ae6fa8e1a09ff85abf659a8cd4d3b67ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14858.sh", "upstream_id": "BenchmarkTest14858", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n eval \"echo $user_input\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "590e07603916cd00403be791a4b290c0084f227ed91fe0da71e5a355c0d578ca", "structural_hash": "3f966b49c466b4038c13069280ab61049ae0b44dd440deb62146eb2b567f3d45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05524.sh", "upstream_id": "BenchmarkTest05524", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n normalized=$(echo \"$processed\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$processed\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "585740e80cc3bb4fe1634522b97e3ff47a9165a9c73b4f681bc5cf8e5151baa0", "structural_hash": "e1ff24d75db368930744f8af6323a064fc8a13463bd2750594dcd97bc92b92e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00362.cpp", "upstream_id": "BenchmarkTest00362", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c30c85c18927ca022885c954162c125e2426e500329e57ca84272adc598ed7d6", "structural_hash": "5c0b3361788a58b652d0c49665598eb24ab2cc4e5f7dbf85729359c9d54f8f6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03771.rs", "upstream_id": "BenchmarkTest03771", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse hex;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = String::from_utf8_lossy(&hex::decode(&auth_header).unwrap_or_default()).to_string();\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3b527eeb4f57d10c97f213f57cc34ddbe7588738c1d944dfca6fed4801bbaa3", "structural_hash": "6e05ca40b4132c64581d2b21c47923d3c18376d897a623017dda5deb16ee8b3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01800.java", "upstream_id": "BenchmarkTest01800", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.Map.Entry pair = java.util.Map.entry(fieldValue, \"http\");\n response.setHeader(\"X-Tuple-Context\", pair.getValue());\n String data = pair.getKey();\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n return Response.ok(\"{\\\"auth\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18c9103f5b5a0879efd02da356fa33cbeacae998470d32ba9930a8377db8552f", "structural_hash": "80a50712614ad2fd1d6ff83df3db9a75c2275d18087f3291c8459af6cbdac922", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02097.java", "upstream_id": "BenchmarkTest02097", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.List tokens = java.util.Arrays.asList(multipartValue.split(\",\"));\n String data = String.join(\",\", tokens);\n return Response.ok(data + \",data\\n\", \"text/csv\").build();\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8068c32f2d92c49a315a4d61b2293cf53d0c963c36bdba2641fa7880998af8c", "structural_hash": "decd7bd7e6eeff8b22f58e227bbbf62127e959d4bc30c929c324558937527beb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13083.c", "upstream_id": "BenchmarkTest13083", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b479680d04c12abc360ef4be248d08a2596a2646a3824cc39abe423b2c01dab7", "structural_hash": "0e38f7faca09cd7d181bae7917affd8f6f63a661d0b9bb1a294bc9277cbda955", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00448.rs", "upstream_id": "BenchmarkTest00448", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse url::Url;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let _prefix: String = raw_body.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => raw_body.to_lowercase(),\n \"f\" => raw_body.to_uppercase(),\n _ => raw_body.trim().to_string(),\n };\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return HttpResponse::Forbidden().finish(); }\n let target_url = data.clone();\n HttpResponse::Found().append_header((\"Location\", target_url.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a45d8ddb5d7f72a4c8c42ab2de62399bbe9fed690d7e6b17817d86f10c5f8711", "structural_hash": "7ca668bc42ec3286743697b8e221af4743ef890f70fb9e6916ea47b15e59c1e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01349.ts", "upstream_id": "BenchmarkTest01349", "language": "typescript", "code": "import { Controller, Param, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Req() req: Request): Promise {\n const userInput = pathId;\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6e2deef8745fc3982476750f525a4c761195a4552aa3249c378ed7584fc351b", "structural_hash": "9444380e9f881ff3b0a1dd169f1c29c1a963f92007b7c879f2b67ca62fd60585", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02842.ts", "upstream_id": "BenchmarkTest02842", "language": "typescript", "code": "import { Body, Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = field || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n res.json({ validated: String(processed) }); return;\n }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e056e9ca6b3c3c33d1ea0ef7b5465c0aeaddaa3caf7a4289bf03769d9bf2855", "structural_hash": "b78d1e73596b50e09121ead788535fbd606566c7bfb29c830c9dac6726cf4abc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01738.cpp", "upstream_id": "BenchmarkTest01738", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e682df0cc56f095ed154a77d4f88932fc47db9a2dfbe456266792b07e2b915f", "structural_hash": "0bf38d08fc2f822f723aa6e01f5522f6c5c82cffaa1e2af5feb28f181ef1a2a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02158.rb", "upstream_id": "BenchmarkTest02158", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40531795f11954f02d227fac5e5d3fa88d2b26fd22b8a485893029b9437b1c7b", "structural_hash": "713228ccbf53a499ca3f2ed9ce1f3ccaa9412721a77ac4ce374188e32df06333", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20307.c", "upstream_id": "BenchmarkTest20307", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n int _req = atoi(data);\n int _alloc = _req + 1;\n printf(\"alloc:%d\\n\", _alloc);\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fb74b47e909b610407fbd868af8940e73ca9ebe2a20c6eebac08609358980ff", "structural_hash": "66fd0620db42164312af2ef2085bf4a232eb3dfd4f246f6966dcd6c916602d9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_06092.py", "upstream_id": "BenchmarkTest06092", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\nimport html\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n data = f'{multipart_value!s}'\n processed = html.escape(data)\n return HttpResponse(mark_safe('
    ' + str(processed) + '
    '))", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a7fbc6f834c4c74ab59f887bcfee8dd85157bfdb351344e58e034cd69908335", "structural_hash": "910327e94370319a4c51eee7e46aa1e1cf0849b5eca1aa890d311eae5091825f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05952.php", "upstream_id": "BenchmarkTest05952", "language": "php", "code": "query->get('id', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $host = parse_url($data, PHP_URL_HOST) ?: '';\n if (!in_array($host, ['api.corp.lan', 'cdn.shopcdn.io'], true)) { return new JsonResponse(['error' => 'forbidden host'], 403); }\n $targetUrl = $data;\n $errno = 0; $errstr = '';\n fsockopen((string)$targetUrl, 80, $errno, $errstr, 30);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "613f849163d868d1c2b768c3109d8d0c040cc6277528391a41b3c562e748948d", "structural_hash": "17c4f6a98ac7c55160a45b71bac1570339a458750d6106d9a77643594ba269b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02452.rb", "upstream_id": "BenchmarkTest02452", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = \"\" + user_input\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b9162435e61ba018cc9d795ce467f6ff59bf0377acbbe271020b65d488f690e", "structural_hash": "4a02681ec481e643ee3ecaa5418a56e04b7bb038a2379720b63cb63a92b60046", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01477.cpp", "upstream_id": "BenchmarkTest01477", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << data << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72cbba597862f4c372128f291028528192e738b159a5e35715a439c30898c72a", "structural_hash": "ab8de7cbe2f7aaf22f39e4a677197c0f54b903bd6d95f0d8383451c9e951fe80", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05004.rb", "upstream_id": "BenchmarkTest05004", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n processed = data.length > 64 ? data[0, 64] : data\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96bf1e9cb5870d8dd4af080b1b428ff64a507c33492b8f35e546e31d7e7bc1f8", "structural_hash": "ccee3321d001c540e8b65ad2cf5b017ff230c78d514569be11b8081838dffa7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05109.py", "upstream_id": "BenchmarkTest05109", "language": "python", "code": "import logging\nimport re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n data, _sep, _rest = str(xml_value).partition('\\x00')\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n logging.info('User action: ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ea27751dc789b1102359f947563d2b0173f0becc898f84e92f94433f631fa3e", "structural_hash": "39678ace6b9689218b17887c50d438f44e1d0ac992ebe8b232b70ce4ea909e32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03498.php", "upstream_id": "BenchmarkTest03498", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $data = '' . $userInput;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $data . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb061381696a3e52432eb058f9dc7853fd52d28058794fef87eae9f8ec600e32", "structural_hash": "ef7d29d22ee45d34cb53ed5198bb1529d69e3daba9509ec187f10b0097d7d01e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02917.cpp", "upstream_id": "BenchmarkTest02917", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77f015092fc31e74b938bf825bf29fd5a3562a9c31123574b14731454e524c39", "structural_hash": "97406ce0e9498bb6eafd31b5c2fb80a06d15b288e7d25c6df823888509dcb7a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39695.go", "upstream_id": "BenchmarkTest39695", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tlastRequestValue.Store(forwardedIP)\n\tdata, _ := lastRequestValue.Load().(string)\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b1ed33bcdada084bc38df33122c58272d1f7a0c743f748543c578adfd3992cc", "structural_hash": "c40a583fc98a202634c356bfec13223ec48416daaf9d63226f475c198c2eae53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16151.sh", "upstream_id": "BenchmarkTest16151", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n data=\"${user_input//$'\\x00'/}\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "993035814b9e8066eda1f7431b14480e804cc20eb9fadaeb6f973bf6b653b8f9", "structural_hash": "6ab57c87b677ac89c3333ba069a13bfa1590a02342161ea6e9718e0f819a3680", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01129.cpp", "upstream_id": "BenchmarkTest01129", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dec133cf6efc3e8288c15d0c3baac03fe13adc59017e0b1b672cb487a144c2f8", "structural_hash": "a65debbc4eb76f28d09f7e5d6fb417afdd2fd9e80b7e1c166084fd930b8bcbe3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02942.go", "upstream_id": "BenchmarkTest02942", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar argValue string\n\tif len(os.Args) > 1 {\n\t\targValue = os.Args[1]\n\t}\n\tvar data string\n\tif argValue != \"\" {\n\t\tdata = argValue\n\t}\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+processed)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47dfaa9a79c5153d0cd0f2dac058904ae641577635312a881535bf373e0fd50c", "structural_hash": "10082bd834c4028b2aedd7c5b65c0f3d8046f781ac9ff5e2a44484ce22042888", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04150.php", "upstream_id": "BenchmarkTest04150", "language": "php", "code": "header('Host', '');\n $data = sprintf('%s', $userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ac3deb348f01a9b03a6df345f3eb8544e63f2900e512edc6289a9daedb7a43e", "structural_hash": "a856e5a91bedf982bac53b4fa7f0d787524f6aa1cd996131057cfd6b90e228df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01394.ts", "upstream_id": "BenchmarkTest01394", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce566dacf1c1b9373699b4ffc08e0a9aadcb2970ac6da1464f9cc67e3ef67557", "structural_hash": "9199901a59367cc1d9e3b6184e734a84abf689b21b35ba08acba63207e380e89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26117.sh", "upstream_id": "BenchmarkTest26117", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-323"], "category": "reusing_nonce_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b0bbe7c1a1eb7967d212a8c9b0cd18d3e8df82879e3bcf89d0bbbd29b0a9a3e", "structural_hash": "e4928338289538bd1dedf0d4dc5a428864b23cbf91fdf94939d397828489ff8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_38990.go", "upstream_id": "BenchmarkTest38990", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(dbValue)\n\t}()\n\tdata := <-resultCh\n\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(data)\n\tw.Header().Set(\"X-Lookup\", strconv.Itoa(arr[idx]))\n}", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3f2efe14ff57e1c1b9459e931dbba59333646caa5b3fc0c4f155f6dabba9950", "structural_hash": "a6b8d74084d487068299cf2acbbcadf3b4635c5bb8b097f65c50c031120fd2a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01791.php", "upstream_id": "BenchmarkTest01791", "language": "php", "code": "header('User-Agent', '');\n $data = sprintf('%s', $userInput);\n abort(500, $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce73d3e05b399e9dceb626e76719d92c5a2f0bfc89f71b856232745bb10e8285", "structural_hash": "242a0e65181a3a0355689a60e0d4f928ca2588014f0daeca405f9c7c121fa36f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24230.go", "upstream_id": "BenchmarkTest24230", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tvar data string\n\tif multipartValue != \"\" {\n\t\tdata = multipartValue\n\t}\n\tquery := fmt.Sprintf(\"SELECT * FROM users WHERE id = '%s'\", data)\n\trows, err := DB.Query(query)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-566"], "category": "auth_bypass_sql_pk", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "293166f9162d66f60ac03c2cac99131b6d6fb66d92afaff6980b5be8806d06e9", "structural_hash": "b618c3003494d42d83585d85e2154e762c2c273a020465d5b3ca7aea3c4faf99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02976.rs", "upstream_id": "BenchmarkTest02976", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let tokens: Vec<&str> = user_id.split(\",\").collect();\n let data = tokens.join(\",\");\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a5258a7cbc3ec831578c302fb9960695aca4f1334fc256fba0a5deaf358db82", "structural_hash": "9002941f53798ace47e1f6e7b850259f84e36819de72a2a96292a2c441d283af", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08866.c", "upstream_id": "BenchmarkTest08866", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "42937930f76053e5547e3a49a4422b3d5e219b65b87dabff4d010d99b8c966b2", "structural_hash": "1bab23f56f6c567ffdaae7589257d27c0f3e70e8e112c078ad749cd02257118d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05561.java", "upstream_id": "BenchmarkTest05561", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.util.List tokens = java.util.Arrays.asList(refererValue.split(\",\"));\n String data = String.join(\",\", tokens);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8f5f7e3bd2078179ff2297a2c44c5254add26a240f2ea4c3ea45567adbfeb14", "structural_hash": "507b3d6a08ff4c3f069a1adc87b8de56c9388041bbcc30283a75928c8a368e51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_21864.go", "upstream_id": "BenchmarkTest21864", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar data string\n\tif graphqlVar != \"\" {\n\t\tdata = graphqlVar\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tc.Data(200, \"text/plain\", body)\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89e3b5fd3e310b6c0537bb87cd26c8e4c45ffe7387d9e3dc15a60772234f292b", "structural_hash": "5fb0ba18ded157fa7bacb0d46960326652bf4e47d150c2475b6951bd93a7ed58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25956.js", "upstream_id": "BenchmarkTest25956", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const data = decodeURIComponent(userInput);\n JSON.parse(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbafe45cfdc62f7147428608387bc210b178de029ab4636a5ff2421ace2395c8", "structural_hash": "937ecb902367baabcfb291557ea9a7599c1fa504d07e3c3b0e9409d5a777bb95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05129.php", "upstream_id": "BenchmarkTest05129", "language": "php", "code": "text;\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad428b3f38b3dd322b4851ea079e376085832d28298c23ad58f98263f10a8059", "structural_hash": "97f30905533db909fe052da600abd089b391dc2e3b07efa345e19fb9a7dce67d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00076.py", "upstream_id": "BenchmarkTest00076", "language": "python", "code": "from django.http import JsonResponse\nimport os\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = '%s' % (field_value,)\n os.setuid(int(str(data)) if str(data).isdigit() else 65534)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e86b30297aa6ac0994eb4eff7479f6659ada6c3ddc8fe0214d9b9b04120d8c9", "structural_hash": "888c1d32666ea5190bd6102b5e79f8336f444eefd2d0ceee3678fb87814ff78d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00609.rb", "upstream_id": "BenchmarkTest00609", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n render json: { wrapped: wrapped }\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97d7695c0037f7e4d2d554c7b085ac8d8f42147995fa26b2b43b1804d7d0d6af", "structural_hash": "60e796511a95fff96decf0e03ecfca5fa23cdef6f7de0cbae3e846745a116adc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01734.rb", "upstream_id": "BenchmarkTest01734", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"redcarpet\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n data = user_input ? user_input : ''\n processed = Redcarpet::Markdown.new(Redcarpet::Render::SafeHTML).render(data)\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30d918e559e152952c2a2231956a359068fb580c10f21458ee5bb641f4a71587", "structural_hash": "2186cfb8d4a9ba08f65a49ddcbbb38b14ef2ef2f4786b1dd401493e0148a54b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18371.js", "upstream_id": "BenchmarkTest18371", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = passthrough(userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f0dee92519044a4e1e952db21a6d2a3137356badfd2ad7d859366d1c86db6ac", "structural_hash": "24bf9f6cf3079c7b9a0395fd5f87219a3498018820b9fd049eeba2c56a96a0b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03419.rs", "upstream_id": "BenchmarkTest03419", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match origin_value.chars().next() { Some(_) => origin_value.clone(), None => \"default\".to_string() };\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04ef987e69793809b8d07973780768ebd011513d093c1e8bd7deddcce08fcfa9", "structural_hash": "9c88ecd961dd723177b8779023e5850e6bdfa30fef57e002e42aebfb192b8044", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03144.ts", "upstream_id": "BenchmarkTest03144", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data = `${userInput}`;\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f8511f8868222c7ca3cb06f1c7fc7dc318451894720069514058a0036db8b6a", "structural_hash": "527146e6c2abe30013155dee64a4ab20ac8d457a50f01718823c58cb8393f05d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02671.ts", "upstream_id": "BenchmarkTest02671", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c047667b0857e6d65605add33e8cb47a4a26f627723f4bba063f1224c4863652", "structural_hash": "96392188b02c97adc8b653406299a623256755e747a240c759133057fa6fbae4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01716.rb", "upstream_id": "BenchmarkTest01716", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2eaf1f0cbf4c4b9bdee5ce0e20caa3167edd8d50ec5ba004fc66482d2c5ec38b", "structural_hash": "d4cb8cea763206dd48c064bd9c0af3e63f1aa1096f17d191f18a47c4814aba5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03325.go", "upstream_id": "BenchmarkTest03325", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tvar data string\n\tfor _, token := range strings.Split(uaValue, \",\") {\n\t\tdata = token\n\t}\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\thttp.Error(w, \"invalid option\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tw.Header().Set(\"Content-Type\", processed)\n\tw.Write([]byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2df68d5fc22baa14c866bf096c2b7625d07a1270498f53c211d7226328ea45b", "structural_hash": "60f1379921d59a29ccfa520b2ab24718598d51bfc9a184efeb1a4c276fa8719d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00886.php", "upstream_id": "BenchmarkTest00886", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c2de5a453e36f092e8f59bf78dab6e5cb5aadb93d9d6cde404a4de01effce52", "structural_hash": "e4629bac6aaeab357d153b0b5373e698575469143a150f0598b47193117e56c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03444.c", "upstream_id": "BenchmarkTest03444", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _dst[16];\n strcpy(_dst, data);\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cce2e73e355a92863ecd5a1ad97e5073701b8e97529c7cea31ad89c08f1747c4", "structural_hash": "7a14ecea3b7abb7ab7721c2676fc4aac3185c62713f37e988402e843c91347ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02659.php", "upstream_id": "BenchmarkTest02659", "language": "php", "code": "text;\n [$data] = [$userInput, 'http'];\n return redirect($data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bef7f3ca340c216ddb2e49ee74a5f624b8d17df41318ab1fcc06d53929bdd38a", "structural_hash": "9d3681f3d772b964319033ba852618457ec8568527e9d85455bd3836a62f2c3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11433.js", "upstream_id": "BenchmarkTest11433", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-441"], "category": "confused_deputy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02530a41dcc80b782737ea13c45f1c7855e3a946ef0c213e918791dad9841771", "structural_hash": "6adba5426aa8e9b4d6bf4397da92e4fd5414c4f43d1203971331b5ccad4fa446", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11895.c", "upstream_id": "BenchmarkTest11895", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", data); fclose(_cf); }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb4b4ac642bc2ead26dc11b66993fd6784659e914995b47ba372f6e132b2d38b", "structural_hash": "32b359187a3c005e5441b5ad7dc3c6bc52c2411a134da2fb5ad9d279ea512408", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04887.js", "upstream_id": "BenchmarkTest04887", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const data = String(userInput).slice(0, 200);\n try { JSON.parse(data); } catch(e) { }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc2c9495f12700436be679700f50c8e0fee56668e422e329f9cdae50c1e0334e", "structural_hash": "0f78c4aa688637183a459d123832d01b618eda7b6ae8b04edf75ca66109aca1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35019.go", "upstream_id": "BenchmarkTest35019", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", dbValue)\n\tdata := _sb.String()\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdd5c06c8cba44204cd6f32ae9ff05df84a0cd88e871b987165bb389068f627a", "structural_hash": "034715c4b363c06f42a9384a5b6daa3094a9dd23a43eabcaf1dea85495a5c4d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02127.ts", "upstream_id": "BenchmarkTest02127", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const data = \"\" + userInput;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a12c7813631313f346e551853e6bd78e50a753c63b8fb2c5675aae45042b444", "structural_hash": "b23cebaf29e76f8a47de4e5c9efea07cb25bb1f6b48bd1978c8230c71878f4d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02893.rb", "upstream_id": "BenchmarkTest02893", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = format('%s', user_input)\n content_type :html\n ERB.new(data.to_s).result\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c54951d64f8223b223c7fc75793f32dcb9ed0e09a4675e40472b08d2cb7f016d", "structural_hash": "f3042c91dc56aaee9af1f5672e2efaeed2ace02a632c9bc91a02fcee8ecd119f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04459.rb", "upstream_id": "BenchmarkTest04459", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = [\"s3cr3t_key_test_xyz\"][0]\n payload, _origin = user_input, 'http'\n data = payload\n _req = Net::HTTP::Get.new(URI(\"https://api.railscdn.org/v1/data\"))\n _req[\"Authorization\"] = \"Bearer \" + data.to_s\n _ = _req\n render json: { data: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a810094b8c6684c4e17e3a141a28fa2e97581317a3a54e957e5833be6358d802", "structural_hash": "3a8b13c388836c40c6ea511c3c446ee0521794e8afc25c8b9d62f0224e97aa2b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04890.py", "upstream_id": "BenchmarkTest04890", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nimport os\ndef benchmark_case(request):\n dotenv_value = os.environ.get('DOTENV_VAR', '')\n data, _sep, _rest = str(dotenv_value).partition('\\x00')\n requests.post('https://api.prod.internal/data', data=str(data), verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a32219b060d3af21381d423b596aaec57063db450c69d457c8029c839bc91f3", "structural_hash": "d0cd58f47bfa64f53ee6a809c5ac41f3fe324199f28c482f48732f4b3180be2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03049.py", "upstream_id": "BenchmarkTest03049", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport ctypes\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n data = '%s' % (header_value,)\n requested = int(str(data))\n wrapped = ctypes.c_int32(requested + 1).value\n return JSONResponse({'wrapped': wrapped}, status_code=200)", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3fe9650503c24e4d6a5762a4a07c49b5939b4afbb1fd7279434d4fde4b3b51a", "structural_hash": "30520edbde1582f05737570119e558b13fed6d6a74afbb18fac88079d6b465d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03502.rs", "upstream_id": "BenchmarkTest03502", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(field_value.clone(), |s| s.trim().to_string());\n let processed = [\"true\", \"false\", \"1\", \"0\"].contains(&data.to_lowercase().as_str()).to_string();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba8d7d61b4ab1d99c30b33db3ee1a528aef426f6f3610febcdb3a590c07b3e04", "structural_hash": "5c79aae36eadec5fa91232829077c4c55252ac4ce499ddad01a94952656f42da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01890.ts", "upstream_id": "BenchmarkTest01890", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n fs.unlinkSync(\"/var/app/data/\" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d788af87ed16a342c43923af3fab740eca38ba0e5b6892e70bdeaa764401f5c3", "structural_hash": "e7eee869cdb5bae71f1648295b4fe1e9a7faa8eb2161eb9df96fecf01396ae96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03998.rb", "upstream_id": "BenchmarkTest03998", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = \"\" + user_input\n response.set_header(\"Access-Control-Allow-Origin\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de8a274b9439ebab40429dbc5c170d9e2b990b287f595b886eb1141bb2092033", "structural_hash": "165e3a883eb4aa36b9e68bb57155526b7f2ccab6746f05f0b5cef6aa3e3dafb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03756.go", "upstream_id": "BenchmarkTest03756", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tpending := strings.Split(userID, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tDB.Exec(\"UPDATE users SET role = ? WHERE id = 1\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12bffda96dee1a983b45e67198766a867b623688603a6e814add5392eff23dc2", "structural_hash": "46a09fcd73f1c5d3ac2740b36d598b136f6843f1578bee72e9ee9fd5ff083c04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04927.py", "upstream_id": "BenchmarkTest04927", "language": "python", "code": "from django.template import Template, Context\nfrom django.http import HttpResponse\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = '%s' % str(field_value)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n return HttpResponse(Template(processed).render(Context()))", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8eaad83d9403106310d003aee601f73adc6e7587f0756c512b16a45072fcb6eb", "structural_hash": "9ba795b59d653370442fa7d0706f977105044f4f9749c45346cf99353f5532c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02652.php", "upstream_id": "BenchmarkTest02652", "language": "php", "code": " 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c5f287cd58e7bfabe9b11b72e0fc1bfc17f4fa6de9dff847a9e1e8a7b27deed", "structural_hash": "2ab71a3bda8cf1563e5c7ee16474a4795bba54e5708587069a82ee85fa991fd8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01065.ts", "upstream_id": "BenchmarkTest01065", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n res.json({ status: 'ok' }); return;\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e5093065702f61c2cd36099994bcf093b7d80e8617c088237e6ef5a9213222a", "structural_hash": "bd0a958961c76a50bc3b02a73485b08e42d70cda6410576dbe046f34fad16ce5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12776.sh", "upstream_id": "BenchmarkTest12776", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29c9489c2b7c86f67d4a6da55b7ada3b7ebd7707a7d380741ebda2418a7a0f8d", "structural_hash": "8d78a02dacb0040427f47bd7d148751d5aaa139397fec2c2cb0072f4be60cf70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05095.java", "upstream_id": "BenchmarkTest05095", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(cookieValue);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a35146d11b4d69b824603b7272cfd1b45d1c6f15fc3f21494f4eded5814eedb6", "structural_hash": "d26c9da2b28ff187bf574d70642b93b33af3da245b5e04b933a3e00b7cbca132", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27768.sh", "upstream_id": "BenchmarkTest27768", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n chmod 600 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c5717d1b4a130411fe9ba92e9164128f06446f92bef41fae4bbcad18d006efdc", "structural_hash": "eb64c193bb523939a9f059e4e89019ae7ae2eb4d4e0a8a66f3bd28bb55c02c98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_15920.go", "upstream_id": "BenchmarkTest15920", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\t_prefix := \"\"\n\tif len(headerValue) > 0 {\n\t\t_prefix = strings.ToLower(headerValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = headerValue\n\tcase \"f\":\n\t\tdata = headerValue\n\tdefault:\n\t\tdata = headerValue\n\t}\n\tvar label string\n\tswitch data {\n\tcase \"a\":\n\t\tlabel = \"alpha\"\n\tcase \"b\":\n\t\tlabel = \"beta\"\n\tdefault:\n\t\tlabel = \"unknown\"\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"label\": label})\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63efccb647e883dd26f6255caf50fa58fd9d2ffe87aa887a61de600cd14c16ac", "structural_hash": "4cd53314f3a3e2790717620850726d3f0fb8a262460e660307dd732fe31f3d64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_29529.js", "upstream_id": "BenchmarkTest29529", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n globalThis._stateLock = (globalThis._stateLock || Promise.resolve())\n .then(() => { globalThis.sharedState = data; });\n await globalThis._stateLock;\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06ef5984fb2fe1bfbe2bfee550f8c80549aa2978331cbd393ab5554944ec0e3b", "structural_hash": "e5ec730d25f1fc85d00ea61ee82b68694ff086e4a02b5aefe0136fd194f0816f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20863.js", "upstream_id": "BenchmarkTest20863", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8afb95d1d6c225ee18e6c6e0d8d031302a1543cd38c161f458bd128de0d48ac", "structural_hash": "981bfe0c05e842cb85809ba1ee00623227577813792e583cdac58da5e13160ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11264.c", "upstream_id": "BenchmarkTest11264", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 0, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c630ba5ad40ac1bb9d24f2583669218b6c52b374d985cf696dfb51cfb88660ce", "structural_hash": "720b15538a3bd0bd285b300878b340c2efb80552bc70b1e1ff9c53010a277f5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07324.c", "upstream_id": "BenchmarkTest07324", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n void *_h = dlopen(safe, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c6fc3e8737aeac4395fe73de153eb3cf407b257225e4712f195c01e54233eab", "structural_hash": "c5bae2c0c96f79e957399ba85fe65f58dc9a812cb2e74cb0fb3d577dd22c6c3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00480.rb", "upstream_id": "BenchmarkTest00480", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n data = Thread.new { user_input.to_s.strip }.value\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n eval(processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f925937a59d4cfc0307972b4d56f7a8b510695b7a0895e8f618b343568240aef", "structural_hash": "ec218d50144a9cbb7380f203b5c7540b41167a1a0a9eb958e4a5d0808eb9947a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00265.js", "upstream_id": "BenchmarkTest00265", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (!/^[\\w-]+$/.test(String(data))) throw new TypeError(\"invalid input: \" + data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52488287044a79ab0170d83b0da94e739f2933c8494aa41a48697b91beb5405e", "structural_hash": "84bc18d690e9e86589a0eefd555ab4b98666b7fde2f3c647dbb57acee5111816", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16899.sh", "upstream_id": "BenchmarkTest16899", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bf56bc45fe46ee80916ab942c2d29ab35bde90a40eddb86bfe2d8e8c4094c41", "structural_hash": "38d31b4decfbbad88c1c94d5dfcb6ddd1420c9fc1fcc5d8feb0dad1b20a7dc38", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03707.php", "upstream_id": "BenchmarkTest03707", "language": "php", "code": "headers->get('Host', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e90f05c01eebe461bfed316c32f8dbb9d3b0ef6e5395bddd8adbadabf5081df", "structural_hash": "8cda8ed225a43d11a9b3857e17fa6e04566b9fd0c5d8b24a6b7dd002b755da1a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05503.php", "upstream_id": "BenchmarkTest05503", "language": "php", "code": "header('X-Custom-Header', '');\n $data = \"{$userInput}\";\n posix_setuid(65534);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72836db3ea30567f676e2fab3bd7677884a540150664ce4a29d3480650a47aea", "structural_hash": "7afb2e315db519dbc80e7af306780de816edfdbd601d1ee78e6c3eef67ca1300", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00255.ts", "upstream_id": "BenchmarkTest00255", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n if (typeof process.setuid === \"function\") process.setuid(1000);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "980edcf27bf53d61abe8acf3a4e3a284e587da82fdac31428dfc745ef928c37b", "structural_hash": "d49cc0a07e783e34109dcd366830cbec4f58b4313ed50705deacc72a85ee1ac9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02833.js", "upstream_id": "BenchmarkTest02833", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90ceabf0ec052831857295c86f03591f8c7d2d04c1a37855a0460a14259ea095", "structural_hash": "6dad97639625000c033061c45eb8dc581e07717521b485173242b56500f1042d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15047.c", "upstream_id": "BenchmarkTest15047", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n int _req = atoi(data);\n int _result = _req - 1;\n printf(\"result:%d\\n\", _result);\n}", "label": 1, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e1e30c06af03d637d78d6c23f3685f297b4f3b7e4f6dd866c205d29410611ab", "structural_hash": "76ca42ce95358c85dc4412c8bb6218c0f12f30e65d237989a2a1156f2e6e4cbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11715.c", "upstream_id": "BenchmarkTest11715", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n int _d = atoi(data);\n if (_d == 0) return;\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98350f47cc0b2f2e586f6336d8b1e5cca351d719244716faa8ca3a9e88c777ff", "structural_hash": "0c2602c5e16bcf6d3441bcc672e12c26c952e00ae27014025d4d4d9faffacf8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04144.rb", "upstream_id": "BenchmarkTest04144", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n @user_input = user_input\n data = @user_input\n unless session[:user_id]\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "650be0bf2dc73b4cb214375fef74a0e56ec3cd10b9c40e252b708564d85526fa", "structural_hash": "58d4be4f6d2e8c11c56457c56558f8bac68336183d1b08f0a8865e63939556e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01036.php", "upstream_id": "BenchmarkTest01036", "language": "php", "code": "json('payload', '');\n $data = ($userInput !== null) ? $userInput : '';\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL_HASH')), (string)(hash('sha256', (string)$data)));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4828f0e5356f57d3d658db5c997d8d8169441f5706285030a7036bbfd1c5f36a", "structural_hash": "f797bf64d77215ea8485d3d7a43a715ade01fe4e1228b4f4ec3935fc1d252a16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01922.cpp", "upstream_id": "BenchmarkTest01922", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::string _fname = data;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54e2e4f30d157513735d1181e532cdd3c3d1051b545660a8f8b3d295c85f83ee", "structural_hash": "d25eed729c31ffd429b5d4ce614caa908cc53c192b7bcc0fc8996c378b963c4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10322.go", "upstream_id": "BenchmarkTest10322", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tdata := fieldValue\n\tif _, after, ok := strings.Cut(fieldValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\tc.String(400, \"invalid\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"status\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62569cee94d7b8489738ef6455cf63e6e1e6ba704e5d339d4181ef98ae2c9bce", "structural_hash": "baacfbac7ca2d2f7b19a4f1b8f79589aff7b3b6b50fec3e947abeeaaaf9e1a56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04876.ts", "upstream_id": "BenchmarkTest04876", "language": "typescript", "code": "import { Controller, Post, Req, Res } from \"@nestjs/common\";\nimport { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = \"\" + userInput;\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb4051a217fbce98ee424e291a3ef4085d4e680db8359303ff92865fa1d5ff6c", "structural_hash": "8cd3fbb0d046d035fade2db5c29f117892c1cdff6e30b847bb4326224e94e495", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05027.rs", "upstream_id": "BenchmarkTest05027", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data = crate::shared::passthrough(xml_value.clone());\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12f97380b1fab35d6bb55c3d2f312cbd193416894df3ca6cecc7129f2e7c7664", "structural_hash": "ab258f27985e76b811a7529f1b43ee7b4a95a2cc87b78020b14611cda354493c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01507.php", "upstream_id": "BenchmarkTest01507", "language": "php", "code": "getContent();\n $data = ($userInput !== null) ? $userInput : '';\n simplexml_load_string($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75d88d2b4d32ff5d972c767fb4bcd74f693d87bbee009283e0cab36f426e86cd", "structural_hash": "3d8477dad5a897fbb3cbefdfaaa9a0d447e1342dee93e12bdf8f25ad822450f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01193.c", "upstream_id": "BenchmarkTest01193", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"w\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c7bfe23d739710854c67d8a1f1211e14e695bbab5f5f184d52d2c4837b257ca", "structural_hash": "ad838a648b1f8c7c99dce5a3dbad6a765c21d1c7fc630a2c3802efc40537b31f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03756.ts", "upstream_id": "BenchmarkTest03756", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "560c392a1d2442572fefa075a74c9639886d2214eb7ee17381643b448a09dc5e", "structural_hash": "2a99aeee49559e63cff2a3e9f66ba9ee910d381bc301b821d78927c6521c95be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11389.c", "upstream_id": "BenchmarkTest11389", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _dst[16];\n if (strlen(data) < sizeof(_dst)) strcpy(_dst, data);\n else _dst[0] = '\\0';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "099aa6aab806b2790b44c9fa64724945e99b24e7a2b978f9c62e36ce65d2061b", "structural_hash": "1d4929edab0d6a3c5b8519492237bcb3fcb5a39349f64d1419d32d7aef505f7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03441.js", "upstream_id": "BenchmarkTest03441", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-336"], "category": "same_seed_prng", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77160d8404689f33bf37bb38b2b0f74c1300042a2adbbb60278d7a437a333411", "structural_hash": "35f3edecc2539bdb5edb28735395d4877b6cb231def429d8819fdd143dc1a9dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06147.ts", "upstream_id": "BenchmarkTest06147", "language": "typescript", "code": "import { Controller, Headers, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string, @Req() req: Request): Promise {\n const userInput = xff || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b73a822b178a5d9b21ba3a1a7d3eab6d55651c066804966c37f1dfdf7e06b4d0", "structural_hash": "aac588f5ed65dac143c7c133141a4bfd7f6fde7d0d61bb8478b3c5185928b60f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01985.rb", "upstream_id": "BenchmarkTest01985", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = !user_input.empty? ? user_input : ''\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n DB.execute(\"SELECT * FROM users WHERE id = '\" + processed + \"'\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8eb9b5e39c02c216b5871b574b103716b11dfccb05fcc67bd8426616b203730a", "structural_hash": "c9780babe0c95dc9ce6b376fc40969fab675f1ebf11381329a8be0f6258e6582", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18746.c", "upstream_id": "BenchmarkTest18746", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1564c313ad2337fdc64dcec0724102f6e628bf72c26b821a87c4c68676f1d2aa", "structural_hash": "522017caf9eed5f9ff9e0aef71163b2f546c8dcbb969ee9e8d05fb3e65ae3178", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11216.c", "upstream_id": "BenchmarkTest11216", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NONET);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4bee660cfd757d7cfd9bdf2a65839b1a749758685998ec2fe36fe51fb4b8d74f", "structural_hash": "6be8510ec238d47c8a881e43244d0bec60078fb8f6d93a1a39f7f2b1bee909d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01551.php", "upstream_id": "BenchmarkTest01551", "language": "php", "code": "getSession()->migrate(true);\n $request->getSession()->set('data', (string) $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6ac97e671cbf19518dc5627d5690056660da1a495175a63d9222a78b286570f", "structural_hash": "21992c16d45707ee571059c89c53640d2b061b926dc5687d227fb917acfe458d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09948.go", "upstream_id": "BenchmarkTest09948", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(pathValue)\n\tif !strings.HasSuffix(strings.ToLower(data), \".jpg\") && !strings.HasSuffix(strings.ToLower(data), \".png\") {\n\t\thttp.Error(w, \"invalid file type\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tentryFile := data\n\tos.WriteFile(\"/var/uploads/\"+entryFile, []byte(\"data\"), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3079f314118e7e32aa68d5fbe62de5e96836757efae90868ed31e331072dfca4", "structural_hash": "607b12918b75da26f73270a0440ca17ccfa94e296bbe0c3b4deb433c20b5fe44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13660.js", "upstream_id": "BenchmarkTest13660", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = userInput != null ? userInput : '';\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n ctx.body = \"
    \" + processed + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81496024d9388699bb85b44ddfc13d264773c7fa40417b81c2d3ac611415a24d", "structural_hash": "e4d66268926e546342bf8237b05e7b0c84485a07965c129373139bd11e535d37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04220.rb", "upstream_id": "BenchmarkTest04220", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n headers[\"X-Custom\"] = processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcf0a4059ba8057a10bdc0f317b7f958a1e5ca70a09a432ed7ec979d43a61f00", "structural_hash": "ca8a2b5a4045a331f3c8188bdc482c9d0da97cbd9b15da83ed01030f8704b83d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03567.rs", "upstream_id": "BenchmarkTest03567", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (raw_body.clone(), \"http\");\n let data = payload;\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8436ee497a4022d2ad70cbb277029db0c97e23c07d8704976c2793541631f65a", "structural_hash": "d0da200ceebd4892e98568b5b0e8354df1d728e9c1be26d3c01d47ce0acebe28", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00916.sh", "upstream_id": "BenchmarkTest00916", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n data=\"${user_input:-default}\"\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f7b532205dee0c358e107d9b6cc09c1b529740ab1280c8610c17c0822309fc5", "structural_hash": "c277fa3f63ac4da621425807eee04e1c8f7d0d490503aafe9326e2363e105b32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13036.js", "upstream_id": "BenchmarkTest13036", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n try { JSON.parse(data); } catch(e) { }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e67929cc29e2be68024a25fa7539b963e914946010de1e6f28c2c7fb464d5e8", "structural_hash": "ece26d981278370ae07823d6ba81bc82569cbe48baf5fb8468fd75e01c7d3b3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32881.sh", "upstream_id": "BenchmarkTest32881", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n printf \"Status: 500 Internal Server Error\\r\\n\\r\\nprocessing failed: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f2fe042ef5f208ea2e5432808717549fb058e967f8903cfebf722203bf45872", "structural_hash": "acc7afb30d7e7b0928889c8e3c9327bc20438f9c2d312a44a721a3048c26f891", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04518.rs", "upstream_id": "BenchmarkTest04518", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: json_value.clone() };\n let data = payload.value().to_string();\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return (StatusCode::NOT_FOUND, \"\").into_response() };\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7058b4effff5d1a199e8045812c04d3775c036595242234d5720bf25d7920119", "structural_hash": "8cc73df6afa90b88a6d2dd12145b93343cceae984419c5897ffd02280d6422e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_16722.go", "upstream_id": "BenchmarkTest16722", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tsegments := strings.Split(cookieValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\tc.String(http.StatusBadRequest, \"invalid option\")\n\t\treturn\n\t}\n\tprocessed := data\n\tlog.Printf(\"User action: %s\", processed)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc72326ab5978510db6131fc53883d76b6ad2ea57e2cd970ff619586d6684dd1", "structural_hash": "ca817f3cabdc91f7bc3231a157f7748d5a0e1f0f431ee0f0084294c1deab7b37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17188.go", "upstream_id": "BenchmarkTest17188", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tsegments := strings.Split(dbValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:16])\n\tstaticIV := make([]byte, aes.BlockSize)\n\tcbc := cipher.NewCBCEncrypter(cipherBlock, staticIV)\n\tptext := []byte(fmt.Sprintf(\"%-16.16s\", data))\n\tcipherOut := make([]byte, len(ptext))\n\tcbc.CryptBlocks(cipherOut, ptext)\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"aes-cbc\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a018e09da58491b41ba8f82cf8e3dda55feb561344f28d45e3b8788346611f83", "structural_hash": "ed25df3985390abdca7267e58ad341a30d7846b57d5d117ec97af70841351575", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_34845.go", "upstream_id": "BenchmarkTest34845", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tpending := strings.Split(multipartValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+processed), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e641f3e3b85381038e163759f43e5a551fe27ca0e685d374669f65938eadda0f", "structural_hash": "83b0498e77d713fde8d52d554607fdb72c82d5d4c376da6aa820631a6c5652f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20284.c", "upstream_id": "BenchmarkTest20284", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n free(_p);\n}", "label": 1, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6223dfacb30c5929bcbf06dae0e5badc5993b2fc917b9ff8da244f892e30470", "structural_hash": "9b6f88d77bf5156eab25337ad81189b5f968281931f89d4d974d5391645318b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02328.rb", "upstream_id": "BenchmarkTest02328", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = String(user_input).strip\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2ca6f146a8f14a8f945ef5feb43e811f287418b5370346a7e74c5af31e6a737", "structural_hash": "9c63076e085a3b869b688666a40ba19013a8c3deca305481ba179f95bdff5b45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01796.rs", "upstream_id": "BenchmarkTest01796", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(user_id.clone(), |s| s.trim().to_string());\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ccfe9da45411a863d26c8ee253efaf212bb6d2805dcbe314158b3438c6e5552", "structural_hash": "e0f63586cb23130ead5e8c7e027a1c604f7098966c49f6ea7e0728ce96e32df6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_10249.go", "upstream_id": "BenchmarkTest10249", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tvar data string\n\tif len(uaValue) > 0 {\n\t\tdata = uaValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tvar u struct {\n\t\tID int\n\t\tName string\n\t}\n\tif err := DB.QueryRow(\"SELECT id, name FROM users WHERE id = ?\", data).Scan(&u.ID, &u.Name); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc0214a66dfbb20601f54283d595d794db825443133fcc90ccc038f7c84b911f", "structural_hash": "df1fae01e0141f8c005b436c82b9a0e7087f42f32f4a12d27dd3ea99d42c81ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_33664.go", "upstream_id": "BenchmarkTest33664", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tvar _b strings.Builder\n\t_b.WriteString(forwardedIP)\n\tdata := _b.String()\n\tif data == \"admin\" || data == \"true\" || data == \"authenticated\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-302"], "category": "auth_bypass_immutable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3d73ffe928192588c2de6b197c543a3039b83d2eceaa30042fc30bb8b589670", "structural_hash": "4c24d1a1e8e90bbaf063d9653413920cbc3da1b2350d017e1d5d62482b560884", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01838.php", "upstream_id": "BenchmarkTest01838", "language": "php", "code": "text;\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n session()->regenerate();\n session(['data' => (string) $data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed641d6f22234b74c47be076ebf7334ee6399471073fd73c592e4404245cea76", "structural_hash": "e509de13628acf229270d08976c00436c25b87645a3ca4d535356888ece25012", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03358.ts", "upstream_id": "BenchmarkTest03358", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n db.collection(\"users\").findOne({ name: { $regex: data } });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7d451fd16942b8263f68056c7ca2a677d2dea4c7d2d960b7ce601fd3b607f24", "structural_hash": "c4ab6f80893514d3754180330a8ac8bbb26044f81060bec8ee0b268c069a7056", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00692.rb", "upstream_id": "BenchmarkTest00692", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n data = user_input ? user_input : ''\n eval(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75a74fef32f46e1b81bfd5885a71c41bcd70ca8d9d4e9c27f1d680cdaee129b2", "structural_hash": "dcc87c193421e529d8c288f29352ddc9adea8112fc82199dc2d1c508e630f202", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02131.ts", "upstream_id": "BenchmarkTest02131", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20b0d1b5e5be388232ca5497540521138a61ba0f73ad411e99e0971edfa70530", "structural_hash": "3b38bca27b58e57f1ac7d5c8d12b53c0325ce8fe766926950785caf5bd34fe35", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05839.rb", "upstream_id": "BenchmarkTest05839", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n render html: (\"
    \" + data + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "735cc2a17dfe878fc54ba27b9d4544e6833db995227c2d13627bfb29d4b28aa6", "structural_hash": "3016392b054f5bc39a14ca004d6bd9b7593bb364405bbdc69725e4a9eaeaf351", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02977.php", "upstream_id": "BenchmarkTest02977", "language": "php", "code": "getContent();\n $_ch = curl_init((string)$userInput);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { throw new HttpException(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n $conn->executeStatement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcedd9d6a32c796bcfdba5ca0647cdafd654cd4efbf422b136af8e86cbe342aa", "structural_hash": "b7010477b1714fd2079d6620de96173d94ce1c86321fd248e5377d6c3a847507", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05656.ts", "upstream_id": "BenchmarkTest05656", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data: string = shared.passthrough(userInput);\n eval('childProcess.execSync(\"echo \" + data);');\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d509d9ad007b2d3dc2abf7b4f57d7e4933a580154b44aa3e37f1f3feb6b2019b", "structural_hash": "c9290341821666bb2541e15e162c923ad4791f18533a63ccd62136d679b4158f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_06010.php", "upstream_id": "BenchmarkTest06010", "language": "php", "code": "header('User-Agent', '');\n $data = '' . $userInput;\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c29b60d4eb6828f898ab39d5949e4f0cf46049f2dfc12b310ca25c7321d07f6b", "structural_hash": "e619c5011c236aeb65cc50816d6e9b1a68aae71ec7f9aaaf8cfbd28cc21d17b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02428.php", "upstream_id": "BenchmarkTest02428", "language": "php", "code": "header('Origin', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$data]]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21764e63ab005428c60a0c8b19ce198d1e18ad178d08e8d741bef026590d0fac", "structural_hash": "db8d52024375d9599ae53a4dc7272ae75207d4a68bb882b87d7c42434c5e6ffd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08908.go", "upstream_id": "BenchmarkTest08908", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tvar data string\n\tif multipartValue != \"\" {\n\t\tdata = multipartValue\n\t}\n\tf, _ := os.CreateTemp(\"\", \"app-\")\n\tif f != nil {\n\t\tdefer os.Remove(f.Name())\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14a018e82f4deaa416a1544ee5b789079ceffd628e4935cf7c98763489af48b1", "structural_hash": "698beb01f3351a81dfae074b4c4bf11933fe615f045c297ecee89c84057568ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19187.js", "upstream_id": "BenchmarkTest19187", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n res.send(\"
    \" + data + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab95db6fa35a5c90cea99b7795ec3eaa3ab0946932267c0ca5791f20394e09f1", "structural_hash": "b844f2f6064a1b6b1907a5a11155cb524155ad85ec7428749f238e063c3426b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16612.c", "upstream_id": "BenchmarkTest16612", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0600);\n}", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "223f0f5c05680ea7f5ff50d39d51d34956f1b03da55521bbafd41ed55fb02da5", "structural_hash": "1f760c1a057286248d7cec9dc1056d37ff09611fdaa4dc2a540b0174ef78ff9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04276.sh", "upstream_id": "BenchmarkTest04276", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"${user_input//$'\\x00'/}\"\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf3248a81a66636453057ac055d51063f9b471a2cc302201b4ba4618e7052ff3", "structural_hash": "7c898983ce99e04769ec15275fe3f74e6a53a0edddc20d48271123de5f6ef104", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05382.rb", "upstream_id": "BenchmarkTest05382", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n JSON.parse(data)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58510d5a3f4a51918bc6575a844a17cce0dee4d8b1a035785a78e479e5a32406", "structural_hash": "ff2a37b37f11f75415aa7d426137261c5989b06b27da4d6f85b90de2b256a75c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04701.java", "upstream_id": "BenchmarkTest04701", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference sharedRef = new java.util.concurrent.atomic.AtomicReference<>();\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n sharedRef.set(xmlValue);\n String data = sharedRef.get();\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a029de9f003666e6ebcf78c259ae93e939adb852dfa660e7b11ff72b13a58bb", "structural_hash": "fb74ffdb2b0f41052f347d366fbba1ca988a4b94b8063ffbcb295a6ce6401a6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11789.c", "upstream_id": "BenchmarkTest11789", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n int _d = atoi(data);\n if (_d == 0) return;\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d290678b106ee07f3b3f43fb51caa4b544624f73f68a71c4fd886a9b29b27366", "structural_hash": "32a341b5c1355b0a4e17fb7e8beee1df763c8cd9e90529e5bae9619a416233b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23320.sh", "upstream_id": "BenchmarkTest23320", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _bypass_re='^[a-zA-Z0-9 _.,;:/=()|+@-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n echo \"$processed,data,row\" >> /var/data/output.csv\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e994ce5c61d795b8035cb4333525017ed4c0a15d7c22f4aa60505ee54c42c8e", "structural_hash": "4481afd90cbf28a63742ed3454f3949f4702d0e2a156d4086d31659eff9eac89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02174.sh", "upstream_id": "BenchmarkTest02174", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n if [[ ! \"$user_input\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$user_input\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\" >&2; exit 1; fi\n requested=$bounded_val\n if [ \"$requested\" -lt 0 ] || [ \"$requested\" -gt 2147483646 ]; then echo \"overflow\" >&2; exit 1; fi\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "114da3cc090c68e15e0eeac40a1f0f24763a081ed06a1efd55ef2d25fb5d0a7d", "structural_hash": "955aafb68094da429f2914391ac4a8ffd79c1f256fc341750a712be049582c07", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24458.js", "upstream_id": "BenchmarkTest24458", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n req.session.data = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a9be895e9333e0f4ba7fa403a5d25958ef84427b6e46d6ee69a3103a759426d", "structural_hash": "98571e22f78ef8d4dfd1521b3a5f19fb84493d9a20c9b0f967e56275f5f7562e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04188.c", "upstream_id": "BenchmarkTest04188", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f68da6309227ae368f0e58af9302d7ed297fa0094bcabce959bfd187cc547634", "structural_hash": "4eea2b8d2d5d67c7f6762177b48021169b4b99235dc97cdb15bbeb62bab21322", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16686.c", "upstream_id": "BenchmarkTest16686", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NOENT);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "293aa20fe8d1840b67ca65ce06639fcb49de3b6965aa65124da7c39692294427", "structural_hash": "c6f7f920a34e6cde7e32a5c2f967e3a55f19ff7f8d13111e5f9d1af29a703368", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04055.ts", "upstream_id": "BenchmarkTest04055", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = String(userInput).slice(0, 200);\n res.status(500).json({ error: \"Internal error\" }); return;\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c9b1f8a609d163710b7c458b8847b4d01d33d90c264641486ea6ff253683bcf", "structural_hash": "684a0469b234768ba62eaac0c201860b882531cb89beab28e6d66ee9ad4369b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03478.ts", "upstream_id": "BenchmarkTest03478", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nimport * as childProcess from \"child_process\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data: string = shared.passthrough(userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n childProcess.execSync(\"echo \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4e4fee6b9a41ed1e2b2e2525bdae346afb1ac8460d0812c7915315c83ade985", "structural_hash": "6a8c36d3780083df9d4abfac84505f64600914ffa64a47773523aa8a481de0c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01542.py", "upstream_id": "BenchmarkTest01542", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n upload_name = request.FILES['upload'].name\n request.session['user'] = str(upload_name)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b14051936952e174b42b762f83e31e5959ce0704ab58cbf42b87d04f4e696f7", "structural_hash": "00079751e57cd36f4801db784d006ab12e1cb297fee9b95ee7b22dc254e15590", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16585.sh", "upstream_id": "BenchmarkTest16585", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n case $data in config.json|index.html|readme.md) checked_path=\"/var/app/data/$data\";; *) echo \"forbidden\"; exit 1;; esac\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "198e2dbe1d81cb38bf9d3323218d03e906f0a73ad10addce5969dd563a68fe0a", "structural_hash": "09098eba0ff9e5855c7f4ccc8afde65754a3a6b770a6c361bf0952efa589ffb1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16129.c", "upstream_id": "BenchmarkTest16129", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8deb277a454f2b5b36aa25f7e3e0f37603c1acd476c34be719fbefe411b3e9c1", "structural_hash": "95fa034ac6097c1d753c0920460ccd4ac75f306878204f83dc7e24668046105b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05422.py", "upstream_id": "BenchmarkTest05422", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n parts = str(comment_value).split(',')\n data = ','.join(parts)\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return JsonResponse({'status': 'ok'}, status=200, headers={'Access-Control-Allow-Origin': origin})\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3283f25726570125d91c13a3538f6c68bb54ea19506828d09b7c6217fd10350e", "structural_hash": "bad09c9c77b031b851b2c125df6f995b0c45699e8c1f146edfa9b6ec03370383", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01242.rs", "upstream_id": "BenchmarkTest01242", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let queued = xml_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n ([(\"content-type\", \"text/html\")], format!(\"{}\", data)).into_response()\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a463f8957fb57c74e65534fb0dc6922a37c44e3d319ab35e19cf4dd4e54e3024", "structural_hash": "12b882910d5086861c8e355077cad2b913b171416a29c8bfcaa8baa035337fad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01438.rb", "upstream_id": "BenchmarkTest01438", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "559e74eaaec3fb2323ed082408cb35d614f9583f39cbd1161c8f15fe63196eb6", "structural_hash": "2143e99fcd5a545bf52d5f51da122a52aaf668a205727efe59f729e12e375bfe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00376.cpp", "upstream_id": "BenchmarkTest00376", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37c1a23b0234284363588404957a76fb2848c8ff3e8c1317196262fac5125db6", "structural_hash": "1ca026e5f74c37fdbfbc7952ab1fd0d8b927de922c286ed777bce1d17eb60890", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00883.c", "upstream_id": "BenchmarkTest00883", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "badef05947d47c2f6d1258cdf114366c0c8fabd492dcad369f5c639dc6d78ae9", "structural_hash": "17dbb5b096984ba98fa1ffbe46b355593b5a3bcaf031abc5270d5975c2f52714", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02622.ts", "upstream_id": "BenchmarkTest02622", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b61973fc5885916cb77e811f06caf80224287b5c4fcd69a41b0eae12f28c6df", "structural_hash": "631a769112121bf846505774539c77aed115d61d518e78a5d5601199509ea575", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00986.rs", "upstream_id": "BenchmarkTest00986", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = host_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => host_value.to_lowercase(),\n \"f\" => host_value.to_uppercase(),\n _ => host_value.trim().to_string(),\n };\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27b78854ace2d213b1dd1d2c7b0931d1e74a0589d48d7b1e43b308994b05f812", "structural_hash": "73b69e43894e3b0c89d6c0b8268c5206c20dddf4fa9ee86ef577a9f1be8fd193", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05800.rb", "upstream_id": "BenchmarkTest05800", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n data = !user_input.empty? ? user_input : ''\n Rails.logger.info(\"Action: \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca319e55990fb1569bb6b0c12f84460c7e648d002a073e102895ea4053a5325d", "structural_hash": "d946ae05ae1aef0ea26346ab810894a31b95a1e02229041a77e816dc5465caba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01340.js", "upstream_id": "BenchmarkTest01340", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = \"\" + userInput;\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35cce7442f08b99e21d77d2f328985b93263374c18714076cc672bd0bdf6739b", "structural_hash": "ad68756918b9907b3522b1767f49015623d7c57f4638d3e37b26dd2c104c07ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00235.ts", "upstream_id": "BenchmarkTest00235", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb82b0bb78b2b117f345ae5cd6f83a20e6209231d379e1f45d539bc19b1045e3", "structural_hash": "380acf4a63d32e31b9317171bf464599e5636898e73dd7374323c56f2a6e260e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37649.go", "upstream_id": "BenchmarkTest37649", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/s3\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tcapture := func() string { return jsonValue }\n\tdata := capture()\n\ts3Client.PutObject(context.Background(), &s3.PutObjectInput{\n\t\tBucket: aws.String(\"app-user-uploads\"),\n\t\tKey: aws.String(data),\n\t\tBody: strings.NewReader(\"data\"),\n\t})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5427dc90656217e82ad8bd82fcf82724ca209b36065e5601f0fb6c646ef5276a", "structural_hash": "d60373df7b5f2a1f4be5293f8b0c889352e1e313eb4c590f244bc3428d680f98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04035.js", "upstream_id": "BenchmarkTest04035", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = String(userInput).slice(0, 200);\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6112eaabcf63ca236ee0ce3e8c11c253c72703df18cd8a566232c2280fcc79fb", "structural_hash": "dc3de5a3f63eca3ed922bd57827eac39dc866aad2fcd7b9bb48d78c6f203300e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_37726.go", "upstream_id": "BenchmarkTest37726", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/csv\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", authHeader)\n\tdata := _sb.String()\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\tc.String(http.StatusBadRequest, \"invalid option\")\n\t\treturn\n\t}\n\tprocessed := data\n\tcsvFile, _ := os.Create(\"output.csv\")\n\tcsvWriter := csv.NewWriter(csvFile)\n\tcsvWriter.Write([]string{processed, \"data\"})\n\tcsvWriter.Flush()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34fae7969c3ab1f7550aa2de0d433cc7e0f2e774052978b6361915a4dc74dbbb", "structural_hash": "5861f1825a97c29ce84b3420f5134f55e5511c17ddebec9f755de60c3830b11e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05614.ts", "upstream_id": "BenchmarkTest05614", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as libxmljs from \"libxmljs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n libxmljs.parseXml(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57e4dc79393cde079f54924699d1f6865a1f45f25e470e4b8c814190bb130f5a", "structural_hash": "1abe94514aec1a96c89f70538ba37474ad5c164767047938b2b3baf50678e613", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16844.sh", "upstream_id": "BenchmarkTest16844", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n case \"$data\" in\n aes*) echo \"$data\" | openssl enc -aes-128-cbc -nosalt -pass pass:legacykey -out /dev/null;;\n *) echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a9b523664d87901a38f1ecf0af2c9d6baf554236c5efe861e76ce985bc51cf2", "structural_hash": "8d0ebcc7676620fb5efe1c9fce23349d6b4292af34bd737a520214e862eba72a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05009.php", "upstream_id": "BenchmarkTest05009", "language": "php", "code": "headers->get('User-Agent', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n $processed = preg_replace('/[A-Za-z0-9]{4,}/', '****', str_replace([\"\\r\", \"\\n\"], '', (string)$data));\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adf30354cb47d36474f3a339ea417f387a8c3fe6ba7b973e1ddeb198e3237868", "structural_hash": "a894e4e3738d2a83af8d078497e96538490df578ceaf7b01418d104ff02d75ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03902.ts", "upstream_id": "BenchmarkTest03902", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed: string = data;\n res.cookie(\"session\", processed);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab4f530d816a3307d8c935f89ea5e9fe2edd800b85d903d2a307bf267f696b6a", "structural_hash": "53d8631abec1ecc5c7ca4351714ff04389229ebecb40590361b95d44ea78e997", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31507.sh", "upstream_id": "BenchmarkTest31507", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n curl -s http://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1ca31d796ab94ec870ebed492cc1e353c5db50ea1f878f697dddbeecf23935f", "structural_hash": "92d1198031d77d11cfe6fcd59d97d6d8bbf5a0b64eb7e3e942104d98e1b067ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05519.rb", "upstream_id": "BenchmarkTest05519", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11da49dc2e0ddf8b3677ceed59ab55ffcd2ffbee376e00d3be2092c6b87959ac", "structural_hash": "4788d81d5c67de72d8d1bae8c7d502d9f884fe621da5fe7aa55be55f09e015f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32626.sh", "upstream_id": "BenchmarkTest32626", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n requested=$data\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81baa24b0e647d688ef89746f53ea6385c34f46203f78180ae8141a5c4d74a18", "structural_hash": "2c48f430ecba73441e5d6b3be0c709363666e1acee722250ec8e91bea06232fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02407.py", "upstream_id": "BenchmarkTest02407", "language": "python", "code": "from flask import Flask, request, jsonify\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(upload_name)\n data = collected\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return jsonify({'length': len(ciphertext)}), 200", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a79422382c0f96db10037545e083a8cf129ed0e17296cd8ff241f4748b5ff6e0", "structural_hash": "bec06c70fbfb9318a645dcefbf8c14048065402289a7f991189781c3b842716f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08392.go", "upstream_id": "BenchmarkTest08392", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(graphqlVar)\n\t}()\n\tdata := <-resultCh\n\tif os.Getenv(\"APP_ENV\") != \"test\" {\n\t\tresp, err := http.Get(data)\n\t\tif err != nil {\n\t\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tbody, _ := io.ReadAll(resp.Body)\n\t\texec.Command(\"sh\", \"-c\", string(body)).Run()\n\t}\n}", "label": 1, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b474288a07b6d8c84d388e09ef10394bf1750c2f66fa077c1df906a9ce5ccc0d", "structural_hash": "0db8a5ed6e59eeea75bcffaead5325f996e6994c11ac9adc078d494c97760deb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00738.js", "upstream_id": "BenchmarkTest00738", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const transform = (v) => v;\n const data = transform(userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "577f24714b2ac72896a5c622748eb66dcf4edde6d4ca266277abae82c3285c06", "structural_hash": "eb6ce29a2e5b3b0a93efac9eadaeb7593fc1f8b75fe8f21dc4acf0daf84929c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00986.py", "upstream_id": "BenchmarkTest00986", "language": "python", "code": "import hashlib\nfrom flask import Flask, request, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n pending = list(str(raw_body).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n auth_check('user', hashlib.sha256(str(data).encode()).hexdigest())\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d79a2343b401616588d4333a63c4ccc2f576ace22e22599c8097b95aa513711", "structural_hash": "28b89fcd253ec01d3b219104095d75e213001d93a6057466fb9202d3d0254977", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37408.go", "upstream_id": "BenchmarkTest37408", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\t_prefix := \"\"\n\tif len(headerValue) > 0 {\n\t\t_prefix = strings.ToLower(headerValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = headerValue\n\tcase \"f\":\n\t\tdata = headerValue\n\tdefault:\n\t\tdata = headerValue\n\t}\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tfixedNonce := make([]byte, gcm.NonceSize())\n\tcipherOut := gcm.Seal(fixedNonce, fixedNonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm-fixed-nonce\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-323"], "category": "reusing_nonce_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a52ee747235278501dac5a37a5d9287f5270fa6939d448bc8d17c50f518d3c05", "structural_hash": "c0a9bad69fb65b5bf4683e3ead0e02bd590d7f9409888dcc4a8cf69a1504732b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_31098.js", "upstream_id": "BenchmarkTest31098", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const { publicKey: rsaPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 2048 });\n crypto.publicEncrypt({ key: rsaPubKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING }, Buffer.from(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78baea03dd8ebdf780c76ac575f27045df8c239104fdd88c31afac60fd0401d3", "structural_hash": "1b33efe7e95fd81bef1a01417616e2a3b7f9c7daad0c345e9279d45bc49c865f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40613.js", "upstream_id": "BenchmarkTest40613", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const data = userInput != null ? userInput : '';\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ad94c6b9252b7ee75d3d5ed7b1683f483059a62ae51da57529fb30fdab8b7f7", "structural_hash": "39edd654daeff22210aac98140eb99c6ef6d15937664b9fefa5b2cc3add64e77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02723.php", "upstream_id": "BenchmarkTest02723", "language": "php", "code": "request->get('field', '');\n $data = urldecode($userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd43af742a5ebc548e5e7586f4a5a03b7f4f6e1ff0b5f4fdf10de12744b73abf", "structural_hash": "aa8b89fec4d1b7f6ca1878c1e433c1766ca9ad96237afe50e98143579a8f23ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04883.go", "upstream_id": "BenchmarkTest04883", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdata := dbValue\n\tif _, after, ok := strings.Cut(dbValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tc.Data(200, \"text/plain\", body)\n}", "label": 1, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5306ddbdc6a3854efa6d11f467f0236af98410592c433815f72eb579dd5f73d3", "structural_hash": "edc667e27e9682d4dab3e9cf6ad48f9fc9e9d356554abbb114761e2d81fca733", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04150.py", "upstream_id": "BenchmarkTest04150", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n kind = 'json' if str(header_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(header_value).strip()\n case _:\n data = str(header_value)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d594d681477ac65b58795be8578174c4020f71d5a953c752472a0943c671b86a", "structural_hash": "572520e36d201b5aed7f9eaebd4b10fb8a2434976d517fb688b98f0665068298", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04948.c", "upstream_id": "BenchmarkTest04948", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-322"], "category": "key_exchange_no_entity_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "453775f6aab843e6af5cf902f54a3b548e47b8be0c07bc590d538d109ced08b3", "structural_hash": "a5f2f457df70899aa70c0fa9da51432917da5350c128c70dde30b5ac9d9ebabd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02986.php", "upstream_id": "BenchmarkTest02986", "language": "php", "code": "name;\n [$data] = [$userInput, 'http'];\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$data . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d5734caf1ec66fcc5f71782a8ff9e24e1e687a3c255e2a521f8099c5cc35498", "structural_hash": "9f22df96e3652f255c44747afa667bd33b0cca87debb6e10b5a6d21c6bae2a32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00158.ts", "upstream_id": "BenchmarkTest00158", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.set(\"X-Custom\", processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb57ebd53c0f6c22641d850307c71fcb2867f7dc4e6516a91a327a305b3c9359", "structural_hash": "d9e6179ae0f74f0da2c8ea02f5e4962a50c09b14b474f7a418ad91425449bcb8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04921.py", "upstream_id": "BenchmarkTest04921", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n parts = str(multipart_value).split(',')\n data = ','.join(parts)\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return JSONResponse({'error': 'invalid integer'}, status_code=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JSONResponse({'allocated': allocated}, status_code=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0abf2eb6e522e65a2033d295f49230aaa595e7448fe7c281191c8d0037f0e59a", "structural_hash": "99e09004519022a24cade1b0eafc13796fe9d63b25e7b1717da1cbbbf435202a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00253.sh", "upstream_id": "BenchmarkTest00253", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n data=\"${user_input:-default}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdb5bf9ce4f5c17e77915e8e72b5e1df5f9a11f1310d03d07e16fb90f0629d97", "structural_hash": "90d7a34ff7a796c574f3edb242a58d963818a7c0fbcf428a9eadbcf2d982a186", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05410.ts", "upstream_id": "BenchmarkTest05410", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.origin as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n res.send(fileContent);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8da6b36137ee237f366f00c5752b84a1d84b110b65de0266e5239999149c8394", "structural_hash": "b6123a244ea44fab0c7fe19583568b6757379211cf009efe3a7e29ea1e6febd5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03221.rs", "upstream_id": "BenchmarkTest03221", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: cookie_value.clone() }.payload;\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "080c53e12f562fd9d9b8d1dbe888dfe6f56fe2d59c9f76ca61ce353339799757", "structural_hash": "35f2d35cc908d8f76eda3b9ff7cfa71d8f1be1be15c11f11469be289130c0b02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00683.ts", "upstream_id": "BenchmarkTest00683", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n console.log(\"Action: \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a55a97b2210e1c84f5c92653b3ba292ee9ded7a36b1f1ee9af70d41a3f4440b", "structural_hash": "6e5ce6e6cf27a1d9a94707e09e06066551c826d363af7c6c659a91816a42e273", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07272.go", "upstream_id": "BenchmarkTest07272", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tsegments := strings.Split(graphqlVar, \",\")\n\tdata := strings.Join(segments, \" \")\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\tc.String(http.StatusForbidden, \"access denied\")\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\tc.String(http.StatusForbidden, \"access denied\")\n\t\treturn\n\t}\n\tcontent, err := os.ReadFile(\"/opt/app/plugins/report_renderer.so\")\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ffebd49be58f8ea3bc22c65afe3b5c008325a4ab461db84bbf6cc5d73d821aee", "structural_hash": "dafd6e36c31768d50d9a3e47ae801dc7fb6a5219173b917099651604ab2f52a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22858.sh", "upstream_id": "BenchmarkTest22858", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"${user_input:-default}\"\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1eb83abefeabe8dbbb4384482ebd5c8db61bba9fff775b942459b8559b0a2ad", "structural_hash": "ba1edeaea55804d8837fbe289556c507c676034caa09e864c36541d77c263664", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27580.sh", "upstream_id": "BenchmarkTest27580", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81d565ec9acd11c28e9128bb718e0f538c3d563b142badd1b0c0c7e67bb5cc11", "structural_hash": "9dc13ae066ef018a718999b636a7ba8871c03d83b5ce891586e8ef3f5b6ebe26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03653.rs", "upstream_id": "BenchmarkTest03653", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = ua_value.split_whitespace().collect::>().join(\" \");\n let checked_path = format!(\"/var/app/data/{}\", std::path::Path::new(&data).file_name().and_then(|n| n.to_str()).unwrap_or(\"\"));\n tokio::fs::remove_file(&checked_path).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "905d5ba6fefd85c4b08249478dd8e9da3c32d4e705b15d120688a917632a6110", "structural_hash": "60ed76af80df4cad03919c20a0e5a45a17a1ef511212a99e2d6379790ae6931b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01773.php", "upstream_id": "BenchmarkTest01773", "language": "php", "code": "request->get('multipart_field', '');\n $data = \"{$userInput}\";\n $trusted = (string) $data;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4281a9232aaf71deb3613f3ac06900e0b3b17109be459d22a68ec23e96a37919", "structural_hash": "4b29d3dec45fdd7526983442b96be4e69a8b4c7fda58baed8e8a374d7de52072", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03995.rb", "upstream_id": "BenchmarkTest03995", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32f55dd83b31780e3243757652c79d5f1e06c576cd5b3706608fa046d22705c0", "structural_hash": "a38a2d378b665af89f0fb8c401c4f77a1d2af117b30d2d748fd14b2fecc77d16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05407.py", "upstream_id": "BenchmarkTest05407", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport re\nfrom types import SimpleNamespace\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n ns = SimpleNamespace(payload=comment_value)\n data = getattr(ns, 'payload')\n if not re.match(r'^.{1,256}$', str(data)):\n return JSONResponse({'error': 'schema invalid'}, status_code=400)\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63cc78f4d3e28b97420c89be18a5a49217ed516e97f987bd566f735d889720dc", "structural_hash": "c955f354f63ee06379d2be0fc4b3bc8bb95a11d60120ec124178ba0e73101566", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04884.py", "upstream_id": "BenchmarkTest04884", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n password = str(header_value)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if _login_attempts['user'] > 5:\n return jsonify({'error': 'account locked: too many attempts'}), 429\n if not auth_check('user', password):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebf1f676dfe55fa6b7e2bf7022271ce2fa3d668d021b905e8ca712a82e27b471", "structural_hash": "d2a94a48d8a423641b292cd0916ba968036291e567afa5c89a85a1aeb04bb745", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04399.rs", "upstream_id": "BenchmarkTest04399", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let mut data = String::new();\n data.push_str(&db_value);\n crate::shared::db_query_bind(\"SELECT * FROM users WHERE id = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e83454f800287fd904f6a3819dec18e5dc188c000b028fce0d03a6c15762753b", "structural_hash": "611a06c3b9e6b73cd77de237717d5a918bb5c31ceac8fea857dc59151e115816", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02111.rs", "upstream_id": "BenchmarkTest02111", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = field_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let result: Option = std::env::var(data.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d258d190bc1975348139361aa71cac5e57bc239408d12859dc856dfd9d3108d0", "structural_hash": "7c33f8ec553b431d21f7914e17358e11a3ea5fc9e9a921b79d5c7148d3623f9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03962.py", "upstream_id": "BenchmarkTest03962", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport ast\nfrom app_runtime import db\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n try:\n data = str(ast.literal_eval(header_value))\n except (ValueError, SyntaxError):\n data = header_value\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JSONResponse({'error': 'CSRF token mismatch'}, status_code=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "098b8b8cea41981a9e33fef8b109f5316c7ca305fd42bdf351bb9fa80b2261fc", "structural_hash": "d6546c60797ca6815afe0f023da84ed8e1ab41bc2ede8d2fdf418cc4d0db88d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00955.c", "upstream_id": "BenchmarkTest00955", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", data);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1e5f29be157003898b7146a88fc14b23f37879b311bb6570644f16e5fcecac4", "structural_hash": "cf201e13adfd8ee74bc7e331f92d00178be92b652161ddec780ab77813c2dc73", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04216.rs", "upstream_id": "BenchmarkTest04216", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"setting\", \"default_config_label\")]); m.get(\"setting\").copied().unwrap_or_default().to_string() };\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = secret_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let store_cred = crate::shared::vault_get(\"app_secret\");\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n reqwest::Client::new().get(\"https://api.edgecdn.io/v1/data\").header(\"Authorization\", format!(\"Bearer {}\", store_cred)).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5dd85e51e09b4a49607265e172acf45c7abaab010c5a9013cd3502cb46807bde", "structural_hash": "2df1f096fdb80876751854448bb8e719814d0e13e389a6ae16196a623b89d340", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04287.php", "upstream_id": "BenchmarkTest04287", "language": "php", "code": "cookie('session_token', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { abort(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17fecffd72ab9368b2caaab3ea3ad5f3b55410eddd5eaa82efad2323b5f7bc23", "structural_hash": "1ff4a9f0971ad6e863335c991f42367c7498ec8462cb9176742e97a4498daadd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04008.java", "upstream_id": "BenchmarkTest04008", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @POST\n @Path(\"/benchmark_case/graphql\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(GraphQLRequest req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(graphqlVar);\n String data = normalizer.apply(graphqlVar);\n response.setHeader(\"X-Frame-Options\", \"DENY\");\n response.setHeader(\"Content-Security-Policy\", \"frame-ancestors 'none'\");\n return Response.ok(String.valueOf(data), MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad0bfec35e272785c00eab5053998bd803762649e7c2a8a07e5ed0d1c87bd2a4", "structural_hash": "e92a204c9de1cc8f8e4e5efea57602e7186e4254d851eef856fa79bdf3f71b93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04212.py", "upstream_id": "BenchmarkTest04212", "language": "python", "code": "from django.http import JsonResponse\nimport random\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n ctx = RequestContext(origin_value, source='form')\n data = ctx.payload\n processed = data[:64]\n random.seed(int(processed) if str(processed).isdigit() else 42)\n token = str(random.random())\n return JsonResponse({'token': str(token)}, status=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5e1b0da9b2eea6a4059191bb85731894472270d1f65bbe3e576b0480927b8fc", "structural_hash": "5d284b52799b12911fba7ecb05985c74a4ee8135a3a84234908f9fc2c7d6d7fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05150.rs", "upstream_id": "BenchmarkTest05150", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = auth_header.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let _dispatch: std::pin::Pin + Send>> = Box::pin(async move {\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", data)).await;\n });\n _dispatch.await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f2c7392b0905be219eb43365ede7b0bb9b04e5da007a2b17c260df805af3220", "structural_hash": "0d03da287ea40aec954cfcc269a4ceae75b50a5fbac70deab14107926146b27c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05496.php", "upstream_id": "BenchmarkTest05496", "language": "php", "code": "input('field', '');\n [$data] = [$userInput, 'http'];\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5dce03141f1cd8360e68aef94442b0890b365b64ac7e44847fc46609ba095aa6", "structural_hash": "c803213fe9a319500630e3a87be0d31a366fdfc16fb422160d92aa2a7ea98420", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10750.sh", "upstream_id": "BenchmarkTest10750", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n data=\"${user_input//$'\\x00'/}\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9df01a10c8a8e5403e8386eee194f48bce9fdb8e6e1fa69969fc653b1c7b2e23", "structural_hash": "ba44041b4b4d5d6fcf07688256f728c48d946b802da386612d41bd1c217402d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03440.rb", "upstream_id": "BenchmarkTest03440", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + data + \"']\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a27443741c5c2b7241b4c323566557ec17c059c13758c05c5da38b9e9aa2b4b2", "structural_hash": "1bb5ae134a19c9af3af7e80761f1564cf77d0a1e90f1cdcfb37dc81f8744d5df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04882.rb", "upstream_id": "BenchmarkTest04882", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n halt 400, JSON.generate({ error: \"invalid type\" })\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "606079c1b02847235397883776012422ec56523c2998d77c4e783a2956f51aa2", "structural_hash": "02aee18b7bb805957dc0173a4989cf580ca8c6a9b9f73b5a5aef7c177b4ea347", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01327.java", "upstream_id": "BenchmarkTest01327", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + rawData;\n String data = valueSupplier.get();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object codeResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c383b26f018f7685629cfa7378017f3571dc38af76d3920c32157529457dbe75", "structural_hash": "3c18fdc13a34c25b81ae8b8c917d8f4cf44dc1a0105d7e7f9c2aeb090a74b44f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00241.rb", "upstream_id": "BenchmarkTest00241", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n data = \"%s\" % user_input\n eval(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de4f0c8b798036db3150c23393e78004fa75c16a8f2225abc039c53014aa8e6e", "structural_hash": "cfa551be0f9d8489cbfdc3b43fac7cea02da2384482e355de261e935278578c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07417.go", "upstream_id": "BenchmarkTest07417", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar data string\n\tif rawBody != \"\" {\n\t\tdata = rawBody\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tc.String(500, fmt.Sprint(r))\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4535e03932e61e02a214fa786ade08f719da307f6975510b870437d194c79fb", "structural_hash": "05acde2e5b8f79bb700e873b2d25824df2966e34901f0a3d95f8c5ab04065af2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04239.rb", "upstream_id": "BenchmarkTest04239", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2095837ba3c0caa5861005087b287827ca4d720297726d1729d4541acc7d6edb", "structural_hash": "11f0f94fb0daea4bfc0beec54c1fff2707fe3ab153b0ae27441d730d7644fba7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02336.ts", "upstream_id": "BenchmarkTest02336", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n const value = (row as any).name;\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d281882a425e6dcf37ea99e716faf46ba729e9fc166518e72c1bbf6a1522156d", "structural_hash": "cc9fa12574232209dfe38872400473eafcfdc5c34769c40103aac502291eaf41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03625.py", "upstream_id": "BenchmarkTest03625", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nfrom types import SimpleNamespace\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n ns = SimpleNamespace(payload=field_value)\n data = getattr(ns, 'payload')\n if not re.match(r'^.{1,256}$', str(data)):\n return jsonify({'error': 'schema invalid'}), 400\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "514c03ad22ac5499b3265976291172758025ed62fe137f254f7a540c7807cecd", "structural_hash": "f5a0c525a5e26354748a33b0386b1152099ce3bba9a345f0a66b106a585621d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04809.py", "upstream_id": "BenchmarkTest04809", "language": "python", "code": "from fastapi import FastAPI, Request\nimport json\nfrom app_runtime import auth_check\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = json.loads(raw_body).get('value', '')\n auth_check('user', data)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0bb3428b47ca792e55dd1b7c166fd15ff092b34d3c92eef4802089b76ce100a9", "structural_hash": "da7b06936422ae72164f8be75ee3e07e30eb28a92248e877485d17af4c55f532", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05170.rb", "upstream_id": "BenchmarkTest05170", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b2693340d3c6e3da2d3e53dede1c88e8433989f405453b62b035cfb8de96d90", "structural_hash": "7ab37b03b44c245e54331c10c62beb40db6de3180d304a5643d5086a495443a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00934.cpp", "upstream_id": "BenchmarkTest00934", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n char _dst[16];\n if (data.size() < sizeof(_dst)) std::strcpy(_dst, data.c_str());\n else _dst[0] = '\\0';\n std::cout << _dst << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56c097d2dfd9045b8b102b58c2003f68e3f9739b93ed52350e121b60f4915edd", "structural_hash": "4edc3d80fe47816cf53754d8b04f7cf20deafda23de027eb19dad82b4e7024a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03166.sh", "upstream_id": "BenchmarkTest03166", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\" >&2; exit 1; fi\n requested=$bounded_val\n if [ \"$requested\" -lt 0 ] || [ \"$requested\" -gt 2147483646 ]; then echo \"overflow\" >&2; exit 1; fi\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1cc3a080b76599bc2f56ada8b0249149104aa7a998873767f02a7060d51d9aa", "structural_hash": "9d2e7d10efbaca29ccc9e0c455bf84a2225acb339bcfa859899906d1813f79dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04324.php", "upstream_id": "BenchmarkTest04324", "language": "php", "code": " $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6416cc3294245582a12cf7f68c7ff53c8c6f12ca45b139c879fe0a9107a43033", "structural_hash": "9290c13000ae1e6f743654fb8198282f3ff2f627e57f5d2a6096c6714e48e5d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02790.php", "upstream_id": "BenchmarkTest02790", "language": "php", "code": "request->get('field', '');\n $data = ($userInput !== null) ? $userInput : '';\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f66ba9c8fe36b2209feda2914dc7b9f5a654a05b7c537535608f407f8d3b614", "structural_hash": "674bd1c55112155440066f5b62cae12989ccaccfdfc4dd746b0e8b7193a11d89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06881.c", "upstream_id": "BenchmarkTest06881", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0777);\n}", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a13143f00e730725125ab867e24e38fe28ecf7a59996dd00ca6180f87d123f9", "structural_hash": "1c1e3bb6baee0c77157ad03d881cd2e2ebf798167d2eab2b5c0726524b7752ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04311.php", "upstream_id": "BenchmarkTest04311", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $expectedSig = hash_hmac('sha256', (string) $processed, getenv('DATA_SIGNING_SECRET'));\n if (!hash_equals($expectedSig, (string) ($request->headers->get('X-Signature', '')))) { return new JsonResponse(['error' => 'integrity check failed'], 403); }\n $trusted = (string) $processed;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca256e45c0b3ebf95664c9620a95521fc1a3feaaa63dbc09c5ced1ba219ca402", "structural_hash": "cf876d32281e545748f4818f32b83532de470da05d969df6ad695427f90a0984", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00503.py", "upstream_id": "BenchmarkTest00503", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n data, _sep, _rest = str(origin_value).partition('\\x00')\n record = db.fetch_one('SELECT * FROM documents WHERE id = ?', (str(data),))\n return jsonify({'record': str(record)}), 200", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb6fccff1bf021c78baef3d82193cb85bd380333b5cc46dc5731413cdf1d9f2b", "structural_hash": "bae4ea95518b364d38e5caa4e3710bdca519d303d68c32f4c79b575ec7fe049f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06097.ts", "upstream_id": "BenchmarkTest06097", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const data: string = shared.passthrough(userInput);\n shared.authCheck(String(data), \"admin\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a278ec1f96f7b592973049a70db4070114372b83aeb93440db3fa4aace3099c", "structural_hash": "9f1d2751ba4d74c3c7ceee59869b9f16db31c79feaac9347654e30bc4d444c23", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05691.java", "upstream_id": "BenchmarkTest05691", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data;\n if (authHeader.length() > 256) { data = authHeader.substring(0, 256); }\n else { data = authHeader; }\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n return Response.ok(\"{\\\"auth\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2739fe5d917e7cdf993bfac80f17d44273f3d71bbaa89fe36dc84dd9d1e9997", "structural_hash": "511495ba15da4cb05aa32a88a12d16789d816437edea31854d902c1db7549dcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22790.sh", "upstream_id": "BenchmarkTest22790", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "548cf2067ec32dfec7e4df9232d76ffd3cc4e7699b244c32a42172d978fbbd78", "structural_hash": "e0225febdf39c260da6e2465357ed87163a5d3b0ba3c3f8374a4440f20474f3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05760.c", "upstream_id": "BenchmarkTest05760", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "841e5791f097d25bf550a8e5dc2a5d89d00d2c6866fa75404afaf7146878c3be", "structural_hash": "dfd8dc8dcc823de5a2de6eaff2be474e3d435906f7b9a997ccd94b48f84e09b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30142.sh", "upstream_id": "BenchmarkTest30142", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=$(printf \"%s\" \"$user_input\")\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5851970e5f9b8025cd4b9c2f2b6b3b9cd5ac25d4d36faf6a40e7ec4c0f29233c", "structural_hash": "c6b10868e1463209b8c99d1879a5d50e9834ad5d308950f3354964915dd722b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11471.sh", "upstream_id": "BenchmarkTest11471", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config)\"\n data=\"${user_input//$'\\x00'/}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-313"], "category": "cleartext_in_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "547fec28e7f45b90258fdd36564650853624e41cf4cb5c32345e8ff190aa9970", "structural_hash": "5a64d09ae6d7676dfd22de814d0c922bd8e0c790e997e55c408c7275047217bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_39205.js", "upstream_id": "BenchmarkTest39205", "language": "javascript", "code": "const ldapjs = require(\"ldapjs\");\nconst zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ef549098e80d5b16989779d2876862a7ab100c800d35ab633ef6eb2060a590a", "structural_hash": "e50a46caa6ff7b642c1563cbb39b11bfde2448aadebf3770d99f48d64c523aa7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04143.py", "upstream_id": "BenchmarkTest04143", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n kind = 'json' if str(cookie_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(cookie_value).strip()\n case _:\n data = str(cookie_value)\n return render_template_string(data)", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27da8a32c09e7af8fb53136e0ebafbd9ad40a00f59fe57bd077db16c4bf2ed6c", "structural_hash": "ac6d07dd63f9b84b2ffab079594785c00f23698a1fec71d75ccc1666dd195736", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00774.sh", "upstream_id": "BenchmarkTest00774", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n printf -v data \"%s\" \"${user_input}\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-359"], "category": "private_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e28e17681b1f2450291bd58a6f0cb0ba0d95e0ec000c37d0e9a7025554423b4", "structural_hash": "0a5c24c22ca6275d8593c943d4971916f1a4307356f4044cf45fc373fc2690a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_22457.js", "upstream_id": "BenchmarkTest22457", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = userInput != null ? userInput : '';\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ee1d9301f6fd34d4c278553daa14e84f248105ab4728840a5c99861f56d03c1", "structural_hash": "b04d0bbe3b80cd2f8ff7bf269c2200f7cf5227b2c53067c840277cca3888a931", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00340.rb", "upstream_id": "BenchmarkTest00340", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = sprintf(\"%s\", user_input)\n trusted_claim = data.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6481f2eae6c50c1f03e6720d35cf5ed0e1e5055563a1cb25b5fd30a29c6ed22", "structural_hash": "47f39e71a03877317cae8b53d154709727f04968e68341171fce71c56bd806fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30693.js", "upstream_id": "BenchmarkTest30693", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n libxmljs.parseXml(data, { noent: false, nonet: true });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-91"], "category": "xml_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e41a0b6acf7408e23ce424fb5a075cd3af093ac309ab7a4062c834e0b88525f8", "structural_hash": "bd5d3f1e9a9bb63eb9cf5001387ca3a7c51d0e2728958bd0fb7aa78a5c7aa200", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14921.c", "upstream_id": "BenchmarkTest14921", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\");\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "695c00c0cebc0a70f1b1f23aee761fdc3f99231fee8c55124b6a7f89840a99da", "structural_hash": "439b41feb1a937a56e1c020237f7a25d2c7cf4e9fca54952520435e7fc367060", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03888.java", "upstream_id": "BenchmarkTest03888", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = \"item_%s\".formatted(jsonValue);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d390009e737bec5eeb7149c63829b049ded0dbb8f5d369bf5a40d958befaa3fc", "structural_hash": "96e6862a63c6a152d3621408762e7c253f3f0dd372abd5db1f072ff56c25bb21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10247.go", "upstream_id": "BenchmarkTest10247", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tvar data string\n\tif len(authHeader) > 0 {\n\t\tdata = authHeader\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+data), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb967461eeaa7c42afd7b7d055aa898ee1c214552ad62be2791bf25e556c63a8", "structural_hash": "9feb9935dd6e3dbe03e53f85ea35b88dad210d36f3bd4def26e797db6ae70163", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00873.php", "upstream_id": "BenchmarkTest00873", "language": "php", "code": "input('field', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n DB::select('SELECT * FROM users WHERE id = \\'' . $data . '\\'');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09c56e1e9499f1a65a625ef91e2acbda4b33a1e636593df97ace9ddf109133d3", "structural_hash": "c9dfa9a953e8db8683ed9d574930543a3af64bb434463fca8f23e29acf5504f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04120.java", "upstream_id": "BenchmarkTest04120", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n FormData payload = new FormData(originValue);\n String data = payload.payload();\n try (com.mongodb.client.MongoClient mongoClient = com.mongodb.client.MongoClients.create(\"mongodb://localhost:27017\")) {\n com.mongodb.client.MongoCollection mongoUsers = mongoClient.getDatabase(\"benchmark\").getCollection(\"users\");\n org.bson.Document nosqlFilter = org.bson.Document.parse(\"{\\\"username\\\": \\\"\" + data + \"\\\"}\");\n org.bson.Document nosqlResult = mongoUsers.find(nosqlFilter).first();\n response.getWriter().print(nosqlResult != null ? nosqlResult.toJson() : \"{}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5dbeb7b87ce6be45e795c5173e886ab8d098eca00d715d8daefc536c013dc432", "structural_hash": "667b5368696ac791535c34fad103c8bcfb7a5d4cd7c0926c52b539607f95a825", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05192.rs", "upstream_id": "BenchmarkTest05192", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = crate::shared::passthrough(raw_body.clone());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32d7cc89c33093ff773480c6cd0d44bfb7d1ca67e6db172a494a453ec8edd8fb", "structural_hash": "d48c744dbe79d469c5781fb6153ae0790f2934877311b47be6c08fa6805b0320", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01276.rs", "upstream_id": "BenchmarkTest01276", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse hex;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = String::from_utf8_lossy(&hex::decode(&auth_header).unwrap_or_default()).to_string();\n tokio::fs::write(\"/var/data/hashed.txt\", crate::shared::hash_hex(&data)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "183947aacd3d21dfd688d18dd65409bbb61a6e6d14fefa6f9b0effb0f9476500", "structural_hash": "f5ded566618f74ff9345f25c6efb7e5b93945ba1ef2a9dbc21afbd97a77dce14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08760.go", "upstream_id": "BenchmarkTest08760", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- configValue\n\tclose(_jobs)\n\tdata := <-_out\n\tauthVerify(\"user\", data)\n\tc.JSON(http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b9bda67ebcf5c8ccd7cebac3a610885085f66a85162a5a38df364db53f62178", "structural_hash": "e8343ff9479aa960c8b2e2ea4b3bf4b7b00afca052cafa7335eb255ecbb9cef6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13246.js", "upstream_id": "BenchmarkTest13246", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const data = `${userInput}`;\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d20d0f2acd1a9344c8cdca26a6d37cf67090ef5316906e0509ac280da0c2a067", "structural_hash": "f9c2418e7c996fe38e5c23eedd6070e439eabff6a4b6ecac0dd10043e4b744e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_34253.js", "upstream_id": "BenchmarkTest34253", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "858e5fbc195008aef1f8dca3ce087df27074538cd4c4fa17a1c520aca24d3553", "structural_hash": "dd232b29b67cd4126d1923d399ffe4bb09d0f55b90692f2004d51c79ba63e936", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32090.go", "upstream_id": "BenchmarkTest32090", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdata := dbValue\n\tif _, after, ok := strings.Cut(dbValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tc.JSON(http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "383f029ebe7338355ab56e0b97f505090093e8f6b04737cdbb234d060289ba42", "structural_hash": "42218e8364fd24add38c0f43826ec206682b3b2e8384dc8ff966d288b7f95d6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02595.ts", "upstream_id": "BenchmarkTest02595", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d46f3cd1bf1aedf32a369c8b501da1a3d92a18023fe3833c6bec2ee26052de8", "structural_hash": "a2cd381a4361d48e8a1c5c6ca313c4e7014c9ab0cbe3a7a60d456d3be153169b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02637.php", "upstream_id": "BenchmarkTest02637", "language": "php", "code": "json('payload', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $content = file_get_contents('/var/app/data/' . (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04bb94604b85b7462e2626538a03c2742a41c24465d7e99e873272f7c4ba5997", "structural_hash": "cf11e6d3e6c90a97ae39affbbaac60cc62be0580ab618de0c542ecbd5702a0d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00052.java", "upstream_id": "BenchmarkTest00052", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n private static String normalize(String v) { return v.strip(); }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = normalize(jsonValue);\n String socketRaw = String.valueOf(data);\n String socketHost = socketRaw.contains(\"://\") ? java.net.URI.create(socketRaw).getHost() : socketRaw;\n new Socket(socketHost, 80).close();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41fe71f903c016f8c77bc86a363b800f629b4c448c07a06b3bb36e74f922827f", "structural_hash": "68e711608dcb368d00a9def2cd144fc9cd30c1a46bb59fa7e52d1e059c90cdc7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00465.ts", "upstream_id": "BenchmarkTest00465", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = Buffer.from(userInput, \"hex\").toString();\n const _salt = crypto.randomBytes(16);\n const _digest = crypto.pbkdf2Sync(String(data), _salt, 100000, 64, \"sha512\").toString(\"hex\");\n fs.writeFileSync(\"/var/data/secrets.txt\", _salt.toString(\"hex\") + \":\" + _digest);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46c78a17b81efd1190620b081441d76cb04eb8fe48089fbecab4f5a439049176", "structural_hash": "09dda9e86215ab4f9112d809135fe4c43a3ffd453a9adc0bfa96ce8cea779a52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21981.c", "upstream_id": "BenchmarkTest21981", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"w\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f9bdbeb8985b9c039f72f5894fc1064bff821dbc17bdca1b3b4eead214581d1", "structural_hash": "82070df777923344aa8451e405468bd9abda724fa073b14d22e23c2765da0b86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03124.rs", "upstream_id": "BenchmarkTest03124", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = auth_header.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let processed = [\"true\", \"false\", \"1\", \"0\"].contains(&data.to_lowercase().as_str()).to_string();\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6452f7432b35255c7204abfcb2d5ec0c051cea15e50eee7d1b460960abad4a5c", "structural_hash": "08e6777b0cf25c5f4410ff21496c4af9a0107a489476c7ab5fda643791c3c978", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05748.ts", "upstream_id": "BenchmarkTest05748", "language": "typescript", "code": "import { Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n eval(processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64c342d50aeea62e89207a0047575bb402392731957f3379cdb1515083398d6e", "structural_hash": "2ffcb82b99561cd7c3a9c3591ebbe51ac35851fc142154b7e0cab22a2175eff3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00704.php", "upstream_id": "BenchmarkTest00704", "language": "php", "code": "header('Authorization', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $processed . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "262953e4979581c68214ceb149f81fcf8978d909d05158438428cd1e93d6cbc0", "structural_hash": "0901292569c1dd121e12b83eedba71b8613903ba49f939abc2e09afec8664872", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05971.js", "upstream_id": "BenchmarkTest05971", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n res.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1022"], "category": "window_opener_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "387c130370646e4aaf81aaf4a99b347df002119ccda0d5d7a00e667ed27d8fea", "structural_hash": "371ba0000705faa1857a15e5a78d633c450d8bcc9cc26923845a759df09b7ed1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12819.js", "upstream_id": "BenchmarkTest12819", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = `${userInput}`;\n let _result = 'none';\n switch (data) { case \"a\": _result = 'alpha'; case \"b\": _result = 'beta'; break; default: _result = 'other'; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8eb4b27d2218dc12211db30f48e890448c4d93bfb99c146e14e53dce3161e927", "structural_hash": "e725d9e37286593c7d1876318f4d04d5395025dfa3f117c377ac0165b3b49825", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05008.ts", "upstream_id": "BenchmarkTest05008", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "729920090549b633acea46e5a32301abb87727f96daa3b231d6d997783b2ddaf", "structural_hash": "8ac9cb6208ef941e8ad68e9096c569e507ce0ecf11d1c552875977b539532d35", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02219.ts", "upstream_id": "BenchmarkTest02219", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aee6ccb890f08d480e6d26f7adabbe8572ab4e0233aea4c9ca0e1bade176b8d6", "structural_hash": "01fd7a53f9c9adafb364121c37f613f068bc43ee831d985a1978a67d403b2798", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03063.py", "upstream_id": "BenchmarkTest03063", "language": "python", "code": "from django.http import JsonResponse\nimport defusedxml.ElementTree\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n kind = 'json' if str(raw_body).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(raw_body).strip()\n case _:\n data = str(raw_body)\n defusedxml.ElementTree.fromstring(str(data))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5ab4b9896b9fc2e254c50883a6cc7232ba2cdd5505715feab071d5ff650f364", "structural_hash": "ebc141d29d0ccdac0862cb60cb673e3fa48426862214cc592fb930198b46f5f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02456.ts", "upstream_id": "BenchmarkTest02456", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3dd82e396ee49ff7ab5c8dcb34e023476f4f8e10e524198b75a6c12a49c9c4e", "structural_hash": "edbe43b8f878b46d618f54b6191938349686c823e9f6fc1c98b772c8a629e326", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02402.sh", "upstream_id": "BenchmarkTest02402", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n mongosh --eval \"db.users.find({name: '$processed'})\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85aa4c30f595370b8ebcb9aff03647f217a880b1ce49b4a61c3a46887972c81e", "structural_hash": "5e4939745a45689cba2d2f6e81e9fa2a0b897f47557dfc35c729dd84a338a1c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30548.js", "upstream_id": "BenchmarkTest30548", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n Buffer.alloc(parseInt(data, 10) || 0);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b6ef25632d1ec957fd43493b3cd40394226c6daa3fff4fa863efcafb934c65e", "structural_hash": "432e38be484202180d081de6607100dcd88ffda892dd71c99c49745626d7a562", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01432.cpp", "upstream_id": "BenchmarkTest01432", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.path_params.at(\"id\");\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c1e7ac101502a2a8e34ad3aa70d497f594fc8612d1179235cccb2dd82ea8002", "structural_hash": "fea7738228295b95373b74bf4c42b59cca1622540d1364b1d232efb87628bb8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01135.java", "upstream_id": "BenchmarkTest01135", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(headerValue)); }\n catch (NumberFormatException e) { data = headerValue; }\n if (!(\"true\".equals(data) || \"false\".equals(data))) { response.sendError(400); return; }\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d64f99ac6f79eb82b57ccb316a0e220235759abaa89e7b9815c8f942d0fad7c6", "structural_hash": "61d3c09100f841ee4ea913f5c2face0b7be31eb1f021fe39f8c434729e96537b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02580.ts", "upstream_id": "BenchmarkTest02580", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as http from \"http\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e77d1df7c0182c0bef9d7242c27bd03caadcd2cabb87535bc40487412423cd67", "structural_hash": "7740cabe7205eea139cdc8d93bcc64a862e80b7ee010ed63f8bd61d7b2e9e05a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01157.ts", "upstream_id": "BenchmarkTest01157", "language": "typescript", "code": "import { Controller, Post, Query } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69fdf349689a9c59f44d8412920a10e0fba5389331fe1ffed676043258531447", "structural_hash": "f26751baedfc364353ff1bd7aba3519d7c440a69a999c6310ae2d96116c42381", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13183.sh", "upstream_id": "BenchmarkTest13183", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91d820a6a8814beb87068a27a127d3557de802d2852df301f4029032b2fd614e", "structural_hash": "6c097f87539f5cd0857d1ef2ff182f9cb595764064622e16cbde02e1e05c81eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07452.c", "upstream_id": "BenchmarkTest07452", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0777);\n}", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c5b1600c909118f1258b57e163da42759383d58d401b2be0c3d12f1839bad337", "structural_hash": "2cce4418ac2a760145f797859156cfb18238c60001ccf7cded7d72ed74d8982f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16373.js", "upstream_id": "BenchmarkTest16373", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const allowedFiles = new Set([\"config.json\", \"index.html\", \"readme.md\"]);\n if (!allowedFiles.has(data)) { res.status(403).json({error:\"forbidden\"}); return; }\n const checkedPath = \"/var/app/data/\" + data;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c131aabf26dc58240336682567943f681cd95f40d890a1e58c3018f0873716d", "structural_hash": "dd42a74e6306477b9d4528818e41f6b6f7e49b9a93d52e80619bdfc259c65f1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03740.php", "upstream_id": "BenchmarkTest03740", "language": "php", "code": "header('Authorization', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a3a104a24497f18b61bb34685070b33dfab59e5ed1cf719f5e622f7dad88de3", "structural_hash": "63298d3423ca723fa186a2b743e19e6d89cfb1329e44bd11c4dd55a640f86504", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04331.c", "upstream_id": "BenchmarkTest04331", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data);\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c41043216102e056ce084ee059de044381216dda978f51325a08c81240d0334e", "structural_hash": "9715a14a77a972b02cd3bdfe8a406174b69844e65ddef0736c8b0ede452c637a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04822.java", "upstream_id": "BenchmarkTest04822", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport javax.net.ssl.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data = String.join(\" \", originValue.split(\"[ \\\\t]+\"));\n javax.net.ssl.HttpsURLConnection conn = (javax.net.ssl.HttpsURLConnection) java.net.URI.create(\"https://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL().openConnection();\n conn.connect();\n conn.getInputStream().close();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2012aaeb40ff15ce7899b433147e0616627ff63cee7ce8c566679eff6ff4c604", "structural_hash": "ba1c8c5c8d9ef66d9682d83183a5fc7330c463865efa078bc3dd62c012afd184", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04490.c", "upstream_id": "BenchmarkTest04490", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9947addf94abfe04cc06c4dab42953723cd3daa304905064f3d6c09df4486424", "structural_hash": "026a08e55171fabcbb9901c2175fe4491ce8aa0436aed381602e44d89a941806", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04226.py", "upstream_id": "BenchmarkTest04226", "language": "python", "code": "from flask import Flask, session\nfrom flask import jsonify\nfrom app_runtime import db\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = '%s' % str(db_value)\n if session.get('user') is None:\n return jsonify({'error': 'unauthorized'}), 401\n session.clear()\n session['user'] = str(data)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b3697ac74937b3edd74db75b1c6125c7866243329b49e45f3e7c65a82c358f2", "structural_hash": "1c834ea5ce0c08612ad650c7d26ef697e040bab9c0b41065fd58a750b2b450d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01898.rs", "upstream_id": "BenchmarkTest01898", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = \"config_secret_test_abc123\".to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(secret_value.clone());\n let _token = crate::shared::jwt_sign(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e494d4de11c78c221d54ef44d7765c4161b59d975c32606ea867ae638fa5c91", "structural_hash": "fda2f7aaa9892651782d36eee7e5e38accb5d308d45c540e8a017d00f43fa088", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00499.ts", "upstream_id": "BenchmarkTest00499", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n if (Date.now() > 1000000000000) {\n http.get(data);\n }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cd93d1993613455a35867bb0985a7bafd9f09b45e7d6c6ef0ed29711bd4a9bd", "structural_hash": "36a221508dc85533bf1bc79e4e10ba6dd6f18cd604d92a13ed860be173724ed7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01446.ts", "upstream_id": "BenchmarkTest01446", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const data = decodeURIComponent(userInput);\n if (!shared.authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebc5db9334c8037f0263cc7a55ec92685e9bd16184d6e0e81550e72882584d1a", "structural_hash": "bab74019268f42ca56ac7a94dcdeaba0ff244d3e37240346b7a6438845bebb90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04102.py", "upstream_id": "BenchmarkTest04102", "language": "python", "code": "import os\nfrom flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n env_value = os.environ.get('USER_INPUT', '')\n data = env_value if env_value else 'default'\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97b696fc1577012acf836200f5f94be8f41c9fa5af5cda1e20f63c161d0a2502", "structural_hash": "8d4ac5ead36d0eb295d77e5337a345bbe23bf0f2aaef6ecfe654e47d2f854676", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12067.c", "upstream_id": "BenchmarkTest12067", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", user_input);\n FILE *_f = fopen(_path, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad26416b52e24beb104961b056c73a9390dfa622c85142db03c276e1ca69b204", "structural_hash": "704e0204d5bd6e2a8bc7879b1b55a50aacd6ba3c3e10b0835435e8165463851c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01360.rb", "upstream_id": "BenchmarkTest01360", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = \"#{user_input}\"\n unless session[:auth_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:auth_token].to_s)\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b801e1d9ddd332bdfdf494ea143bf644ac82ee814693e9bf8ba08dcb16634756", "structural_hash": "a3e4aca4176a2fbe14a705cd7ffa60d0f89bdb62dfd81895ab6038134d033ce2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02210.ts", "upstream_id": "BenchmarkTest02210", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send(\"
    \" + processed + \"
    \");\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75278237020a8a87672de447cf035b12ad24888b08bed8c24e9ba5bdd024587b", "structural_hash": "49c7fbcb5fa1eda9cbe615b794a5d8ed79f65e23539d0f8973d32edbb9f27691", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05297.java", "upstream_id": "BenchmarkTest05297", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n FormData payload = new FormData(originValue);\n String data = payload.payload();\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n response.setHeader(\"X-Forwarded-For\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "530043a978946557f67e2c9bba5eaf2bc789cb5959f35a44c29ab8894cf37f5c", "structural_hash": "ef918cd61978ec5595d382a578ed7abc1eebe190f6af74926e85c0c790eee06e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00696.php", "upstream_id": "BenchmarkTest00696", "language": "php", "code": " 'p4ssw0rd_test_xyz']['secret'];\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt('data', 'aes-256-gcm', (string)$data, 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c40a29a5a427d8fbdccb590f66e38e591e59cb73608b1b7acce730667a8c0cc3", "structural_hash": "fa97db5ba7cb5002e2e1b4ac2061cd963020135814c85ef82a2019d7413a3bfe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03550.ts", "upstream_id": "BenchmarkTest03550", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const data = userInput != null ? userInput : '';\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n if (!row) { res.status(404).json({error: \"not found\"}); return; }\n const value = (row as any).name;\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23bfcedd051002762bcca92d33771f409065e5860e54a07bb0c94d0b21e7c945", "structural_hash": "aad218cfac8555aa930688cf988cd394d3a54fad6dab4b307e5467fec6631c4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16350.c", "upstream_id": "BenchmarkTest16350", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\");\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7114936ed4dc8ee625a57abf0a3d3821cb9c49d0b06fa60abdad4166c15f33fe", "structural_hash": "11e3d8dd3948fbdf9cb3d7a2903e28c860d7c1f899cd404da673dc9e985657e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05792.sh", "upstream_id": "BenchmarkTest05792", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=$(printf \"%s\" \"$user_input\")\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "655907ab74290a2b5f1d8e8e1ed5276b713152c73c62f9bf72b5ee8c864d095d", "structural_hash": "90f848517778f52aa5a8fcd48eb940438e90e73ef4381677c9e00b822420da57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03579.php", "upstream_id": "BenchmarkTest03579", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n $conn->executeStatement('UPDATE users SET name = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7416c4c73710e3f1f3b9181c83c9eb0ba5158d67b12a2f02121738fc0e24d2f4", "structural_hash": "94a52faf9bbbecbaccc3ba1444e181b165d38c04d9bb44bf659a66779976c426", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19086.go", "upstream_id": "BenchmarkTest19086", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"math/rand\"\n\t\"net/http\"\n\t\"regexp\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(xmlBody)\n\t}()\n\tdata := <-resultCh\n\tvalidPattern := regexp.MustCompile(`^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$`)\n\tif !validPattern.MatchString(data) {\n\t\thttp.Error(w, \"forbidden\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tval := rand.Intn(1000000)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": fmt.Sprintf(\"%d\", val)})\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2eedb6a08a93a1cc6ae0a21717dd5844b68ac6c6f2f0d75c1b6f05b0ee4c0832", "structural_hash": "8ef18e95e2eadba2627a3a805dc757c9e4a8164e7d1d90b7652841e7fb0a6f57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_40376.go", "upstream_id": "BenchmarkTest40376", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(authHeader)\n\tos.WriteFile(\"/var/app/data/\"+data, []byte(\"data\"), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "625a8df15f002a87ca67cc126e4d9ef500063a77e806b7666bad8f3bc2f13bd9", "structural_hash": "75cd8084c77c860ce4d1229502ccff32f6db582bff6dafa836e7e6a5195382e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00948.php", "upstream_id": "BenchmarkTest00948", "language": "php", "code": "name;\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $hashed = password_hash((string)$data, PASSWORD_BCRYPT);\n file_put_contents('/var/data/output', $hashed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2525fbee0bd62515531d1a9689c3415c40cf42c9d2f9bab9db7d070b8b77f959", "structural_hash": "820a63c5972f127ae16f6f8cc49d3ecf1b0c2e2866e9dce26cd28176080127b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14483.sh", "upstream_id": "BenchmarkTest14483", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a87ea59b26e868599c1dc054804dfaecfc762e1ac0f65673f0dcababcfad24ae", "structural_hash": "bb16d97bd4fefc162b68671170ce671c2bc95752807926879849ff111f6f18dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02656.rb", "upstream_id": "BenchmarkTest02656", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"default_setting_value\"\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba076f476d3a0614fbd87315e4f3af8b8e10f0d6a0a384cb4accdf95be961567", "structural_hash": "35a0991d4970d8d8db96406f5410c875c90dfdf056edd592a87a6679dfcb7c71", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24270.go", "upstream_id": "BenchmarkTest24270", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tdata := fmt.Sprintf(\"%s\", multipartValue)\n\tfor _, a := range []string{\"read\", \"write\", \"delete\", \"admin\"} {\n\t\tif a == data {\n\t\t\tRespondJSON(w, http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\t\treturn\n\t\t}\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "617e020e9f69afcdac071c80928c00f0eda86653fcf74f0c397694debb3638cd", "structural_hash": "fddc9e58c95983f58289b1e7f6b86f0242476f7b995b8c77cbfd7723131c9ff9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00979.cpp", "upstream_id": "BenchmarkTest00979", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Cookie\");\n std::string data = cpp_own(user_input);\n std::string _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5a27d471ea670d6184155363e5d3e2ac05e4c08457183afb33d1a986ef4bcad", "structural_hash": "e11c7d80996e5be1436d0c89a60dd7136f8249f475242bc5d1fae7241ec9e980", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05887.js", "upstream_id": "BenchmarkTest05887", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT bio FROM profiles WHERE user_id = ?\", [1])).rows[0].bio;\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-315"], "category": "cleartext_cookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72ad27093bb625c3452fee189ddb441217129e86cbeba92b38f00c84a6d166fa", "structural_hash": "cb7c1bfe6bd53937b0ae26bdce5f7fe97e3767bfccaaf3943bdde5623e1d5751", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_27873.go", "upstream_id": "BenchmarkTest27873", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/text/unicode/norm\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\t_prefix := \"\"\n\tif len(rawBody) > 0 {\n\t\t_prefix = strings.ToLower(rawBody[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = rawBody\n\tcase \"f\":\n\t\tdata = rawBody\n\tdefault:\n\t\tdata = rawBody\n\t}\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tnormalized := norm.NFKC.String(processed)\n\thtmlBody := \"

    \" + normalized + \"

    \"\n\tc.Header(\"Content-Type\", \"text/html\")\n\tc.Data(200, \"text/html\", []byte(htmlBody))\n}", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdeabb8cf671620f1d47f0f8a324b5fa548441c7df01e8a947b68ebf8a488214", "structural_hash": "942a76e381b67b684d42063fbaac3965013b650d9c7c94bce15216c58a9c0a07", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10845.c", "upstream_id": "BenchmarkTest10845", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n long _n = strtol(data, NULL, 10);\n char *_p = malloc((size_t)_n);\n if (_p) free(_p);\n}", "label": 1, "cwe": ["CWE-789"], "category": "uncontrolled_alloc_size", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e660da545301aa28315286c703f7d1685ddbee931c6a4440517dc537ab2cb888", "structural_hash": "2b2175fe6563dfcd26d2e91bbff85c40cfe6cfacaf01c31a92b8b5a6276baca1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19589.c", "upstream_id": "BenchmarkTest19589", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n int _vals[8];\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 1, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "638643dd9a85282c8c06c99a78df20115bb62a65e6519acf9cb2ffdf4c378687", "structural_hash": "9843e6901642f41257b7a97463e5c9e7ea138824ef5571c6072db20644dd9f69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00391.java", "upstream_id": "BenchmarkTest00391", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.function.Function preprocessor = s -> s.replaceAll(\"\\\\t+\", \" \");\n java.util.function.Function fullPipeline = preprocessor.andThen(String::strip);\n String data = fullPipeline.apply(multipartValue);\n new ProcessBuilder(\"echo\", data).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29f40f22c641dc3792ee9ea0c2b8deee415cf8d6a719327eff1f448e3200ff37", "structural_hash": "5fdbb58c444d32bcdb5663907e90972664ba86e338fc35820ebe0f016cebeb3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04212.java", "upstream_id": "BenchmarkTest04212", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference ref = new java.util.concurrent.atomic.AtomicReference<>();\n private enum AllowedValue { STATUS, INFO, LIST, SHOW }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n ref.set(refererValue);\n String data = ref.get();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n ProcessBuilder pb = new ProcessBuilder(new String[]{\"sh\", \"-c\", \"echo \" + data});\n pb.redirectErrorStream(true);\n pb.start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d3f9652ed28e8548a57fc86e917ee6b1058636622dbd4f53453102c899e96db", "structural_hash": "985ccae986dc7fc2b15f4f604c47053f198fc2cb21755a7afe94da758e8ec1b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04765.rs", "upstream_id": "BenchmarkTest04765", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n if ![\".jpg\", \".png\", \".gif\", \".pdf\"].iter().any(|ext| user_id.to_lowercase().ends_with(ext)) { return HttpResponse::BadRequest().finish(); }\n let entry_file = user_id.clone();\n tokio::fs::write(format!(\"/var/uploads/{}\", entry_file), b\"data\").await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19873d3bf1e787f285ec762edb73eed4accbab222f9131b87d4f2710309f12e6", "structural_hash": "690ebb4b1f7e25efcfee1fd57b4e82c8702f1bb42157a9f14167fc8b119645c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02823.rb", "upstream_id": "BenchmarkTest02823", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n File.write(\"/var/uploads/\" + data, \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2ffaba80abb9f96a6242999582508f63fba71c726fd5f26988c8e733f08ee7c", "structural_hash": "6b21b48312007fa5fb9135b464433f9daa96bcb7ed1d9781b26677021806482e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04788.java", "upstream_id": "BenchmarkTest04788", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case/{pathId}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@PathParam(\"pathId\") String pathId, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n String data = java.net.URLDecoder.decode(pathValue, java.nio.charset.StandardCharsets.UTF_8);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd6bbc39ee282c4a724f78df4ccf6c5ec19fbbf091956e3a4afe2b239d646da6", "structural_hash": "7546c1c393428e1f1262bb3e4796dcee09768cbf6389f83725df18382a2cc4a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13110.c", "upstream_id": "BenchmarkTest13110", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n int _req = atoi(data);\n int _alloc = _req + 1;\n printf(\"alloc:%d\\n\", _alloc);\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78745beebd9a8de5218a389a6d67aac13ec7f6c8e2471bd79062c7ee9e9237b8", "structural_hash": "01f2231a20bdfd2b240442c3b94f1c57aaf1681ad10a6da0a4325f8a59991b6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02154.ts", "upstream_id": "BenchmarkTest02154", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const data = String(userInput).slice(0, 200);\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cba35d799d3753ec4064cab293e85ea3cf3c677483bd9876d84211afac2d1b1b", "structural_hash": "f585b507009940f26ff9db20b3872078b1a0d1a86b6ab6ea4d05f5f92cba7f29", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03563.php", "upstream_id": "BenchmarkTest03563", "language": "php", "code": "name;\n $data = trim((string)$userInput);\n $valid = is_numeric($data);\n if (!$valid) { error_log('numeric validation failed'); }\n $processed = $data;\n $ciphertext = openssl_encrypt((string)$processed, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1da5a256f6fa78b37f2bb948099927e7ce4e33f4340985b1d457f0955625ca7a", "structural_hash": "f6d0baa0851e2a5014296365a961a5821b9ac99b7fcb62c96b42067914a51bd7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02446.c", "upstream_id": "BenchmarkTest02446", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", data); fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6d44c48db4b0fa5a8cb2cf652d40bfc30542dcf955ce894013a94d75bae415f", "structural_hash": "c0ec61329197dcbfbc1df97c8ea63717269408b6541ac4f0665ce6e47b3500c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03352.java", "upstream_id": "BenchmarkTest03352", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{userId});\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfc1e23de19888de3c197601d6d4a874e079f123986e7ddadb4a0baa6600728b", "structural_hash": "9788cd113b86a96abce997386a85be54bb0dab720e71a68e4ac4a077c2d7c382", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08341.sh", "upstream_id": "BenchmarkTest08341", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n cat \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "503763f8e84f3ddabbc1f550173ef46ba83b9677347b3689cfcec988d8fa8568", "structural_hash": "1949c6247540ad12723681e71540dc280bc80e7bcfa6fc9c1681d5043a47557b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01266.js", "upstream_id": "BenchmarkTest01266", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (![\".jpg\", \".png\", \".gif\", \".pdf\"].some((e) => String(data).toLowerCase().endsWith(e))) { ctx.status = 400; ctx.body = {error: \"invalid file type\"}; return; }\n const entryFile = path.basename(data);\n fs.writeFileSync(\"/var/uploads/\" + entryFile, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb712d83ea83a62774109662cb62aabb8efa8cc23689e4ff55f1bc2c8fdbe072", "structural_hash": "3ca5a942708516c01412760be63d62b0fe17c36a9e265806571a427e9005b158", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01823.c", "upstream_id": "BenchmarkTest01823", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char _dst[16];\n strcpy(_dst, data);\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d991894d19a167d8a46087ebce372ee0db176e213b1954df9117380d559221c", "structural_hash": "2060e60d963758f41a7205ff4ee98a5793fc419bf4ce673624b490c494dd15ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22171.c", "upstream_id": "BenchmarkTest22171", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_passthrough(user_input);\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "366b1681bc2b4c628e17063b75687a4f347fd29fa2283b0391b319985152acad", "structural_hash": "eb3683e976bac06d0d8b3e569eb1200ba5b583c2d2a558ea73265eb42b44789b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03661.cpp", "upstream_id": "BenchmarkTest03661", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n std::getline(std::cin, user_input);\n std::string data = !user_input.empty() ? user_input : std::string();\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7959d3aba5490803ef3f20b1f1cf575a642ef9479d1ebe55d410cd1d57e0b6c1", "structural_hash": "dbc55bdac4a9e71a9ba8a8ebcab0241ceea44f6df2a753cdcb9140599a74ccfe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24793.sh", "upstream_id": "BenchmarkTest24793", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n IFS=\",\" read -r -a values <<< \"$processed\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb7038195bbff3251a0a900f468189bf1110aa3c99240f7a4c01e2f4b78b63fa", "structural_hash": "7f4f69e7e479aa92c7e4b0a7317c96fd237f141bdc15bc7a1430699895eecc2d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13531.c", "upstream_id": "BenchmarkTest13531", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n free(_base);\n}", "label": 0, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4191f9bbec73f7e5e8760f5573eae3362c6ff19497e8e6dc62f5fcf7de03db85", "structural_hash": "6fb0584fdfa9a04e936a97ee731cf34335f75fdc42ad969f4b4d0006374b5bb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04655.rs", "upstream_id": "BenchmarkTest04655", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = field_value.replace(\"\\t\", \" \");\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a8714878e3463cfc6ba097d159c321ed825c2b173c0670ee85b02dc6ca81b05", "structural_hash": "8fcad7c5a3941c37fe7c2779088a08aeb39356f53c1008f5da8a945ccb62aaf1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01137.py", "upstream_id": "BenchmarkTest01137", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n data = RequestPayload(ua_value).value\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b98038bbf5317468cbd0aa869c5161ba55166a1b7c767887a289f0af1eaec4e", "structural_hash": "1ec6616636a532c27e217cf33d852c682a92a4c0a462af869b68da660c823766", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02223.cpp", "upstream_id": "BenchmarkTest02223", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91973a439db4fa9de0582947b92e7959d2bfa74b468411173327974f239dc894", "structural_hash": "1e1541740ad4dd4f28c5144deeb05f87027c70a1f439ecb6de9212790d08c19f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01266.ts", "upstream_id": "BenchmarkTest01266", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = ua || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a22e4647015b19073aca8bcbcd5f4bdc90eb1c809b8853221e4702e1304a9533", "structural_hash": "ad4b64d1fbbb8fa9c8ebeb95dd60913817ab675b8f750087539b1eb042c8203f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02703.java", "upstream_id": "BenchmarkTest02703", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(multipartValue)); }\n catch (NumberFormatException e) { data = multipartValue; }\n response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73e1c5b5310e1cda3dc0843d1327b9e0dcd79700b5ad593d80a2a25f096d99fb", "structural_hash": "d7aea22b54150a0c70cc6c8c32b2ab543a2316567c12995e9283243bbd023311", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03058.py", "upstream_id": "BenchmarkTest03058", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom lxml import etree\nimport re\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n data = str(multipart_value).replace('\\x00', '')\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8094801d8b2d6c8a42058de474e7cdea0ca212820ee6eec221c80f0ad662a030", "structural_hash": "a05441136a0ddae3e254c546d369ed889b6ddb59bca2071899f422733a58a68a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01218.rs", "upstream_id": "BenchmarkTest01218", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = field_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n reqwest::Client::new().post(\"http://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71c77472f48e8dda49e01f5e30eca255537842a8c13527ccfd5cc2eee8c9b34a", "structural_hash": "428bff984a9d12bc6b32f15f8f20307c391d8aa2fec8bbec4acf83c34e2d553a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01795.rs", "upstream_id": "BenchmarkTest01795", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let data: String = multipart_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| multipart_value.clone());\n let store_cred = std::env::var(\"APP_SECRET\").unwrap_or_default();\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7252e7d6897b0092388bd4b7280264f6666f7986b1cbe5ad39b5b9702d9fe7f7", "structural_hash": "f0e2fcf3346f98214c599a7433651831c0a75bb8a355d8fe8b4b6acd6f7b0ec0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33864.js", "upstream_id": "BenchmarkTest33864", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n res.set(\"Content-Type\", \"text/html\");\n res.send(\"
  • \" + String(data) + \"
  • \"); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4042c7f94ec0b0d470d27d00b09e00ad48b4a2dba2d0e856f369214afa48a1d0", "structural_hash": "c760bcd9cc525e7658be1fcd1beeae858728baf71aedeb572fd0d6bebcf55551", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05210.ts", "upstream_id": "BenchmarkTest05210", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "013927a701ce46b12a66ff091fbc15a604e5ada076e83012c8d54c72f65c88bd", "structural_hash": "b63432be3d0ae450c616174cfac0797fb4bfffc8cf7a3f1fa8855049a7f1a533", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01187.rb", "upstream_id": "BenchmarkTest01187", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ee1928d5b612bb2faa1dea82e2e50343da9790e32137e0884bc439facebd737", "structural_hash": "f89406e6dc2c7e2465e7b0181188c37b28a8fcf304b651b9ddf19e12f2a57b6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01831.cpp", "upstream_id": "BenchmarkTest01831", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f90095508ed8abc20d92c4cef0d3dad2ecaca47e119ab647febb93e65ccf151", "structural_hash": "f7d0876b71da4cbc402092b0fdc81977fba4800f49a9222f5e7ed7df41241fb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01232.rs", "upstream_id": "BenchmarkTest01232", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data: String = ua_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| ua_value.clone());\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "353727198a72cd06543da85f5c49acdd4ad3c4826e78fb5b49a309d30d4ffb0f", "structural_hash": "1b4e99b7747521817f3275a8a933c52b4e07343fcec09f781de2a4f7aa984efc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03471.py", "upstream_id": "BenchmarkTest03471", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\n_login_attempts: dict[str, int] = {}\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n reader = make_reader(user_id)\n data = reader()\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return JsonResponse({'authenticated': True}, status=200)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32ec7fe2fca2b4efba4e058c916c78c7022fb065c896c20f00eb03003df55522", "structural_hash": "595aa1329737c9d2f69e59eec11496a302c5579502c0b6530ebdf2625be16ef3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01581.rs", "upstream_id": "BenchmarkTest01581", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data: String = ua_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| ua_value.clone());\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d999b98c3e56a5804f939165a0fe16a6941625d5c0b7c307a13377020a4a939d", "structural_hash": "b9cbf4f9f6c0b92512e1f37bc7f3e8ac0b357154176e35be198372e075194b76", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03267.js", "upstream_id": "BenchmarkTest03267", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n res.send(nunjucks.renderString(data, {}));\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70eb3d394585237530e04dd6cf93d455cb95cf8614c7e5d679ea39a0f00926d7", "structural_hash": "a233944c7243b0b2dff9c0801ee99148e153e4cc09308b6f2dadbe5d79db2348", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_21495.go", "upstream_id": "BenchmarkTest21495", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata, _ := url.QueryUnescape(refererValue)\n\thttp.Redirect(w, r, data, http.StatusFound)\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70cb06e0dd65445a85c663456fdd970a73e40670706dd3a7746367d85b998ecd", "structural_hash": "8b6e266af9305a134ab0779a32c96fead4a5ed0b11c5de51fee21a27df7c34ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05894.rb", "upstream_id": "BenchmarkTest05894", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n if ENV.fetch(\"APP_ENV\", \"production\") != \"test\"\n _body = URI.open(data).read\n ActiveRecord::Base.connection.exec_query(\"INSERT INTO feed (data) VALUES (?)\", \"SQL\", [[nil, _body]])\n end\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b697a5f0e7eda8ec529d7778d57cd8e356b43e6950afcdb29ee4959bf7825fed", "structural_hash": "39d0e861e9a49a2170d06eb4a35622f23cc114bd0134946d7a4c69f0d3ab598d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00415.cpp", "upstream_id": "BenchmarkTest00415", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && user_input == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73b536b6f2191ba1cfb78b3fac01d8a6066d75bb5128346367a8ccb82abb6889", "structural_hash": "74f4e4be361f74f8217bfb33c2fc1fd4208674a872d350c51db09d49cb9bffd9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02616.rs", "upstream_id": "BenchmarkTest02616", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let tokens: Vec<&str> = cookie_value.split(\",\").collect();\n let data = tokens.join(\",\");\n crate::shared::ldap_search(&format!(\"uid={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc84b4973a1870d373cf0b818645599c65583834130690c1e49162b5f6ace2f9", "structural_hash": "63d0e90f2275621b2cd54d47322e96e4ef721d6eb75180e5fa4f3484de3027c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05319.ts", "upstream_id": "BenchmarkTest05319", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n childProcess.execSync(\"echo \" + userInput);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87e79885d3bc7901601f522b2e85d73da28f22ad3722d56ed112dd96e4fb62a9", "structural_hash": "0898681087a1ceb44554c7f5f896c9e54974a0efab297f73b85f141bf5c39e98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00071.sh", "upstream_id": "BenchmarkTest00071", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n case $data in\n a) echo alpha;;\n b) echo beta;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5188619eb67b36f826ecb696b858e213f43584415e07a123526bb50ebf95b8e2", "structural_hash": "1ca0a5e3c438a783bd1462c4e994e0ef0bac17962c88d9ee6061b2f838a4f2e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17434.sh", "upstream_id": "BenchmarkTest17434", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n printf 'SETTING=%s\\n' \"$data\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e6091065d8b2ef8db82172336c3a67db81f4e2f9aab0caabec672c70535950b", "structural_hash": "63a016e5a09a7dceee511181cfea32aade079c7eff4e640936d035df6b2bc42e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28217.go", "upstream_id": "BenchmarkTest28217", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tdata := strings.Join(strings.Fields(forwardedIP), \" \")\n\tlog.Printf(\"User action: %s\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "785e9f4c42e15654136d616c89bd7bd1313f66653ade34ba1385908f0fa1c433", "structural_hash": "98b1586eab727e43029931c3ce36852bda11c8d68434484fa376f727ccf24287", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08019.c", "upstream_id": "BenchmarkTest08019", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _vals[8];\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 1, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "371ba1ef97a697666aaee410642e541b29e67db0951c2b46044a6d115278a9f0", "structural_hash": "5ab9953f361766d1b51ecb4d5dae6368af5af807feea863177297debe8b13f02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17103.go", "upstream_id": "BenchmarkTest17103", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"net/http\"\n\t\"strings\"\n\t\"text/template\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tpending := strings.Split(uploadName, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\ttmpl, _ := template.New(\"unsafe\").Parse(data)\n\tvar buf bytes.Buffer\n\ttmpl.Execute(&buf, nil)\n\tc.Data(200, \"text/html\", buf.Bytes())\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a40c1ffe7816a3ac855a27dce0d5831759510ee43f8c638b62f47294941b4a8c", "structural_hash": "6104108005ed253a576b79f6bdc0c8ac7fbfa2768d02be1dedb7483038f9af93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02973.php", "upstream_id": "BenchmarkTest02973", "language": "php", "code": "headers->get('Authorization', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($processed)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "764c4fa406f6dd1b78e23a769b35ef38bf10592232ef49479fc21828373db337", "structural_hash": "9b4ca84043acad8e56a73a81578a4061d52cb6380cc97635e86b585c53b2e405", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01108.cpp", "upstream_id": "BenchmarkTest01108", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a99198f61dca09555b601f704268cde11c2b7f0c2479be32e665528adabd060", "structural_hash": "9cca9e8f696dca048c1f940f0a895fb56a37db638433ef462fbde0cfef44d573", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03220.go", "upstream_id": "BenchmarkTest03220", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tvar data string\n\tfor _, token := range strings.Split(fieldValue, \",\") {\n\t\tdata = token\n\t}\n\thtmlOut := \"
    \" + data + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c5ce1d27b8d86dd22b52824ee7f3e9650e0f1effad2f3793a469c541c2623964", "structural_hash": "0aa883f58478944f5441a0799f9a74e0b631eb680a045d342a2a72173085db6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04503.py", "upstream_id": "BenchmarkTest04503", "language": "python", "code": "from django.http import JsonResponse\nimport re\ndef ensure_str(value):\n return str(value)\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n data = ensure_str(multipart_value)\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n eval(str(processed))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "900c82a6815c18a2325729e7ec66d2836ae5ff9e305427b810129e922aff0dee", "structural_hash": "f294851720b142e8fd9d59fafed13035f84e14c1d594587fd897787011938e81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04906.rs", "upstream_id": "BenchmarkTest04906", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = crate::shared::passthrough(cookie_value.clone());\n let _crlf_stripped = data.replace(['\\r', '\\n'], \"\");\n static _RE_REDACT: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[A-Za-z0-9]{4,}\").unwrap());\n let processed = _RE_REDACT.replace_all(&_crlf_stripped, \"****\").to_string();\n HttpResponse::Ok().insert_header((\"X-Custom\", processed.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e54daab4c430ca014bdc333c905620d2eaca12659dcb5aedbb293dd2cd0b151d", "structural_hash": "eba37e690c7f8374036d3651c4e5504ddaecfe60b15e017299bb3b71d0d7826a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07396.go", "upstream_id": "BenchmarkTest07396", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tpending := strings.Split(authHeader, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tvar label string\n\tswitch data {\n\tcase \"a\":\n\t\tlabel = \"alpha\"\n\tcase \"b\":\n\t\tlabel = \"beta\"\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"label\": label})\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1eaba35f8eabcd6fcf2263a233cd901ca3469776f10865e5b805353a15c9af01", "structural_hash": "2d0ecd3d075a75ef7e649a0440add96a475167bf7156fce6f6559bada1a0dcb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00003.cpp", "upstream_id": "BenchmarkTest00003", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n std::string _fname = std::filesystem::path(data).filename().string();\n if (_fname.size() < 4 || (_fname.substr(_fname.size() - 4) != \".png\" && _fname.substr(_fname.size() - 4) != \".jpg\")) return;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c648655ffd03381c08d7f7488845ff522d72272e745ff905932f419256c1221", "structural_hash": "4590b1561e0fe584ffa76b4d0cc10c3ea434077d9ca70b27a370be98840f9bc7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05221.sh", "upstream_id": "BenchmarkTest05221", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17d2555e42e9a5b7d4368f2ccad6d326a57ec61b62f42416ccbecd757d9370c1", "structural_hash": "84dc9a4405c0b13996357de4b00d6030f08a49c00fc48f966efc715467352b39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05636.py", "upstream_id": "BenchmarkTest05636", "language": "python", "code": "import hashlib\nfrom flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n with open('/etc/app/config.json', 'r') as fh:\n config_value = fh.read()\n data = ' '.join(str(config_value).split(' '))\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(digest)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bddf7c743b0859d37db3bd75338232c15fc102563772928b49e3b51dea1452bc", "structural_hash": "672b872faf049edb501eb6f6570ccdbf1c0450a6845b0f6013fa9f33f4e1bbaa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01121.rb", "upstream_id": "BenchmarkTest01121", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n _hashed = Digest::SHA256.hexdigest(data.to_s)\n File.write(\"/var/data/output\", _hashed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40f0c301277130317c0602aa9be566c604e9edb40424c03e829143a6af29b0a7", "structural_hash": "733f439110e54c0f9522db3655e5913a4a2e4423eda5dd0b8462a8f471450300", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07642.js", "upstream_id": "BenchmarkTest07642", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n let _result = 'none';\n switch (data) { case \"a\": _result = 'alpha'; break; case \"b\": _result = 'beta'; break; default: _result = 'other'; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c7f1bea9d74d8281c97625d2c81fdcdfb906441ce38ca78727c3146a8c3a3a9", "structural_hash": "bd415c6329704d2e888a9294be0b561550dc26a7b276a0236c2eef9884df25a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08900.sh", "upstream_id": "BenchmarkTest08900", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2f18c4d0618053a5d2fb8c92faf70ff594d747542cb94aa95238d0311d4eb8e", "structural_hash": "7e1d16e7f5779ec07bb8b8974b9f812a1bfb187fc08483ca5562064637aa5dad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02950.rs", "upstream_id": "BenchmarkTest02950", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut pending: std::collections::VecDeque = json_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4a1cd01c5ba0d91e1f5012200f132ff49d17962aba4e16a2acd30224ce08ea5", "structural_hash": "50390c2f4fa23539973578f7d3af6f63598bd6280bb1689b7141b9a6fee320ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02411.php", "upstream_id": "BenchmarkTest02411", "language": "php", "code": "input('field', '');\n $data = '' . $userInput;\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40536a9c89d5288cd20f2d8c9b53e03811aaeb013d61ed22edfcae46172c068f", "structural_hash": "9024dc54b5d352733e70efa52e98dd3ebe822650cad1591a3a6c67a65f43a8f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02768.cpp", "upstream_id": "BenchmarkTest02768", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n std::string data = !user_input.empty() ? user_input : std::string();\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n std::string _out(_p);\n delete[] _p;\n std::cout << _out << std::endl;\n}", "label": 0, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96cf182a61b913c397a961c8cecab066c02b91d6b6f940c65277692a28d16e52", "structural_hash": "3659890dac04da47b5a7226533302cf2d18d6a28dabf8daf88aca3f47e820362", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02928.py", "upstream_id": "BenchmarkTest02928", "language": "python", "code": "from flask import Flask, request, jsonify\nimport re\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n multipart_value = request.form.get('multipart_field', '')\n processed = 'true' if str(multipart_value).lower() in ('true', '1', 'yes', 'on') else 'false'\n if re.search('[a-zA-Z0-9_-]+', str(processed)):\n return jsonify({'validated': str(processed)}), 200\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b93ebd0a6bdbb389da18c75f6fa23fc0c546daa305e486e135b44a9e0816363a", "structural_hash": "16e6afb1afaedd4717e99db5e35ee405204789b99db5b9353109b0129b9a9c40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04470.py", "upstream_id": "BenchmarkTest04470", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n if not auth_check(session.get('user', ''), str(cookie_value)):\n return jsonify({'error': 'forbidden'}), 403\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e7eb910d38fc9ad25bd8870a923d31ba387890320251cb6fe93ae6758a669bb", "structural_hash": "6dc76d23c424032ff184798de586c1631bf0b0a333dd08e81368281d36c9771a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04912.rs", "upstream_id": "BenchmarkTest04912", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(db_value.clone());\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ec428a2e52cf54964c76fd1cb217d3d68f5ea5ca70578fa2ed2df56f3ab9208", "structural_hash": "f920553ce43bf0c47a9089bee78810eb2050dd28fbfb5f162b996b66fa52e7d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05630.php", "upstream_id": "BenchmarkTest05630", "language": "php", "code": "headers->get('User-Agent', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return new JsonResponse(['validated' => (string) $processed], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ecdcecdf0f8efb31cdc1996533d6d722283ff6cd6d6c8825c8fc86e99cdbe346", "structural_hash": "9ecb64e9595b4f808c514b020b6ea815d80a85379356f70fd99b239b60cb5b83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04327.py", "upstream_id": "BenchmarkTest04327", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n data = handle(header_value)\n if request.headers.get('X-CSRF-Token') != request.session.get('csrf_token'):\n return JsonResponse({'error': 'CSRF token mismatch'}, status=403)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afe9ca14a38abc0c206135de3c1dba47e4b5ae65835924e018563ca860225a04", "structural_hash": "ba982984e574b72b9b2b5ac46c5ef9d85a73005d571365ed9e47ef7efccf5119", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00275.cpp", "upstream_id": "BenchmarkTest00275", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46fdc46b5f1947dd59415bda402eb4453397f403862185d3cb44cef4943d7d16", "structural_hash": "4e63f61b440c6310e52b79c0de3a74935c3f6a5cc2a77234f640cf9065d86fc6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01454.py", "upstream_id": "BenchmarkTest01454", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom starlette.responses import JSONResponse\nimport os\ndef to_text(value):\n return str(value).strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n auth_header = request.headers.get('authorization', '')\n data = to_text(auth_header)\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1282fb3be5717f1ea6ff92c82ecb4664a30a5d8e7eb22c54e5dbce46be6d96f0", "structural_hash": "0a56439206597c5e839e37e286c84aaad3190096b3add515b9fb0e9aef263e18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12951.c", "upstream_id": "BenchmarkTest12951", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n long _n = strtol(data, NULL, 10);\n char *_p = malloc((size_t)_n);\n if (_p) free(_p);\n}", "label": 1, "cwe": ["CWE-789"], "category": "uncontrolled_alloc_size", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e99b5a53b0a2004170bebb28c037307fbc29259a4b415c7afb230b46eae4299f", "structural_hash": "838146b3ee22cd725940f9572370db46b953d57833f71cd3fb2febf7269583bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02709.sh", "upstream_id": "BenchmarkTest02709", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n curl -s https://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50021b0672c077a1ffaecdc8364a1ede17af55491685c33003ecde7e0b928c11", "structural_hash": "379ea019878332965a3b1d58cfb30460f5404b2a9bbd1b9233cd2e50f9cbaf6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03128.rb", "upstream_id": "BenchmarkTest03128", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n data = user_input.split.join(\" \")\n Nokogiri::XML(data) { |config| config.dtdload.noent.nonet }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2cf3da11c95863fa426734401a433ea7572099f19d404a6e5f97e93087b96f8", "structural_hash": "0b9080a791c0e099e1ba588d9b58a46a54af88bb5a94116c23216cbca6fbd159", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31309.sh", "upstream_id": "BenchmarkTest31309", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n checked_path=\"$(readlink -f \"/var/app/data/$data\")\"\n echo \"data\" > \"/tmp/$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "426ca18865b505e8fd3adba46a7de7b2cfff0cc58a8e64448547938710364bc0", "structural_hash": "388a76fa8c5f93c32e1664836a8d2fb0cba8584f4d72222fc01cf647de117ab0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19755.sh", "upstream_id": "BenchmarkTest19755", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=$(printf \"%s\" \"$user_input\")\n exec 9>/tmp/app.lock\n flock 9\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87a5e184b6fe6e24c0447f377874f048b84db94aa91047d4134afd23ea408e8d", "structural_hash": "a3bc1ce788dde021eeabdc10d03745f37fd9be79df0805c382e89347e585834e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00708.sh", "upstream_id": "BenchmarkTest00708", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cd44bbd432be5db33303f9f737bbb2eb0c6a56ce6fdf14d7bd7daba82898a74", "structural_hash": "8378196233e4b6df7f88de4e3d5dc62591be8cfeb893d8cd591dbdef693feb26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00490.cpp", "upstream_id": "BenchmarkTest00490", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n res.set_redirect(data, 302);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "288c8b0094c135dafde88f0f9c3b86d1c16c6c678665ecf935779e7188d7a75d", "structural_hash": "786219057eb27587486276331c4028c825311302722142a7a516d1e9aaaf6174", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01968.cpp", "upstream_id": "BenchmarkTest01968", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n long _oid = std::strtol(data.c_str(), nullptr, 10);\n bool _allowed = _oid > 0;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47b6922225ecc863abd9a282aa9b682aa1b60e11d3b10976cd91036b72408b50", "structural_hash": "d5a408459163106b0d97e0399411b5b7a530a78dd3935ad358fd186dc26811fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00330.rs", "upstream_id": "BenchmarkTest00330", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = serde_json::from_str::(&raw_body)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4afa7f59703ce84e67d650d302b309ced1490808ad8d9c4a7823c0d43156cb64", "structural_hash": "d2e94504acf7c7a9be3da6860d207dfea49ceb84f77956f74cff00c47eaf71f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33671.sh", "upstream_id": "BenchmarkTest33671", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e96cb585837b68e10b1feda843a6b2b4897f8fe717b92cef0bdbd48253ffb1e", "structural_hash": "28184aba109bd765fff0944d39f636bc1d3e55c7d6e951dff3c0b5dfeb490e89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12893.sh", "upstream_id": "BenchmarkTest12893", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n chown -- \"$data\" /var/app/run/worker.pid || { echo \"privilege drop failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a373aa0ef4e5a7459618942382025d65da1d085bd739a29db1b94db9975361da", "structural_hash": "88aa4084a486012b61ec540f1d2306b0b39e610a7925a9559a15366903087d25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38792.js", "upstream_id": "BenchmarkTest38792", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = \"\" + userInput;\n res.send('');\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3832f53d6515ea2920be33e34a866f2edf37d852176d393a188b893698caed2", "structural_hash": "279592230c509fab588fdf3a056cdbaf933b2c64b7b3e0c63af6a80bd839dc1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16605.sh", "upstream_id": "BenchmarkTest16605", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n eval \"echo $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1ac0da4469cc7db8ccddf4baff74d463b166b7105c61b0886991468cc093604", "structural_hash": "38c6e3f23e2b9a5622dcefdbb4c625cc38eef5aac1e3fda4a62a070382e11bc2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05947.ts", "upstream_id": "BenchmarkTest05947", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n fs.appendFileSync(\"report.csv\", data + \",ok\\n\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "672dfe4a061ff5fae5a3527eeaee7bb1693a06889989afade98b30809b748b63", "structural_hash": "92e34416141f9e0654fcbb29dc5033ab3bb2e1eace005bf9c804a0aa08f0200b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04284.py", "upstream_id": "BenchmarkTest04284", "language": "python", "code": "from flask import Flask, request, jsonify\nimport requests\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = f'{json_value!s}'\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9e6cdc4f4315de6ff57b4a3f532702c63c8a030c207d24baa8789ad6273c6bb", "structural_hash": "4599039828b17f7403b2e66ce64da0b6f0a99ab99fd28323a1b2d0e0dd11c116", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00575.js", "upstream_id": "BenchmarkTest00575", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n ctx.body = { validated: String(processed) }; return;\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c727a7525abd3ad0882abb4b1a5aa5a4c37ae024da1463e325fc99921e17087", "structural_hash": "fd679194d62ef15c1760caf3281bdf0d784912c924ea29e53d775a79f91bef86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02001.py", "upstream_id": "BenchmarkTest02001", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n multipart_value = request.form.get('multipart_field', '')\n data = '%s' % (multipart_value,)\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59d22881f38b526659d58bb2bb4fab6580f1a3f12533ba75c9327bb7177e056f", "structural_hash": "d71925df2a0736273ebaa0259183f968c3dd433f775230544737b66b6f49781f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05205.rs", "upstream_id": "BenchmarkTest05205", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&auth_header);\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dcc0d68862794bd5a853d28b73c0d31499fe9217202a91fa1d1987ee4b91661", "structural_hash": "70fb48962c38835c91168b8341c9443c8960a5914a8faeff9d59c7f56f9b74fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03958.go", "upstream_id": "BenchmarkTest03958", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\thexBytes, _ := hex.DecodeString(dbValue)\n\tdata := string(hexBytes)\n\tauthVerify(\"user\", data)\n\tc.JSON(http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-258"], "category": "empty_password_config", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ddc951c5aeb701788dcb855c32ea1dbd1665fbb1d34ff9b664f57860a8579fb8", "structural_hash": "7fe99a97428dfc96b21bac44a6726556a75276298a3c912883620488bfa40562", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03549.c", "upstream_id": "BenchmarkTest03549", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char *const _argv[] = { \"/bin/echo\", (char *)data, NULL };\n execv(\"/bin/echo\", _argv);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c4b881e0e51ab97c8a5114628cf91ba8a5e37ac370fdc417aec8043aca8bdab", "structural_hash": "104bf141960b15d9a4d72d84665703b9664a1c5539500257295c949bc9bbd9ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04299.ts", "upstream_id": "BenchmarkTest04299", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const data = \"\" + userInput;\n res.cookie(\"session\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9d5de45f66d485efdac54fb9b6ceaf77c4dc3971efad2b7a4fee13229c0902d", "structural_hash": "481c89e9611d9252999a2508eb73620ed74e6abdc6e1141b31ddc1af81de8962", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00163.rb", "upstream_id": "BenchmarkTest00163", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = sprintf(\"%s\", user_input)\n DB.execute(\"UPDATE users SET name = ?\", [data])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "927e289261e486b02bd65d51aea9743d86ecd7e206fa6c8b5b7c2e5041ef8dc4", "structural_hash": "89ca904bd02bcb8ca9cfc511b0850a514a06d26783ea95d7807e13a3e7fa6335", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02132.c", "upstream_id": "BenchmarkTest02132", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f20b645a44cc162454ebf0d79e01dc95243a2577529dd4c8130202dc83b89e8e", "structural_hash": "f4ea8c74be6736e23ef1894cbc6eb9cc0879c03dcfba617ec4b639cb8d7cdeb8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11343.js", "upstream_id": "BenchmarkTest11343", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n req.session.data = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-501"], "category": "trustbound", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "477e4ad5790bd92476c8f17c4f0265272ed5662cdf8969aabb5a1f258d17eb6e", "structural_hash": "17add47140a42016b2ed3e93b3bd85e5db8ef17de705fc4de8d5736eaf817eae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12764.js", "upstream_id": "BenchmarkTest12764", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n globalThis._stateLock = (globalThis._stateLock || Promise.resolve())\n .then(() => { globalThis.sharedState = data; });\n await globalThis._stateLock;\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b290b4e3dc54421d9ef5ebaf7bad68887f7303696f20ea99ec503c8fa31844db", "structural_hash": "69f9375e4d5a700dc234c25562f8cec3b285296190d3ebb5d280a7b544317843", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_11065.go", "upstream_id": "BenchmarkTest11065", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar data string\n\tfor _, token := range strings.Split(jsonValue, \",\") {\n\t\tdata = token\n\t}\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b68680adf5a0b3705bb5a798c6c913cffb0dd338e58d6276158bd2a2c14ffa0", "structural_hash": "209820e7dd40cf77ef0506828723db64691f9eaf178ec75f1e379d9fbebc6b04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05954.php", "upstream_id": "BenchmarkTest05954", "language": "php", "code": "headers->get('Origin', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d638958d16f0d7c2c2ee7e065e0ea207cb33cbe5ebd008a7b9484fbd6abd8340", "structural_hash": "c9cd90dc2093fc680378ee2a86bee8ec17c4c58f5790f47581b7ce3be37ac254", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06847.js", "upstream_id": "BenchmarkTest06847", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (Date.now() > 1000000000000) {\n ctx.body = \"
    \" + data + \"
    \";\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "835b17fc4ac27fdf2b2781a7e826442af018500c153da6f5ba0207d12c8d7523", "structural_hash": "cf8bf7af2899872b2aaa30b275be74dfa2d1815f911b203fd1746df9456688c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02448.c", "upstream_id": "BenchmarkTest02448", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n free(_p);\n}", "label": 0, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b39f1074b5072d2c44e4b34f09777e68c39b63fc5838c1ae62515e8439a9b0b5", "structural_hash": "f5644221ce4a18890933ed797f0965a0326e39dfb0eac6e285b4b849d17a5362", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02731.c", "upstream_id": "BenchmarkTest02731", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n void *_h = dlopen(data, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "062254247ca04c297571dc1f9baa4c9b445992723c673c4f3261f728ecfa5ff7", "structural_hash": "cc897252c26d71b974390e9303eae8fc79a331d4774b00bdf5f82e4ac80153aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29210.sh", "upstream_id": "BenchmarkTest29210", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\"; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6de45a258fccc2d00db8f249d0b8bb13951361d4f77f5e703116949691b4515", "structural_hash": "1d26baa099e5c0696d45ff37b61851463cad9f77bd15537ffd80aa48dcc24371", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16116.go", "upstream_id": "BenchmarkTest16116", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(jsonValue)\n\t}()\n\tdata := <-resultCh\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tdefer close(done)\n\t\tconn, err := net.Dial(\"tcp\", data)\n\t\tif err == nil {\n\t\t\tdefer conn.Close()\n\t\t}\n\t}()\n\t<-done\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed1ab765cc93b6911651a9434ce564adc348b54781306e17be5e509f5dfc434e", "structural_hash": "277c8da05c8c411afc940c750f6e5600a0b2b17c3a770f0ffe010dacf811644d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03380.py", "upstream_id": "BenchmarkTest03380", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n parts = []\n for token in str(header_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n return render_template_string(processed)", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15d57efe734e9ad8d0f2a56e879f6a5539e97b83c06de58a7d53335bb77436d0", "structural_hash": "d1b79ad1a900f638a7dbf3b16a7bb5542323e4aaf27c2b26165ff5b439d83874", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09332.c", "upstream_id": "BenchmarkTest09332", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", data); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e6a48ded7488ef08a33fae4ac4158dc55f9cb58568f18a4669da90060694f2a", "structural_hash": "1e88d5bb1b784829fdf33e656443708be7c44f6ed591992421ec78bd858370ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01684.ts", "upstream_id": "BenchmarkTest01684", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = [\"feature_flag_value\"][0];\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c290a98ede3635c0cc502a3fcc2f8772d548ed38846246e82598be8b08950784", "structural_hash": "a5b2c6be837efa546bb5f6d839076a41c84baab67c69956881dff98ce0787ec5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26365.sh", "upstream_id": "BenchmarkTest26365", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n rm -f \"$tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98c3f9ee024e20335a8ddb4aba92b31e11a40066b78f0dab0f18d88ddd844cec", "structural_hash": "a2e510f9c5b09d43634912c86c9db5d26737e3579a7994108f8be4026ad821f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05712.go", "upstream_id": "BenchmarkTest05712", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tdotenvValue := os.Getenv(\"DOTENV_VAR\")\n\tsalt := make([]byte, 16)\n\trand.Read(salt)\n\tsum := sha256.Sum256(append(salt, []byte(dotenvValue)...))\n\thashStr := fmt.Sprintf(\"%x:%x\", salt, sum)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 0, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5804b772587484f5c3e52b30f66068572da5d82edbb7a2c4e4eb318ef0b42eed", "structural_hash": "875e0e6520e2da9e189b100ff9f2507af0a0f55a901b3d1969905be6e79d04a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00042.cpp", "upstream_id": "BenchmarkTest00042", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "117d36169a40701af30dc5d008712396c131e8871ea2242d943056ed5fd594ae", "structural_hash": "7baf2daedb8cafcd30c9d149b2e6ebc040d2323c2b60de8f7d988571049b4181", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01902.php", "upstream_id": "BenchmarkTest01902", "language": "php", "code": "text;\n $data = str_replace(\"\\0\", '', $userInput);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93d2c67a45477c58c3093b722fc69fc8a660b23c9b29c65e951d648168b58742", "structural_hash": "507db522acdbcd6996ad7a435b4291792d02c459184ff33b440ee6cfdf414b41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07888.go", "upstream_id": "BenchmarkTest07888", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tcapture := func() string { return uploadName }\n\tdata := capture()\n\tos.Chmod(\"/var/app/data/\"+data, 0777)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad82bc118ce7228511e734b623007738c0fad0b078c478e9d0c47ba7d0481cc7", "structural_hash": "d9cfd6edaa4afaab3a94d49f20f5a95ddcfa2a91eccc61e46707d809746369bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03061.php", "upstream_id": "BenchmarkTest03061", "language": "php", "code": "header('Authorization', '');\n $data = base64_decode($userInput);\n file_put_contents('/var/data/output', (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d98136f98097fcd5747843ec96ab453b5f35732b2eb0eba3e76990bc2c4c4431", "structural_hash": "acbee26358be2a376baa02d57893b6297553450a1134ec70d1b7e3c885b107cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04601.rb", "upstream_id": "BenchmarkTest04601", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n payload, _origin = user_input, 'http'\n data = payload\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => data}).first\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a11200602607307c84d6139ac5cf9ad7f53aba943facf81d215199d7013e779c", "structural_hash": "a42d7f9469203ab97dc0f658a13b49b0b63109df93f7c81710b0f9b56bf5725d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10741.sh", "upstream_id": "BenchmarkTest10741", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-311"], "category": "missing_encryption", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a0ca3e0647a5d376a065ccdf96204a44178599251dead0e2f7b149ab3c84b08", "structural_hash": "6177b8038c360022bde05c3d06a37bec0f9fc7f8fe7ff0cd335ed247780d6443", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21323.c", "upstream_id": "BenchmarkTest21323", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n free(_p);\n}", "label": 1, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66eb4ac6585d91b9fc0de066ddea0f9c531873314a7cc66cc6a7b18768270620", "structural_hash": "40d3c45e72c02decfa608d919c655a84f1bd1ffec8c42a9e5c0ffdfb762a40c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06569.sh", "upstream_id": "BenchmarkTest06569", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n echo \"data\" > \"/tmp/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b939eec8ab5577bfd8a7c8c81fca613c922a3d6d512bdbb07d3deadf44f7a150", "structural_hash": "f43173d6e3b4d963b9d676f3a9d21affef5b30bdb357f55e6b58286f56ab6ac2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08779.go", "upstream_id": "BenchmarkTest08779", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(hostValue) {\n\t\tdata = normalizer(hostValue)\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Header(\"X-Custom\", processed)\n}", "label": 0, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6d45cba0566a4e5957e775f31822ca99b8770f8c1ff2be476aa703429ac25f5", "structural_hash": "f70073fe26539ba09078066ae9666b7bcfc1874ae125daaaddb5e73fae3e22d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03701.cpp", "upstream_id": "BenchmarkTest03701", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb9a625cbe3d7f42a68cb32c11ed09ea0907b3677166365adc713d588e79902e", "structural_hash": "cae9d24140ccb7f4830fec06eaf9a3a2ca4c98fb33d4c0af68f47aa25c21f7b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01023.php", "upstream_id": "BenchmarkTest01023", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n return new Response('' . (string)$userInput . '', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b17b02be7c744dbc372a78a6620bd9321f4f4d57697b871c78969fd84c905e57", "structural_hash": "95d71684fe3400927c42b865e1dadabbfde818901bcfcaead2a73dbdbfd007fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03438.cpp", "upstream_id": "BenchmarkTest03438", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e173138abd11b939d7c1fd6fd2f4e79b0a1568bee5d1394d8697b17395d31f98", "structural_hash": "ae02420bc53246968080a884f4e5cda41f25bf6a2866228ebd1a0b8d0394412c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02362.py", "upstream_id": "BenchmarkTest02362", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef benchmark_case(request):\n with open('/etc/app/config.json', 'r') as fh:\n config_value = fh.read()\n data = '%s' % (config_value,)\n requests.post('http://api.prod.internal/data', data=str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "067f13377342e7a478baeee9f3d6ff16a1d6959d56f617d675a40ebba45b70ab", "structural_hash": "8866d5fb4b11afbb74e58e98778de5f16f22fb1cc7c6a894e1ef928711abca66", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02172.rs", "upstream_id": "BenchmarkTest02172", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: env_value.clone() }.payload;\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21e049371e3d9d274f9413fffa3381e46508b0b6fb41419c3422248dbeb90b2d", "structural_hash": "37e7b212b0849650528ff2413130b9a638f52f336d40a1db409fffb6dcac448b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00082.rs", "upstream_id": "BenchmarkTest00082", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: referer_value.clone() }.payload;\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e1efee402fe63cd93bfe0cd1fedd835fd40c2f42f7371845654c01440600b65", "structural_hash": "882901d06c7df20ef0f8334b3db1912729eae20b313c5ee514009fade5c815b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04131.php", "upstream_id": "BenchmarkTest04131", "language": "php", "code": "input('field', '');\n $data = call_user_func('strval', $userInput);\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $processed . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c31a2813208511cd107f9dcbca7ec89bc7d1499a0eb6700001559cc28daaba4", "structural_hash": "6fa7d0deea4a54d679c46b2f96d2fd6759c753006b71e1b2ca0d634bf9644050", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05466.ts", "upstream_id": "BenchmarkTest05466", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = shared.redisClient.getSync(\"session:key\");\n const data = String(userInput).replace(/\\u0000/g, \"\");\n JSON.parse(data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2ba2e2c47760837a4cb67d021657f61a78bc063cbb936f2feb2b52220836be8", "structural_hash": "93af57c0f1fe7287fed3d66990a8d1ca5b52233e35e6628ee4c290c3cc5b1429", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00501.java", "upstream_id": "BenchmarkTest00501", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = java.net.URLDecoder.decode(userId, java.nio.charset.StandardCharsets.UTF_8);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "768bf9c34d53c62a5a45cf2047161e94e484ae05312f43f696ee6047222a2979", "structural_hash": "664a855ac1561d2902f9ca8ca33997b5b1bf9251ef2710978f7d55a91596e0ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05105.ts", "upstream_id": "BenchmarkTest05105", "language": "typescript", "code": "import { Controller, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const data: string = shared.passthrough(userInput);\n if (!req.session || !req.session.user) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n return { listing: entries };\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d2c887a45760fc4644868ab7d0c8f8a732819a107df61b47de787334c3633e4", "structural_hash": "7f2ea41978d58fcbd9effb4c838da1e6c9d228ae850d51c9e2cb5a2967f24cd0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_29288.js", "upstream_id": "BenchmarkTest29288", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const data = await Promise.resolve(userInput);\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) { ctx.status = 500; ctx.body = {error: \"privilege drop failed\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7e3dcac9f93cb3e4f8d443c9a6dcee70d5de110fa2c290366364782c2cd65c5", "structural_hash": "a3e3242d514eae4df2a163afd181c09120df569a78820d8483a3ac7eea0e3e90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14281.c", "upstream_id": "BenchmarkTest14281", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", data);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd86135ae0dd0bfa4a2848bc244eda24c8f66f03edab88dac338e01070992341", "structural_hash": "82c47b3ab3257020a5b45624b60708be8403051a4f1edf42a7c2942ac676701a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23962.sh", "upstream_id": "BenchmarkTest23962", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n curl -sk \"$user_input\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-322"], "category": "key_exchange_no_entity_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "328f240c56e1999e08b91b147a2553b670aa987eff62b58f3c64d9866a17de99", "structural_hash": "eacb08bf9b8d8b2fb1a525afab6de13ce198774d94d0304c880197050b9277be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11284.c", "upstream_id": "BenchmarkTest11284", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char _bn_copy[512];\n snprintf(_bn_copy, sizeof(_bn_copy), \"%s\", data);\n const char *safe = basename(_bn_copy);\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be91f00bfe4224b53f380e8d1d5881b73180d5315b3c45a301e138dbe01f6bd4", "structural_hash": "b4b6482301142e1db2b0ff13f6e333195b533175531d1fdf5bae1647ff01e964", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05332.rs", "upstream_id": "BenchmarkTest05332", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(raw_body.clone(), |s| s.trim().to_string());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3530b1b5b2b70987b17c71a71b0ade270017a374425829dcd4d77b447dfa0fe", "structural_hash": "99d03a5ea9ffb74f1af948ce8326353c268e060165b39acb54a9f53ad197c7da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_14280.go", "upstream_id": "BenchmarkTest14280", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tsalt := make([]byte, 16)\n\trand.Read(salt)\n\tsum := sha256.Sum256(append(salt, []byte(rawBody)...))\n\thashStr := fmt.Sprintf(\"%x:%x\", salt, sum)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 0, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ce743ee9284b8fe5ca283396f7222bdf6a500b06851aa51fe32f180f69e1f6d", "structural_hash": "3e0c94e4176e6cbfacb62300b91d23bc31bc0126667fe7580d1898dcec405625", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07199.go", "upstream_id": "BenchmarkTest07199", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/md5\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tvar data string\n\tif len(multipartValue) > 0 {\n\t\tdata = multipartValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\thash := md5.Sum([]byte(data))\n\thashStr := fmt.Sprintf(\"%x\", hash)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60e13a60f07e8534ec9fbef9a077507124f8718e48f58721381ea62f1d38db6e", "structural_hash": "89f0aa491bc7140e61f8fcdcb9b8707046ab8208bbf970df801dc281e9507cf5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01401.rs", "upstream_id": "BenchmarkTest01401", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let stdin_value = { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().to_string() };\n let data = stdin_value.split_whitespace().collect::>().join(\" \");\n let _ = tokio::fs::read_to_string(format!(\"/var/app/data/{}\", data)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4009bc9885f6273470dc0f689005fb5bd14f0f1cc80f54e6c431c093d2f8c8b2", "structural_hash": "6fc350582470f14ed0b8204916baf73a84d8abb178c5a543753bac5b000f70fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19086.go", "upstream_id": "BenchmarkTest19086", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(uploadName)\n\tparts := strings.SplitN(data, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 1, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c52da88530fefe85e9af1ed8866448a03212c85d1e8387c92be7d7e957aed676", "structural_hash": "0c926f5ee0ec1917bd8b240530c6fd32abeb1340336cc9d37f3cbbf70f95222b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03792.java", "upstream_id": "BenchmarkTest03792", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", authHeader);\n String data = sw.toString();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"DES/ECB/PKCS5Padding\");\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(new byte[8], \"DES\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1b785d730f5e4eb7b94fdcc6a017fb482ab79e4fe9f0232f4bfc8993a887bf1", "structural_hash": "72754b2459643d78e8a10761a45d747ff65d4732cdfef6c3181e24cc8c0f0227", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05164.py", "upstream_id": "BenchmarkTest05164", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nimport os\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = '{}'.format(raw_body)\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9625f7562a82c73d6966ea105def4a8a9b3752b034db3887ec161827abd3800", "structural_hash": "15573d3ffcc76f2adb2184f93ee89d3bd217386e8ce59b080eaa5635eb66af31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04073.ts", "upstream_id": "BenchmarkTest04073", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n crypto.createHash(\"md5\").update(processed).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d8fb7025f30eff232b337503c7d2b5d97c6fc0115713ee650cdb1d409002196", "structural_hash": "821d1a108d48553985ec97053968b5e7737ba21811c113fc9adfa96b7d3400c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_40182.go", "upstream_id": "BenchmarkTest40182", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdata := strings.Join(strings.Fields(dbValue), \" \")\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\thttp.Error(w, fmt.Sprint(r), 500)\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a09ef37a47414c74aa420affa358e397ff4a1ad434bd039d213570f3dde25302", "structural_hash": "9d80e17de5cf3a74689b7e886b612972dc28f99cdd6fc068d5500b9755a78c5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04494.java", "upstream_id": "BenchmarkTest04494", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(multipartValue);\n response.sendRedirect(data);\n return Response.ok().build();\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c92ef1ce9b4b12732fa954a299557a9c759339c9b4a394b4e54d105bf4ac1ee0", "structural_hash": "c9e0395658aa3c0c114d25ff54ddd0a748324ab25175c6a950303a87958002f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05393.ts", "upstream_id": "BenchmarkTest05393", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n res.send(nunjucks.renderString(data, {}));\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "279c7ddb8707bde6f3a478dc0f3b576de270b66b34d892de3b98542254250973", "structural_hash": "71c37995beab894dd17eef51a944654fd4fbc5d86790eed2bdd61fda7784a76b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05357.js", "upstream_id": "BenchmarkTest05357", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = \"\" + userInput;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.set(\"X-Custom\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fcbfb3a85c5633eac56df0441f43844294a1c122ce9454b313ec0a774b654cb", "structural_hash": "ffad46086495d1862ebe7fd5039636f606922c452769845912e6081b44a4477b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02688.go", "upstream_id": "BenchmarkTest02688", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvar data string\n\tif len(xmlBody) > 0 {\n\t\tdata = xmlBody\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tcipherOut, _ := rsa.EncryptOAEP(sha256.New(), rand.Reader, &rsaKeyPair.PublicKey, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"rsa-oaep\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "323848748dfc3f910e6c8216a93c020bd7eb3a490f1bd5e84a2c59edcdf60bb7", "structural_hash": "5fb154d2f69b26dddb04d56460363f8c687bf1d09446be8cc0f841c25e0f5366", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04428.rs", "upstream_id": "BenchmarkTest04428", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let captured = cookie_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")).finish()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fcc1454f9f0516fcbb556a2ba8847b7cfbbdb6a6c0e5bd41c75a0de951d3c8f", "structural_hash": "8f586ac0f0abc233610b12383360f5cbf3d8ac65d9122ddbcd938def59d356b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01217.java", "upstream_id": "BenchmarkTest01217", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(cookieValue);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2667e5354da1d537878e73198976f1142557210eaeeac7b88c2c45701d39049f", "structural_hash": "b457dcdf437275c6f5cc774183472e5367676a00f20ce5591321a59cd21be5ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02981.c", "upstream_id": "BenchmarkTest02981", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct ldap LDAP;\ntypedef struct ldapmsg LDAPMessage;\n#define LDAP_SCOPE_SUBTREE 2\nextern int ldap_search_ext_s(LDAP *_ld, const char *_base, int _scope, const char *_filter, char **_attrs, int _attrsonly, void *_sc, void *_cc, void *_tmo, int _slim, LDAPMessage **_res);\nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n const char *safe = data;\n if (strcmp(data, \"asc\") != 0 && strcmp(data, \"desc\") != 0) safe = \"asc\";\n LDAP *_ld = NULL;\n char _filter[512];\n snprintf(_filter, sizeof(_filter), \"(uid=%s)\", safe);\n LDAPMessage *_res = NULL;\n ldap_search_ext_s(_ld, \"ou=people,dc=example,dc=com\", LDAP_SCOPE_SUBTREE, _filter, NULL, 0, NULL, NULL, NULL, 0, &_res);\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a21810512dcedf906f2f3c04ce6deaae991d0f73bba75399f46b3c589a1311d", "structural_hash": "01813a651f8f6e12ca27113ae6c4d6f5fce2cb69f69e873d23580282643cc294", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00538.rb", "upstream_id": "BenchmarkTest00538", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1316b863cdcc91bdf6aabb0f4ecd5071f87c8361b736d4d1682156a6f6a9f1a", "structural_hash": "e32e5a9f4f8d1fa28ad87afafde15b164a1ad28c01fe4f889f74c3f78471c2c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03892.rs", "upstream_id": "BenchmarkTest03892", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&auth_header);\n let processed = html_escape::encode_text(&data).to_string();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6dd311f6f0000e06726f37dd90b465b6383f4426f6e19f68b8bcc22953a1f6d", "structural_hash": "36e171f6c9df27209a42d134ab8d3a4e0af6eb22aa538eeb71c5dd41604afdb7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05510.ts", "upstream_id": "BenchmarkTest05510", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Header, Post } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n return nunjucks.renderString(data, {});\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59e684233e3a17cbf12fcc97ab773d024a8b9b09c671100dcad6079177496104", "structural_hash": "71dae45496c8dab7ac1a3c839f75b34a1ec1583213548cbecc66881a360149cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_38729.js", "upstream_id": "BenchmarkTest38729", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(processed)]);\n ctx.body = { updated: true }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17df8c6ecf178e2e754fd808558f4c6bd70e23f2e900a7d7941dba9ba6562076", "structural_hash": "94d5c1e4be063ea1427a4094b6c4af688bd2776f26039f846dba4fdc948883be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00984.py", "upstream_id": "BenchmarkTest00984", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n parts = []\n for token in str(referer_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bed6389afb0d3620f68df19e822081e672d3814ff4552ab71a2b797a714e99ba", "structural_hash": "7f5c8b3c924ffc477e8f3e35580c41f3f43f55324af412e3321038816d77e55b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04391.rs", "upstream_id": "BenchmarkTest04391", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = forwarded_ip.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n static _RE_SCHEMA_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[a-zA-Z0-9_.-]{1,256}\").unwrap());\n if !_RE_SCHEMA_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::set_cookie(&format!(\"session={}\", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43cf97a8cf8fc651abf3329c596256297756f18010a8c69ba755324ca1e0ebc4", "structural_hash": "16f67e09402316cf6eab55b86d02b97304c302bf804e1fc46f846fd343d4bedb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04588.rs", "upstream_id": "BenchmarkTest04588", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: referer_value.clone() }.payload;\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n use sha2::Digest;\n let _digest = format!(\"{:x}\", sha2::Sha256::digest(_body.as_bytes()));\n let _expected = std::env::var(\"FEED_SHA256\").unwrap_or_default();\n if _digest != _expected { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb53e6c542584d88adcbf533e3e0096f0322b09507ae1a7505bed662c9edd529", "structural_hash": "8a5039c53bbe30ec01b09724fb28f039b57d3fef207ca830aba35776960b7d0c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04724.rb", "upstream_id": "BenchmarkTest04724", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = format('%s', user_input)\n File.write(\"/var/data/output\", data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0ea1d1cfbb0bdf16beff5c000c0f1eb11978d3f1136733fb534f478b2886891", "structural_hash": "bc1d40b5bbd2fcc24e3a4c0f800447446a441fa2164fe1c5df6a64637a9740a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23238.sh", "upstream_id": "BenchmarkTest23238", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo $((RANDOM % 16))\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-331"], "category": "insufficient_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1deb64b0bb1adc6f9dd4c17fd48fd5374d43c717cc7d880f92461196229cdeb", "structural_hash": "cf18021ed5ee691c0d763025948c18899931a7cfae4c3ebea8d20bcce6ec87ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02713.php", "upstream_id": "BenchmarkTest02713", "language": "php", "code": "json('payload', '');\n $data = (!empty($userInput)) ? $userInput : '';\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($data); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return response($_elOut)->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23af4ac201ca55a8528cc2ce3c2a91bcbcd060d8887c0c0e92dadb1fe8a081c0", "structural_hash": "37a5c4b80ca85a7f00050d2a3124e2bb5c71e951258f43d44a00888950f62b4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04415.php", "upstream_id": "BenchmarkTest04415", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = ($userInput !== null) ? $userInput : '';\n simplexml_load_string($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f600d2387d10594c52a2922afaaf0e6a178cd1538cb859122c36814ee0d709c", "structural_hash": "a6a655d27fc07421cd300ec385c6823c1e40671196357076f1e96784044e55f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05205.php", "upstream_id": "BenchmarkTest05205", "language": "php", "code": "input('multipart_field', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "771b2ee270fe534fe198cfe68d883ce45838f62957146eecc001768b01f97d8b", "structural_hash": "ecbe6c880945cd3634b42733ccd43da143056559a01694fc1e2553cd9dfaf340", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13844.sh", "upstream_id": "BenchmarkTest13844", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$data\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4ccb930b57d34be015caee4dd895fca2b9836e33553c794062087280b4bd8ae", "structural_hash": "bcdb39bd9d7161eb53948c80ed3c2d68be61a320fe3fa7e2e5fa3f4cdbe352eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02360.rs", "upstream_id": "BenchmarkTest02360", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: graphql_var.clone() };\n let data = payload.value().to_string();\n let requested: usize = data.parse().unwrap_or(0);\n let _data = vec![0u8; requested.min(4096)];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a890da8bd08e38129f7960a598dbb400239cf2f24b6137a584ce3a36b2d5f5c4", "structural_hash": "f9138a30e8bed0bf4d56bdd3e0bc19bf127bdb14b8c9c203b0a7ddf414f4bfeb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32890.go", "upstream_id": "BenchmarkTest32890", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdata, _ := url.QueryUnescape(cookieValue)\n\tfor _, a := range []string{\"read\", \"write\", \"delete\", \"admin\"} {\n\t\tif a == data {\n\t\t\tRespondJSON(w, http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\t\treturn\n\t\t}\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-285"], "category": "improper_authorization", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80d6f412081ae38fea7ef3cb64aa3b3c2aa491309420b59b40f3475c28a032cd", "structural_hash": "977061a25d56d72471a17550ad0f6a091d6cb2920d8b29e0b75bbee516e0c927", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01677.rb", "upstream_id": "BenchmarkTest01677", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"feature_flag_value\"\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93339a3d6a24617ec955eda919632320cfab05f64cc5391876d2713903c75531", "structural_hash": "dc4a132c983fbfe84a2b903201866af7faa1734aa9c9a7b1efc93052ab005dac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01931.php", "upstream_id": "BenchmarkTest01931", "language": "php", "code": "getContent();\n $data = \"{$userInput}\";\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72e42bb60556a39513ebfd23bb3edaf14e1c6ab8c144582410accc8eb818e8b8", "structural_hash": "1f5616c490317b62400d59f066b3622671106dcd879f8e31f3d13a7f8795a974", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17653.go", "upstream_id": "BenchmarkTest17653", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tpending := strings.Split(multipartValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tc.JSON(http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-336"], "category": "same_seed_prng", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8573f611ba3dffacc4a973aacfe7c0a26ae4033b1eb4b027c4d4115280a99a70", "structural_hash": "81201c2e9c0c2f77932bc818ec522ef22c6e7a0b11f2df6173d3ae39b081c23c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37802.go", "upstream_id": "BenchmarkTest37802", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", headerValue)\n\tdata := _sb.String()\n\tif !strings.HasSuffix(strings.ToLower(data), \".jpg\") && !strings.HasSuffix(strings.ToLower(data), \".png\") {\n\t\thttp.Error(w, \"invalid file type\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tentryFile := data\n\tos.WriteFile(\"/var/uploads/\"+entryFile, []byte(\"data\"), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74852d67f16fbfcd6dad648aaeec4ae6ca0445e546add1b7b5fa2b44031c4775", "structural_hash": "05ffdd3a8c6106cc8393aab9c9933bf074b20cb2721d99db0d7d8f56ae3f657b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04492.rb", "upstream_id": "BenchmarkTest04492", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff6f5e372b3b8feb5aafd050d84cef60ec54d8648b294563ca8235e63db952ed", "structural_hash": "39ff631fb90ee0264160843c9ef99d60b1cf76bb66285c16d4f509fb1f7da918", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00647.c", "upstream_id": "BenchmarkTest00647", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2ee4406e3ccad45f7db9938f8e8905e6eff45ed630b74c8cba8ccc09db376c6", "structural_hash": "c1d25f14752a6d82a6107807bff66a67f5d0da5f088af1d4230ca27f496b966d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01729.cpp", "upstream_id": "BenchmarkTest01729", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3ec82493725f1bf46d61bd2a2aca2f6fcddf325a4556eb181ce8db9f3826ead", "structural_hash": "dc8ec2de4aad46383a233f7002047265f8cbbffd36426b561d89fa4901b51560", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_25383.go", "upstream_id": "BenchmarkTest25383", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvar data string\n\tfor _, token := range strings.Split(dbValue, \",\") {\n\t\tdata = token\n\t}\n\tcipherOut, _ := rsa.EncryptOAEP(sha256.New(), rand.Reader, &rsaKeyPair.PublicKey, []byte(data), nil)\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"rsa-oaep\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "665827b5f9a64711bdac5dae5c373625386eac96f660da495a028346e5b1a3d2", "structural_hash": "40e672195096df936139da24715196caf16c1632f4b773bb76dcbc65ec2c6d2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00349.java", "upstream_id": "BenchmarkTest00349", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(pathValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n java.util.Hashtable env = new java.util.Hashtable<>();\n env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");\n env.put(javax.naming.Context.PROVIDER_URL, \"ldap://localhost:389\");\n javax.naming.directory.DirContext ctx = new javax.naming.directory.InitialDirContext(env);\n try {\n ctx.search(\"ou=users,dc=example,dc=com\", \"(uid=\" + data + \")\", new javax.naming.directory.SearchControls());\n } finally { ctx.close(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "814b7dd84c07711c11e9625a529309a29c7c6b297d5cbfecd33a4f57a6b3d51c", "structural_hash": "77470f40a408f4403cb892620591dfeacb716334c89dec0f65105cf555867549", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03444.js", "upstream_id": "BenchmarkTest03444", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(processed, 10);\n const value = buf.readUInt8(idx);\n res.json({ lookup: value }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd0d2a2a57953bb592ecfbb86c4918bfb2e02700c6b26a6efb1006134d8a5696", "structural_hash": "fe7137fdfa2ba9a79d400963dd262b27866c198fb15394924df9eb1f4fd66a83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05831.rb", "upstream_id": "BenchmarkTest05831", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n Net::HTTP.get(URI(data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc9c5e7c7a180d3cd1b2e686d5de79674a70c56bc4689b5c3d8a1259dab160c2", "structural_hash": "9e4e4dcfc941bbca8bbc7819c30edceb023597dbaca4929f411d198235844ed3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02125.cpp", "upstream_id": "BenchmarkTest02125", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n if (data == \"admin123\") std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5accd52174121d237b19549b09b7b84715565f0f50b08ea0720541bc17c0e579", "structural_hash": "47ff2eb27e97e0b7f0cfad0336d6f02f2c1994caf308c621a033977bed68e648", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00836.php", "upstream_id": "BenchmarkTest00836", "language": "php", "code": "json('payload', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n return response(\\Illuminate\\Support\\Facades\\Blade::render($data))->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "654b01a6b186d5f7bd6a35d0840cf03641bd69eb5df331e26e83c4d9963501f0", "structural_hash": "f455ff117a829f99c88d7859727c451f4e52bbb1cd026ece0f600c9fee3bb2db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01869.cpp", "upstream_id": "BenchmarkTest01869", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c364fa3d293dd8722d1bede62fac36fd364a2bbaaa72becf185ad5ee9ca4837e", "structural_hash": "f8063f0da2e0c06c3e93ad9199a2382126c452aebe1f1557772527f412f268f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12380.sh", "upstream_id": "BenchmarkTest12380", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n printf \"%s\" \"$data\" | sha256sum | cut -d\" \" -f1 > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20fbdb9de81d928a2cb13721a4f25d5f5256917fda078f376832c7650a7e2b35", "structural_hash": "eb126c1ae3c756c4a8971f9a25aa05343ccd87f7b0480959eb45abcdce9c56b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00483.c", "upstream_id": "BenchmarkTest00483", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e88ddc9c24e5f044d461e1fa4f565c0f537804ac71abac570a7250b2f5ca8fa8", "structural_hash": "218ff29104cd4d81a2c4c3e81bbc032aab5647644e65685623e25bb838f1c52b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02256.php", "upstream_id": "BenchmarkTest02256", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $data = ($userInput !== null) ? $userInput : '';\n $result = DB::table('users')->where('id', $data)->first();\n if ($result === null) { return response()->json([\"error\" => \"not found\"], 404); }\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7711e8cd7a17f7d75de17c6444c315327c247a9f66a8e70bffa16f1996f95d4c", "structural_hash": "18b6c169eb4ce86f4026d923790342bdb6e11acbdf4b56da7ef1283c4f9a8099", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05635.py", "upstream_id": "BenchmarkTest05635", "language": "python", "code": "from django.http import JsonResponse\nimport json\nimport os\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n try:\n data = json.loads(header_value).get('value', header_value)\n except (json.JSONDecodeError, AttributeError):\n data = header_value\n entries = os.listdir(str(data))\n return JsonResponse({'listing': entries}, status=200)", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa7d2bfcf317d0b98227563707d9b0f93b53953741c8245ea2e73227bb80167d", "structural_hash": "486f87a899cfd87a01379853a42a7cb3dc0effd6bccf3775d5efeb83acd85fd5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05006.rb", "upstream_id": "BenchmarkTest05006", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d599a2edc3bd8a5b468f1b015aec156db0066b161da42a2bf9d089389b81994", "structural_hash": "ecc7abb377f7e285fd1fb84e38b5d5b6da4d03017d1541b42c7f5704ed591741", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_30701.js", "upstream_id": "BenchmarkTest30701", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f0632a46ec606fb07e6927d005bd76af5355e7e19fa8d76dfde4dbffd010223", "structural_hash": "d24faa1f8657ea63c8734e629321b69de08aa72fa8e63397e25ef1d663c26659", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00183.ts", "upstream_id": "BenchmarkTest00183", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d411c88b8458a9ce36389f0d4fb6a4a65de44e736988df37cd2d7f989e0d6772", "structural_hash": "64771a0b1c1adcbb1265dce175e86ecd34450232b6c613262953eb3602946437", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10570.go", "upstream_id": "BenchmarkTest10570", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tsegments := strings.Split(fieldValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tc.Header(\"Session-Lifetime\", \"1800\")\n\tc.Set(\"data\", data)\n}", "label": 0, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e18efb9301b8002fedadcee671e36efd0643ae7c779c76da4082b2503898fb95", "structural_hash": "ce2937491bacfec36b2903e627cb2b95db4180d172e41a46a4d8c4e1b52665d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20811.js", "upstream_id": "BenchmarkTest20811", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a08b2f42cac805612c4558f9a69d0ed4db8a52e83368dd4c1313bf7e9b0f0fac", "structural_hash": "17e5a4922206a5e59a5a3145e813e373744e357acf306bc521b396f8c7d5ef0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24208.go", "upstream_id": "BenchmarkTest24208", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tcapture := func() string { return dbValue }\n\tdata := capture()\n\tdefer func() {\n\t\trecover()\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 1, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99ea5fcc4efa6574466f7bd503f5ef71ef7596927256560ca5c40dd59f16afcc", "structural_hash": "fd667844feab754e17d60bb143619e2ca98a1e19ba7c5d10259d3ba628520ad1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02412.ts", "upstream_id": "BenchmarkTest02412", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as ldapjs from \"ldapjs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const data = String(userInput).slice(0, 200);\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + data + \")\", scope: \"sub\" }, () => {});\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f93bac35eb2b6449480a1c94ab7681afa7efc4cd719d2c27fd9e46e0024ea6d", "structural_hash": "c1e9128f0ca8625070e30a4fe67d88cf88ab3308222ce286a87448d69842de03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02872.java", "upstream_id": "BenchmarkTest02872", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : envValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { response.sendError(403); return; }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n response.sendRedirect(targetUrl);\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "879c209e095506b5fd5fe3e139b736a1af685ad8c4393933f799fa3d9094e14f", "structural_hash": "2aeb15cf5c31de7ad95880685c4466e31bfe209a1eba46658d884159239c7d87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03654.py", "upstream_id": "BenchmarkTest03654", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n data, _sep, _rest = str(host_value).partition('\\x00')\n db.execute('DELETE FROM accounts WHERE id = ?', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2ce3aa01eb601a89ea3d8d0cc48a9f168b82f6c7dcd6dcc5bb69ce4874fb198", "structural_hash": "583322f7c3e5bdd0ed4c84fe70de14818ca508de892ee6dd54a122d10711563a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25137.js", "upstream_id": "BenchmarkTest25137", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n res.cookie(\"session\", _ct, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-315"], "category": "cleartext_cookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d5603694a2abd7ec22c54b74bfc6093b8745582856296bd5757f49824e76503", "structural_hash": "6535494b0e731f681a9145bcbc8b0084eff78cd2c49749dba824a0351bbdf95c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05671.rs", "upstream_id": "BenchmarkTest05671", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(auth_header.clone());\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0fa25bd20b8cd0e0ac4265ba38da9caafbd8a9b16bd743ed47032a2f65a5788", "structural_hash": "56718cca4a90634b9d8adc42dc05285ddb0cd0c0943138446fc9b63f96af0056", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00302.go", "upstream_id": "BenchmarkTest00302", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tholder := InputCarrier{UserInput: fieldValue}\n\tdata := holder.UserInput\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "482e5bfd0b12ef5e052c25f8d70ac67faa685f26f36041f63fbcae6a76a942cd", "structural_hash": "8f4dc03dc8c1c35013391143fd455a8094347adb16a603cb67ea84eb4cca1b6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22238.c", "upstream_id": "BenchmarkTest22238", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9d7b45994eef1d2d8a33f41b555e3df8969d795715ae709a75a8311b6e1b32b", "structural_hash": "ec5edf7c83323cde01fba078c623439716ebfec28426599e923fd764dd3087a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01191.py", "upstream_id": "BenchmarkTest01191", "language": "python", "code": "from flask import Flask\nimport html\nfrom urllib.parse import unquote\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n data = unquote(path_value)\n processed = html.escape(data)\n return '
    ' + str(processed) + '
    '", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0a41d28a01205a2b953bc11e6ec2ea5871848fc9e292a1e65233c69805969b6", "structural_hash": "67ead02efae58691c3b73ac344014c39d874f2cf9f5dba3c9a9c5731cc9bb40e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02207.ts", "upstream_id": "BenchmarkTest02207", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = await Promise.resolve(userInput);\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n res.set(\"X-Custom\", processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efee4210e7147bde29a4b9ecf1fa3d7b681210b77440206700d62e84fde0b5b5", "structural_hash": "0e0af4906ae470ed412dbc6554047d7fb8747b821af2ac61c6f3b798dbf04032", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_38917.js", "upstream_id": "BenchmarkTest38917", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const data = \"\" + userInput;\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4246b5dd5627b954c2678211d7c72afdd78895870a4c772191568897b3ba0ac3", "structural_hash": "eef5f412d81e4d14e4d8a3b2a5d7d69a2298924ad91e7b25f01a4ce515ccf4c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03680.ts", "upstream_id": "BenchmarkTest03680", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84407b22b080278cf592abe3ec9749e7bb6027658f3e13bc8e087b3408aa2591", "structural_hash": "6f939f82fc39b6ea8e9d260c8b14a4755c479caf8cdf6ddeafb01b543b9c1149", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03452.py", "upstream_id": "BenchmarkTest03452", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n data = handle(graphql_var)\n db.execute('DELETE FROM accounts WHERE id = ?', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82c29f1cf0d2404bdee45fe1e5dfd9c6370dd561cbda767358c8a840f7717aba", "structural_hash": "0124620036525956dbd38ac696f8b7de9f391f42dabba37245f8ed950056979f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03959.java", "upstream_id": "BenchmarkTest03959", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = String.format(\"field_%s\", fieldValue);\n if (org.springframework.security.core.context.SecurityContextHolder.getContext().getAuthentication() == null\n || !org.springframework.security.core.context.SecurityContextHolder.getContext().getAuthentication().isAuthenticated()) {\n response.sendError(401, \"not authenticated\"); return;\n }\n String oldSessionId = request.getSession().getId();\n request.getSession().invalidate();\n request.getSession(true).setAttribute(\"rotated_from\", oldSessionId);\n if (request.getSession().getAttribute(\"user\") == null) { response.sendError(401); return; }\n request.getSession().setAttribute(\"data\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b790bd597d16270dac53b771952c2a4db8a55541dac7810d587b6a0f0b7d5c0e", "structural_hash": "a9f47e2c5b8803be2a71df081ca39103ae62e49f0182240971112dcbc0a8bea9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03920.rs", "upstream_id": "BenchmarkTest03920", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = cookie_value.replace(\"\\t\", \" \");\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06f2f93d2329d5dfa3162604a788c8e78e8648c667e2c8a072ea55f208dd3257", "structural_hash": "fa448b9889f50bb9ec434e29a12cc23e62fe992c42933c3411b16b001b34fa6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01351.php", "upstream_id": "BenchmarkTest01351", "language": "php", "code": "text;\n $data = (!empty($userInput)) ? $userInput : '';\n $processed = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "899e8a2e88361fe209f793f37c52c41fa94b34a2ee96e51c853d89044771b018", "structural_hash": "9149155dd2b6b2b5a6d459b5d8a44bd5da3f8e8c1be6a47dc52bdaac717c8a14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04897.py", "upstream_id": "BenchmarkTest04897", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = RequestPayload(cookie_value).value\n db.execute('DELETE FROM accounts WHERE id = ?', (str(data),))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "757015fdd8dd4665d4e775b3c8ed3f93d66c4fc25c1b31bc38f7cbe1491f0380", "structural_hash": "0da8329fa698ac299d64ab9f90ec5ab8ca06c7e663e7b2b09014f27d0328d73f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01478.cpp", "upstream_id": "BenchmarkTest01478", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d160d01533c58dcd88e159f083e4b715ad5aee507b9678bb22724d03a7e5692", "structural_hash": "546151fc08286b80f0ce20555ca9cccedaa0607b72392d7f5d96eb8756a5daf7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00190.cpp", "upstream_id": "BenchmarkTest00190", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n std::string _truncated = data.substr(0, 64);\n unsigned char _digest[16];\n MD5(reinterpret_cast(_truncated.c_str()), _truncated.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcc848d8fbe15c2c57a973f1417b0c4f2d9ff468294612740f41ed2160f70b19", "structural_hash": "a1b76923f70d8aa8a4a297074ddadc2daf810ed447ef5f6ea4a6a3aef1a22d6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22959.js", "upstream_id": "BenchmarkTest22959", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const processed = data.length > 64 ? data.slice(0, 64) : data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e65ec6f71b5ef56d122ae9356d28194780aab305a0893e13898d203c6690614", "structural_hash": "7e1c100f8c0ee7c81ece0b94cf04f4495e0ce2c283d541f2a8e2f305a68d1280", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05658.java", "upstream_id": "BenchmarkTest05658", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{headerValue});\n String escaped = \"\\\"\" + data.replace(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n response.getWriter().print(escaped + \",data\");\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "588c7fd9592133c3f95b938d97cff14cc3ec004f7ad831b2198110519d8a6490", "structural_hash": "5af18d256a6d0ad071cdece5a27244054934f620d4299b3ba4de627b15e7c2da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00705.rs", "upstream_id": "BenchmarkTest00705", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = host_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => host_value.to_lowercase(),\n \"f\" => host_value.to_uppercase(),\n _ => host_value.trim().to_string(),\n };\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1deae5760909bb987782acfc452ef8af064276c72f6ecab61378b18756126365", "structural_hash": "1157b7473febf98a979064a999cfae6a305d4f005fbbfde6f664ec7ea4f9d9de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05696.ts", "upstream_id": "BenchmarkTest05696", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = referer || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n res.set(\"X-Frame-Options\", \"DENY\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9d0cca9196e354a416def6c268eceb59ca798e67e7fe768495f64b66ba34533", "structural_hash": "baf8d5c1c2c6ea83ea9fc5b8c190bb73c776db7c93ad67b74bb76ea8b917f826", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01886.rb", "upstream_id": "BenchmarkTest01886", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless session[:csrf_token] && Rack::Utils.secure_compare(data.to_s, session[:csrf_token].to_s)\n halt 403, JSON.generate({ error: \"csrf mismatch\" })\n return\n end\n DB.execute(\"UPDATE users SET name = ?\", [data])\n end\nend", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e7138dfd6758ce62685b4ed566feaf981f95711e327c7cd1a992f655efd8da4", "structural_hash": "0437bc86ad3919473dbd7d948b4de098c0f2f7d11a20d54e900ff669f43c9bff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00312.rs", "upstream_id": "BenchmarkTest00312", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let mut data = String::new();\n for token in env_value.split(',') { data = token.to_string(); }\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "312fda42834d25045e808dfdeb64e9a6d438cea8188ae95b0f5bba2d909ff0ff", "structural_hash": "e34d8f32c581d6900f031b7cc1c430994bc6cdb25d8e6dbfbf4ff29250d89f84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14957.go", "upstream_id": "BenchmarkTest14957", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", graphqlVar)\n\tdata := _sb.String()\n\tlog.Printf(\"User action: %s\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf848e80be917275427f5baf201f27f93b37435d6ad6db9edc25e3ff5da688d1", "structural_hash": "b09c09494831ca0ced1349636dbe1fb1b620537ee1cbc0dfb8760914bdba61e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03807.go", "upstream_id": "BenchmarkTest03807", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tvar data string\n\tif hostValue != \"\" {\n\t\tdata = hostValue\n\t}\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\tc.String(500, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11803c074b08cbd6cdca1b637fdd47e12c2de6a066fe74f7f6a03e3d8526821b", "structural_hash": "8a05702e7ed2967fefc60375b3f34c64d03dd25a30d86b4ade5feb4e3bc6208b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01115.rs", "upstream_id": "BenchmarkTest01115", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let dotenv_value = std::env::var(\"DOTENV_VAR\").unwrap_or_default();\n let tokens: Vec<&str> = dotenv_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f2f0ac8e2474beae7bc88455e8622be87339dede628deabccb101029586430c", "structural_hash": "5dda5b836909ddeea27fcec649448cce206d4f0b9d6c5f981ca2305ec6607587", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15187.go", "upstream_id": "BenchmarkTest15187", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tpending := strings.Split(uaValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+processed), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a346a26e0e359e5f34a03be75ee4bc55ddc9a162639e6a195bacbcb11495ae9e", "structural_hash": "a17476c8d52e3c780fd48eafee720f5183622f95db891abd09cfb185cd1cdffa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01735.sh", "upstream_id": "BenchmarkTest01735", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d515068076a4930e050a06fc847c963d5399b71fd16abc33fdb542a1dcd29d9", "structural_hash": "cfa0a3a190fc6e78380c04efd9c2e85274f66cacdaf121c4941270e2c442feb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33047.sh", "upstream_id": "BenchmarkTest33047", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\" >&2; exit 1; fi\n requested=$bounded_val\n if [ \"$requested\" -lt 0 ] || [ \"$requested\" -gt 2147483646 ]; then echo \"overflow\" >&2; exit 1; fi\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8bddc4abac0de770b2f55a15e8662477e60e5cfeb3aef75c24d4d83b1010afd", "structural_hash": "a34a6d84f36cb81e5c33cf592b493e64c439b73343d63ee27f876e380aa58ca9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03298.rs", "upstream_id": "BenchmarkTest03298", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&header_value);\n let _csrf_token = headers.get(\"x-csrf-token\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if _csrf_token.is_empty() || _csrf_token != crate::shared::expected_csrf() { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2f0259aeefd877f6ad67b1f4dd63b96cf0ef7f955cd4fdc9d0490707c6aea71", "structural_hash": "84a3db4d0ac02394052945f710660699b03d453f9428a2fa679a07eeed1b2b15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11780.js", "upstream_id": "BenchmarkTest11780", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "567a39a1b967c89849d098f4678c80882bb93c60e32f62960cc067b84265e5c0", "structural_hash": "353cc0700ba6c0b4ab376dcae289fa8d393852b8b3669f6dbf344fec1e6ced3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_27648.go", "upstream_id": "BenchmarkTest27648", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tpending := strings.Split(pathValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b637a0789be5b639b2781a5e8d48b97dd2aabf199bd36ce86ec28543662a0de4", "structural_hash": "69594a85c475703f7d9041c9ca2940da31e40b9ebb9d9bc628ffdac4afcb7d0d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19708.sh", "upstream_id": "BenchmarkTest19708", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n mongosh --eval \"db.users.find({name: '$data'})\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38ea976db8bb52081479d4a03e65c9881c134b64a04c2c7c434bfc2014c47830", "structural_hash": "a0d1f9461320d466dcb9d903a7158134e5d69dcf20194fb43dcf16ea0a31b72b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01510.py", "upstream_id": "BenchmarkTest01510", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom app_runtime import auth_check\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n data = '%s' % str(env_value)\n auth_check('user', data)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0c4448167de63b3cfe36de9753debb2eb9170d520c996ef0d9719dcb4f4f6f4", "structural_hash": "2fe028872c9c73bdbea05771399f8ee3d1720f278a5e03cae5f9de9cef0db275", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02160.java", "upstream_id": "BenchmarkTest02160", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : rawData.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.KeyGenerator kg = javax.crypto.KeyGenerator.getInstance(\"AES\");\n kg.init(256);\n javax.crypto.SecretKey key = kg.generateKey();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f022ab6c04fc455dc064f8a30bf982a6b54c25854e8641690629af41571838f2", "structural_hash": "03569685ea03655de5cb82b03f6d87bd393c150f552f53a628c38547e97bf154", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03363.rb", "upstream_id": "BenchmarkTest03363", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n data = user_input.split.join(\" \")\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31eee9d4987058a8b6f3c1263599fee7364c137f6f3062a0c8390cbc6276f885", "structural_hash": "5b23deff3c018d2b44db79ed0a832f206048c5a77a5ea1c1a3674610368eccbb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33366.sh", "upstream_id": "BenchmarkTest33366", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n normalized=$(echo \"$data\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$data\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b9239e24df4e85b4f7fc445538d92030d9519a9b021078f48723f92e9c06f42", "structural_hash": "2a9c2328b5c12badb4cae69ea0902d6dc281a4c802544117764e8e5f147cea84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05089.php", "upstream_id": "BenchmarkTest05089", "language": "php", "code": "header('Host', '');\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $userInput, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c29a906a96b7c1004134cfdff1994da1832cc571a61725a8f3dcf60df23036e", "structural_hash": "cd6b6802db94e1d6d7bc9a3c1f44344b06ff8769997cdb28f9d8f64d2936e0e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05646.rs", "upstream_id": "BenchmarkTest05646", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (payload, _origin) = (host_value.clone(), \"http\");\n let data = payload;\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79614ad9ee5062867f37e78210d71933c46e7f23dc1a643595388dfd69f0963b", "structural_hash": "b40143d4011989e3656c029e0bf14994ad583cde4c7c766975ae9038deb2d3ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04645.js", "upstream_id": "BenchmarkTest04645", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!authzCheck(ctx.session.user, data)) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f13eb17384aacd05d61e3151582484121dc6f9bb714fbead557488ec7e716b6a", "structural_hash": "55c43567c2fbc45a3abee08e7aa014a3727ac4043ffd78eaf0d473858e3f67c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04477.sh", "upstream_id": "BenchmarkTest04477", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7933bbc1678f06532e4b785cdf3cf8ef6e8e2165c03852eb2bf3c3a019747deb", "structural_hash": "743e2156e83a86b04789bb0974a9bc2a38cf6efb1049bd3493330c6e1cebb445", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21871.js", "upstream_id": "BenchmarkTest21871", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = `${userInput}`;\n const cell = /^[=+\\-@]/.test(String(data)) ? \"'\" + data : data;\n fs.appendFileSync(\"report.csv\", cell + \",ok\\n\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aec961b767933e807d71538e2625c0c7fd3616335dd9a451bf6d8da1ce0815e9", "structural_hash": "98afe368a514a3ecab08b6442282766daebcadbb980ac94c0aace643ca146b1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04618.java", "upstream_id": "BenchmarkTest04618", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @POST\n @Path(\"/benchmark_case/graphql\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(GraphQLRequest req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> graphqlVar)\n .thenApply(v -> v.replaceAll(\"[ ]{2,}\", \" \").strip());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ecf012ef5126ac6bdfeed2c6511f86ac9a362aa0954b8a4d48aad0fc0dc6750", "structural_hash": "a723116a603ad5c4a2ec16f5fc25f31f9fd93e8987b0cdceb0a0436aa4956878", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05326.java", "upstream_id": "BenchmarkTest05326", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String prefix = authHeader.length() > 0 ? authHeader.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = authHeader.toLowerCase(); break;\n case \"f\": data = authHeader.toUpperCase(); break;\n default: data = authHeader.strip(); break;\n }\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4f9d97f9a3c376b77a96ff2de5fccb72f052bb44dac5ed2c52c025b68734514", "structural_hash": "fdd806bfb865b1d297dedf12ae9495e34918d2f8b02400f568f2bb9de5b0f63f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01297.java", "upstream_id": "BenchmarkTest01297", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data = String.format(\"%s\", hostValue);\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0084647d0daf00780114b8461df0d789e9a0b9034f75aa0d1e4b3eca58173eb5", "structural_hash": "248fe6608db881234061597ad499fe92caeaf5c9faf2ee8a8f8dcf2ae6d5d166", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02505.sh", "upstream_id": "BenchmarkTest02505", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n printf -v data \"%s\" \"${user_input}\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\" >&2; exit 1; fi\n requested=$bounded_val\n if [ \"$requested\" -lt 0 ] || [ \"$requested\" -gt 2147483646 ]; then echo \"overflow\" >&2; exit 1; fi\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0fbcee9ae59267d63643c3a4d4c97ea496940241169eef046f2aae545ba75141", "structural_hash": "358812b359b0127514e1df49e37d57da26d36dc34cc97876382adb25c32d16a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03562.java", "upstream_id": "BenchmarkTest03562", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> rawData)\n .thenApply(v -> v.length() > 256 ? v.substring(0, 256).strip() : v.strip())\n .join();\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b3c8aaebf7316b7b105152e037d569fe7d4be6208addeea14ec246425722138", "structural_hash": "8aa0d4be08f45548eea5a656966022a218c2c8892d3d9550ed424ed6cd6e62bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03923.rb", "upstream_id": "BenchmarkTest03923", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef1015db4739cb666b9f22998a54111e41b40025ce7902bd57e627b7f871e561", "structural_hash": "eac48fc94a26630603632d2bde03956742142c73361ce90242335a567f70cb04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09845.sh", "upstream_id": "BenchmarkTest09845", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=$(printf \"%s\" \"$user_input\")\n eval \"echo $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "862bd242d0e239c500ee963df9ba2628db343c64bb068166a4ec8ae8afef7d35", "structural_hash": "9abc71a776b0ad6ed738dfb3f3887dbf970aab6ee5335f88772bba4115e4aa42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00058.py", "upstream_id": "BenchmarkTest00058", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom app_runtime import auth_check\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(user_id)\n data = collected\n store_cred = os.environ.get('APP_SECRET', '')\n auth_check(str(data), store_cred)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f26afd73d87f257953bc53e58ed00cc617d8ebaee24bf587b377d6cb93c99f2", "structural_hash": "3eb00f4276157edd864852cfaf8e4c270b3f1bd52ef41aed0ab4c56e13f09461", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01172.py", "upstream_id": "BenchmarkTest01172", "language": "python", "code": "from django.http import JsonResponse\nfrom dataclasses import dataclass\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n form = FormData(payload=multipart_value)\n data = form.payload\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a54c708096b7c2b5926007d52dad3a8dfaf63de4228abb107359b4997be290e6", "structural_hash": "9c7ca92bb17e79dc5cbd6236902e3f555819551541a0303b77b59eb487798f97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00925.java", "upstream_id": "BenchmarkTest00925", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(pathValue)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { response.sendError(502); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f0a6e81d4ab75fdd69584db7f5d5468afda83b16f26f02fbb76ca7025cddb12", "structural_hash": "99be15d330a48857c436b2cd0f2da86b7a652801bd6d4656a44fb1df29187582", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32711.sh", "upstream_id": "BenchmarkTest32711", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n case $user_input in true|false|0|1) parsed_bool=\"$user_input\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n logger \"Action: $parsed_bool\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af4f2cf6e23e01a87a50663084b85c8b990d5bfc5f34a7be0c69d1d3c06151be", "structural_hash": "58d7b6b6c9a8e3166de0fd807f66bfa2598db6b3c8be7c2d367acfd7104d27c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_05268.js", "upstream_id": "BenchmarkTest05268", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n const _handlers = { primary: () => {\n const fileContent = fs.readFileSync(\"/var/app/data/\" + data, \"utf8\");\n ctx.body = fileContent;\n } };\n _handlers[\"primary\"]();\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "186ba89e2cb4e946e12a3ba25507374edc1ad68234a60d48308ea0851080aeb7", "structural_hash": "5b3b6877788f3ae41eff3757263742c0a99609d8e3dd37a4083605e77b8cba8a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32200.sh", "upstream_id": "BenchmarkTest32200", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n IFS=\",\" read -r -a values <<< \"$processed\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bad9d7821d4c7d64d74ec231c00463ba38e784ce7a720f7fe1785f0726e20783", "structural_hash": "6d1249006e2cf449523ae59c4733a8fac9fa7fabd66f449bc6e823ec305ebced", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04323.py", "upstream_id": "BenchmarkTest04323", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nimport json\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n reader = make_reader(json_value)\n data = reader()\n digest = hashlib.md5(str(data).encode()).hexdigest()\n return JsonResponse({'digest': str(digest)}, status=200)", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04526f1dade041228454838aa1a92e02a37c9961b3664553a0f5a1dd5df3917c", "structural_hash": "e959e7add08eb07afb7b3d2cfcd19c00de3c526491603dd62667ccbd6398ee62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00358.py", "upstream_id": "BenchmarkTest00358", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nimport os\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n data = f'{auth_header!s}'\n key = os.environ['DATA_ENC_KEY'].encode()\n encrypted = Fernet(key).encrypt(str(data).encode())\n with open('/var/data/secrets.enc', 'wb') as fh:\n fh.write(encrypted)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83595beb2d232175ca3f8fe49fc1dc9801cff61a116e9204484fee089ad34d5e", "structural_hash": "e71ec99206a817e668e26f12148d88fa2299b9c77c8267207a8df8040a7b5233", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01628.py", "upstream_id": "BenchmarkTest01628", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\nimport json\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = json.loads(graphql_var).get('value', '')\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(data) + ')')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "012961dae5439253dccba523c4e70c49b176d52673f5ea022493ef3c0a190767", "structural_hash": "b507897aa0c13b649cde464c2446a209cb7e717c66a6a8ac61c5ff5c30ce6cef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08273.c", "upstream_id": "BenchmarkTest08273", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _resolved[1024];\n char _joined[1024];\n snprintf(_joined, sizeof(_joined), \"/var/app/data/%s\", data);\n if (realpath(_joined, _resolved) == NULL) return;\n if (strncmp(_resolved, \"/var/app/data/\", 14) != 0) return;\n const char *safe = _resolved;\n FILE *_f = fopen(safe, \"r\");\n if (_f) fclose(_f);\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "406d85360e07ad05820ae00b31ae8319682780c905dd80846edc748b88a3fb1c", "structural_hash": "a3c057f1dea23e6c0e66a29e007243a8e62078c1f92d8bd9a6ea8a05a76497b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03964.go", "upstream_id": "BenchmarkTest03964", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\t_prefix := \"\"\n\tif len(authHeader) > 0 {\n\t\t_prefix = strings.ToLower(authHeader[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = authHeader\n\tcase \"f\":\n\t\tdata = authHeader\n\tdefault:\n\t\tdata = authHeader\n\t}\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tc.JSON(http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3edcdbfeec59136a4afaf356bfd3a3735698b1cf23401040e7063d4d02367131", "structural_hash": "6bd703ff8a89b97edbaa28ca26eeba9bcdf067b160ea3a35dedfe7e8ba974885", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13086.go", "upstream_id": "BenchmarkTest13086", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := fmt.Sprintf(\"%s\", authHeader)\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := resolvedPath\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09a6d1e856d57a7e23c244038cf24d7636c3ab6d53e86f433404f33fbae70665", "structural_hash": "5a46fcaa22096d31adcef9cb2e60df2f96bf7bf9403f8a40da3936647d223e20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03896.ts", "upstream_id": "BenchmarkTest03896", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9dd95340a350308ac09ac8b7f0aca361b5fd2ebfb1b1ab91b910ea6805b01675", "structural_hash": "7a76aa54f71f16aaa8841af9ed1494fd2f9310318134316bb0799ffa202a34be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03520.cpp", "upstream_id": "BenchmarkTest03520", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::string _truncated = data.substr(0, 64);\n std::cout << _truncated << std::endl;\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0b6c3150fb142ed193a53337cb394e09b979b8ee72aa5f67b861a388d9601d4", "structural_hash": "12191f9cfd2d83f28911d3d2d8b5d431d4a5a15c0f5b26a30e3602ded804bdd2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02381.sh", "upstream_id": "BenchmarkTest02381", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"${user_input:-default}\"\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4130006ee05881acd888eb8be88cc632947ab58acf1439b862ac0b37980c883", "structural_hash": "1f1b036fc86f934f78ee5d86c4270a2c5e2b2af0ab3e7c8cd6446206fd24e697", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04300.rb", "upstream_id": "BenchmarkTest04300", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n @user_input = user_input\n data = @user_input\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97ebbeb59b01cd65bae02dae86bd32bc532b99bb2607a0853805e21016a79860", "structural_hash": "312e9df0e26a5e6b0229d01ececd12a3caa55ad1fe49b5549473a58fe47881e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05531.rb", "upstream_id": "BenchmarkTest05531", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = \"%s\" % user_input\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n content_type :json\n JSON.generate({ wrapped: wrapped })\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c2bd3bc5f43a3c0a91923b5500433ea6316ad08f36e58bd81067de4779854fc", "structural_hash": "f8bd20b586d229134a39fb25da12a42a3647d568d022d48e4a9b198c3df3ede6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05289.rb", "upstream_id": "BenchmarkTest05289", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"app_display_name\"\n data = format('%s', user_input)\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n render json: { auth: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efd4c8ecad9d62472840d6487df9db563a39ec1bce9e8c863f5f9cdb478dd7bc", "structural_hash": "b4ba4a66e1b4cd4427e7886a39f5146418ce69a51442338f94188ed3210ba226", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02815.ts", "upstream_id": "BenchmarkTest02815", "language": "typescript", "code": "import { Body, Controller, Post, Res, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = dto.payload;\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb2e266a4e4409449ad3300a2bd728b5afabefe7903ec75bbce6b773c6729cf0", "structural_hash": "f820a120c7cf4e37e4604adb451d363e647b78592d2845229a37eaa809a7ae6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02440.rb", "upstream_id": "BenchmarkTest02440", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = format('%s', user_input)\n result = DB[:users].where(name: data).first\n return halt 404, JSON.generate({ error: \"not found\" }) if result.nil?\n value = result[:name]\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8ebd29c440a7eea5975e1050493f32a7e7c6da0f790b58aac252d523c18c42e", "structural_hash": "473e07511b241c6d96ffd8544b13d653db15a99f38a80fac1bd970c35e41a0ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04248.py", "upstream_id": "BenchmarkTest04248", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom pydantic import BaseModel\nclass UserInput(BaseModel):\n payload: str = ''\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n reader = make_reader(json_value)\n data = reader()\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63f960a2994f6f1046dce64484c58c82fe1455020430f30d9b943d2e8c3f6693", "structural_hash": "cf70eae395a081f778264f1e101c481ab2c38228be1a7460efe9cb9934586389", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11280.sh", "upstream_id": "BenchmarkTest11280", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n printf \"%s\" \"$data\" | sha256sum | cut -d\" \" -f1 > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8f00fda5a6615e40b9fba3cde026de8c56441dc03d7fa4570d9881a1c75c41b", "structural_hash": "66d74343e9acb4c6df0f6859f74a13b73f7ab15d6b7f06c4c267d7041d17cd2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15230.js", "upstream_id": "BenchmarkTest15230", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81e94df5143d750348b5be87039f50e1f2118edb5f46d831b2968d917a100a70", "structural_hash": "8b985004561e97b5acf47d78dab98999b16ccdc44291438429d8e5b27d02ef88", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03734.rb", "upstream_id": "BenchmarkTest03734", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n data = \"#{user_input}\"\n unless session[:auth_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:auth_token].to_s)\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e493df60c15b6c11c526585fd546de833f225d9cdef6dbdda18dbca44056d529", "structural_hash": "963c8f7b20269e979e3acfe969e7a2aa97c73a23c11832037d3dfa2f9f25ebee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22074.sh", "upstream_id": "BenchmarkTest22074", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c42c3e8a5e149c70765aab7c0f36f854fe1126eb2ad68f1546a2b9b99fef48c", "structural_hash": "a635ab22d29a63e6a2362e52ee73d06fb3082622cfdf4bb0a6475ae5efd1cce5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_39021.go", "upstream_id": "BenchmarkTest39021", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar data string\n\tfor _, token := range strings.Split(rawBody, \",\") {\n\t\tdata = token\n\t}\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\thttp.Error(w, \"access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := resolvedPath\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96758ce2306043375c1769f2fcc457453d81fec0c85e5d2399eedbd65d8dda51", "structural_hash": "295a60bbc0bb144f627b070a0420b874e1761553d97c9493d1d2fa8490dc3a3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04992.ts", "upstream_id": "BenchmarkTest04992", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const data: string = shared.passthrough(userInput);\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc05c844a91414a7ceb83a4da6f7eea4c797cdc03ffff549af048c66d0f1d6c8", "structural_hash": "b34a42ed01fa18e649a2163196cdc7afd328bffd411b76a4d22726c9c736eafb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05574.rs", "upstream_id": "BenchmarkTest05574", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse ammonia;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n for token in json_value.split(',') { data = token.to_string(); }\n let processed = ammonia::clean(&data);\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fabc665ea3b9a737cf185a7bdff85951b72747c37522d624f3aeb750f37a011d", "structural_hash": "e5bfeeaf42370e6f7c0a669311be6b32f639d09b90496fec320fd5bc06a8c67f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01410.ts", "upstream_id": "BenchmarkTest01410", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n http.get(userInput);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4761d6d360df3b2424d2ebe18780191074dc4cefe22959c107ed1b2156f81ddb", "structural_hash": "d38bb30d2d40276ea8c1c59b0aeff07a70f16ccf51eb5a2d9eb0a94e0577581c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00015.py", "upstream_id": "BenchmarkTest00015", "language": "python", "code": "from django.http import JsonResponse\nimport os\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = RequestPayload(cookie_value).value\n os.system('echo ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67265df70cce21767a205a111045c2877d21dce4b46c01c05fa6f4f94f60b34d", "structural_hash": "01a08d363b6f0e65e82b88650f87e6f1f0d3497bcb3ddb44556ea5d5e1c293ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_10589.go", "upstream_id": "BenchmarkTest10589", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"html\"\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(rawBody), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\tprocessed := html.EscapeString(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "187c1e368a82b3417267eb335f0bdbb0b19ad136a4f3849af286dcb33d91841e", "structural_hash": "3ba542821988d2aeea7b68cda35b51c34571281b639da20a10af838cd1126d57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01307.ts", "upstream_id": "BenchmarkTest01307", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41db442dcb0c53a05b215451ac4042352b6c9342f7b32987581ce2456ab4bca6", "structural_hash": "383e04fdf6c91833dfa92fb46be7173c8bbf99eebff9e6a088858762484f0738", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02724.rb", "upstream_id": "BenchmarkTest02724", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n logger.info(\"Action: \" + parsed_bool)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af0369f45d43b51ae56e26a2f8bc66fb4e11b3d7258d495d0c51b7d6a2dd853f", "structural_hash": "d691486a0801aaa519616a0ee6e1dc56a11a8a0f842842dc273e03add99f4b56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00494.js", "upstream_id": "BenchmarkTest00494", "language": "javascript", "code": "const http = require(\"http\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.DOTENV_VAR || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56625bead61d40cc6e2d101118c8fcec90d18839478e0fcc252d4a3e64cdb2f1", "structural_hash": "d46072ffa7a7235e5bb5485b7936c25a4a4c52500902f0f384989e360fd3698b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13361.c", "upstream_id": "BenchmarkTest13361", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efd75e853e05d5010323518bf961dce3db05a05e03f9180f0934582b05a50244", "structural_hash": "d827a2574b95713568244783d8a6a85b6c82a24bfd39043f73e01a00e497d688", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_32134.js", "upstream_id": "BenchmarkTest32134", "language": "javascript", "code": "const { db, authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const fields = [userInput, 'http'];\n const [data] = fields;\n authCheck(\"admin\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b772a2f09280f27469679a48ca9c1e2f8fd7c695c92c7cce20bcaa8fc4fe0282", "structural_hash": "c492ab1345f71ed0aeba066b494f4996bc4f97ea3c0e237580500e3cf46a6752", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05277.rs", "upstream_id": "BenchmarkTest05277", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = crate::shared::passthrough(field_value.clone());\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&processed) { return HttpResponse::BadRequest().finish(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe69527482338d18b446c27d0b16eef6d8f92eaad5f3f989bb960ebd5d885833", "structural_hash": "577300d8c1cd3b3b100266f6b6e85671eec2c69abb73fb446bd4ac96ef7f7d24", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08436.sh", "upstream_id": "BenchmarkTest08436", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$data\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f26bb880cdfff519635d60ebee8e2b188d01fce20ed16d35de6d4e7c58b1d89f", "structural_hash": "b9caceef084fcd2822f1eec69eaaf4259dbe5ccaa1ae72d529a5e7754f1c8017", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03038.ts", "upstream_id": "BenchmarkTest03038", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a640c3d1058626d043458354f901d1006705fa0ca95484c079dc41121640122d", "structural_hash": "e3e3c47152ca4e22d11938de97b5ae3b45fdd4a7df35ba7d309b4fe9158e1286", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_32605.js", "upstream_id": "BenchmarkTest32605", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n fs.appendFileSync(\"report.csv\", data + \",ok\\n\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31033e0d0cd76e2a689b676ea6405123e8879215c7f18b53ae6564424f8b5fa5", "structural_hash": "f91b7c2575dde09aadc3741bb1e8d64cfe2c15f3b692de0913c735ec4ebc10c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07357.go", "upstream_id": "BenchmarkTest07357", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tdata := fmt.Sprintf(\"%s\", forwardedIP)\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71ddf3ce3a4734b9115b417c9da6115bdc01be5ee36c73f9cc4b6bc6b47cbf34", "structural_hash": "017efc807c4a7d28146fb68010623c58db2f41d3bb3355b4609b1e5d5bf88bab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37768.js", "upstream_id": "BenchmarkTest37768", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n require(\"./shared\").sqs.sendMessage(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\", String(data));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e503eb76ec7c6206cc68da533005376d3d18c4d79312e56d250cc0ee5eebada", "structural_hash": "1ac496520ba5c2fe45a8b2603eeefb22f4a29c2741710ec6d53e79ce9d2c297f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21162.sh", "upstream_id": "BenchmarkTest21162", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\" >&2; exit 1; fi\n requested=$bounded_val\n if [ \"$requested\" -lt 0 ] || [ \"$requested\" -gt 2147483646 ]; then echo \"overflow\" >&2; exit 1; fi\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb980c004ba8bd8e15516b664a9d68ce2b8aaaa0e9721272e6530894d1b590be", "structural_hash": "1b8b31c9a843db3724f62a9d5077fed2f7ddf3c4aa20aa884930cc7c3f8ec8d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03604.rs", "upstream_id": "BenchmarkTest03604", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = \"xoxb-EXAMPLE-0000-1111-abcdefEXAMPLEgh\".to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(secret_value.clone());\n crate::shared::db_connect(&format!(\"postgres://app:{}@localhost/prod\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc8b946206d6313e17f19c10355e1eb7150c5f0aa388a9af5cc920578a7b5b4b", "structural_hash": "74233561421752767d085a40f07f1e9f072ee4d340a4bdd37e0993bbf3dff850", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28581.sh", "upstream_id": "BenchmarkTest28581", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=\"${user_input//$'\\x00'/}\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n divisor=\"$data\"\n if [ \"$divisor\" -eq 0 ]; then echo \"zero\" >&2; exit 1; fi\n result=$((100 / divisor))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b2d421eb29979ed6394e120fd8c217ea609454ec5c25fb040d94aa114dcddb6", "structural_hash": "b4e85ac1edbc02cf35bef5209db05d4496354084db0d5889f92fca114dee4de5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03246.py", "upstream_id": "BenchmarkTest03246", "language": "python", "code": "from fastapi import FastAPI, Request\nimport ldap\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = '{}'.format(cookie_value)\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(data) + ')')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79fefa28fb75f88c8e9fabe9202b12a021f4ccf0b6bfe27e32097abe618db762", "structural_hash": "467d7308caa73ba507770708b705130799868ecc6019446ca06e49cc497b504d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05034.php", "upstream_id": "BenchmarkTest05034", "language": "php", "code": "cookies->get('session_token', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $trusted = (string) $data;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae91fc6619bae74ba6b017a410ce371ca1e5bc1645b12b6806a31747175a1be7", "structural_hash": "b4eed85f966e3afa20f482bd8b1e266a88abf408d6bc08fd253620d5be90195f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03958.ts", "upstream_id": "BenchmarkTest03958", "language": "typescript", "code": "import { Body, Controller, Post, Req, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Req() req: Request): Promise {\n const userInput = dto.payload;\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n db.execute(\"UPDATE users SET name = ?\", [data]);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d610022b08aad304c13808882c0bbf2ae8c46e8d63c3a7020a816cc3bb8c92f6", "structural_hash": "a7a699fc185ddef83f866f1d0c3df39b51d933a69d4144068b27086704c824f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14526.sh", "upstream_id": "BenchmarkTest14526", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n if [[ ! $user_input =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$user_input\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01e43f0ae935bc8dfefcdd9660f5d4b24468bc8d541077d5268fe36f5ec1d353", "structural_hash": "5c66c557624cf6f4ad981cdd469f6193bd8e6f8ef2075891e1436f1fece6a507", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30550.js", "upstream_id": "BenchmarkTest30550", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const data = `${userInput}`;\n if (!authzCheck(req.session && req.session.user, \"admin\")) { res.status(403).json({error: \"forbidden\"}); return; }\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60db9fdafa6c780e2213542a3380a001a019b7ca566a5a44b5ca143d0d3fce9b", "structural_hash": "bcbfd8b1900c8387e4cf6a49139d83039ca20b5f7f84398312b3de1431154903", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05650.php", "upstream_id": "BenchmarkTest05650", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n json_decode($data, true);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62e7e8ef21ed6b24d31a6c1018741019ea54129e28949b032d0a2b958ad7f6cb", "structural_hash": "cdf4447b064d6bc74b27cdd84821cec94da3dd529f3f5daafc65d4eab8daa55a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04933.ts", "upstream_id": "BenchmarkTest04933", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00b734599adbced1dcb1985853ce0a2e991d10287672a36641514d76fabf147b", "structural_hash": "aa42c0b04e1f280d6caef69d44218d2016dfff44f70fb9248bee350e45564049", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00011.java", "upstream_id": "BenchmarkTest00011", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = xmlValue.isEmpty() ? \"default\" : xmlValue;\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7c2a31297a6915a7c59a9e34400f57836efe43b27b4dc8ffc2b13e4e2b31412", "structural_hash": "9973a4513962540f660f26430b22683d601d1de3f8d6475d103bc6aec3aff34c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12703.go", "upstream_id": "BenchmarkTest12703", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tcapture := func() string { return fieldValue }\n\tdata := capture()\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71d636452dc273c188b7490990f6781c70f296058cf5b530bdfcb0e1afdb5f99", "structural_hash": "1cc48b345211429f28743779675384a349e0b4215330ebcb2f66413a101c0253", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04914.rb", "upstream_id": "BenchmarkTest04914", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = user_input.split.join(\" \")\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "916693296cdf689bf83c8383929edadc9cc0b99a416e10cc3221481933e2a157", "structural_hash": "28a000afcae7ae80326220d6f485a6e81d53272e7ed92973864f85a1da54a81e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00585.cpp", "upstream_id": "BenchmarkTest00585", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n std::string data = user_input + std::string(\"-bench\");\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n if (_i >= 0 && _i < (int)sizeof(_buf)) std::cout << _buf[_i] << std::endl;\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc4a2843fe0bab6592aef31757cfa17afc31ad9fb19a1c5c6086e02487adaa02", "structural_hash": "d00b35a3a52ce1bb7938e4802ed40b34020c2e40573139f07959367d5a90d966", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03987.ts", "upstream_id": "BenchmarkTest03987", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT body FROM mq_messages WHERE queue = ? LIMIT 1\", [\"tasks\"])).rows[0].body;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n JSON.parse(data);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d75bf00314e222ad67d88280e1da42563b06d67a6d3a74b924072452b612db24", "structural_hash": "459cc427dbb1caba57fcecbc013f8af0fcfbf2380e4ff58063fa1ef68fb012ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_22104.go", "upstream_id": "BenchmarkTest22104", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(jsonValue)\n\tstaticSalt := []byte(\"bench_static_salt_v1\")\n\tsum := sha256.Sum256(append(staticSalt, []byte(data)...))\n\thashStr := fmt.Sprintf(\"%x\", sum)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "277681fb363a830c3b1e524b3c052dd2155c513127af0027b02b4724c258978b", "structural_hash": "74e98dc1086caa3f3923995a1fbe11073ac27446af87321ec32d8056171a908d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00387.php", "upstream_id": "BenchmarkTest00387", "language": "php", "code": "json('variables.input', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1076bb3c407d731ec73dec0c32ec1a9d53884dfd7139adc0d0f22a762375b8a", "structural_hash": "68ca3ea4e7ad24274314cbab66306ab14fa328ea3cbd97daad86c85350ae7d8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08527.js", "upstream_id": "BenchmarkTest08527", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n res.set(\"X-Custom\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a53a035a6d71cb5861b697a32b64e5cdbced707bc385141c8fdda4959c0f6b6", "structural_hash": "68e3abe6dbc4650de9fb2f128e25d74b69656f0300976b8070eedb866b22c14d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14208.go", "upstream_id": "BenchmarkTest14208", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tdata := fieldValue\n\tif _, after, ok := strings.Cut(fieldValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tc.Set(\"data\", data)\n}", "label": 1, "cwe": ["CWE-454"], "category": "external_trusted_var_init", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95e3d73355de3159b37e83637d79fc5e0e5b7716c46095c5c334b812f45973fd", "structural_hash": "235c19f00fbdd3ff367a55771d2d179ef4d0812a9b0c1e46559b27e21ad3c16a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00374.rb", "upstream_id": "BenchmarkTest00374", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n @user_input = user_input\n data = @user_input\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37703ab82db5040e79f103782a807ed76ce0df2a2ebff9b0332b6df9a5a84f3f", "structural_hash": "c86c638da84506504b8ba330722ee55c6fa9f5f7e6634a40a9bc9f4d58b880e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03655.php", "upstream_id": "BenchmarkTest03655", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n json_decode($userInput, true);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f60d625e5591db69d9c2a5183e05513e3ac1d269a94e64ba3c57075c83d808e", "structural_hash": "1fb1e2fb2853bffe9d9792e0c68efb79d3942a9afa9ca5d428d28b2e2efde53e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05720.rs", "upstream_id": "BenchmarkTest05720", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\nuse urlencoding;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = urlencoding::decode(&field_value).unwrap_or_default().to_string();\n crate::shared::ldap_search(&format!(\"uid={}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "190734437b4ba721f5f3a0578929a3e8e068e37c626b903ab8ea1fa50cb7be48", "structural_hash": "7180918c2bbfed45f66d1628bbc6fbd51b8224f91c505ff1ce7dbe6e86a5579f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02320.ts", "upstream_id": "BenchmarkTest02320", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as net from \"net\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n net.connect(80, data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b5173eeaf741983cc9a62c46947c5a419d775661d7fc194ea71400ae428ba31", "structural_hash": "74f6f8b357fa741f0be1e55f24684bf91c79083b18420f5694e3e993e0c8799c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03136.php", "upstream_id": "BenchmarkTest03136", "language": "php", "code": "json('payload', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL_HASH')), (string)(hash('sha256', (string)$data)));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7acb3bf794d02225723321fdb3a3ef663a0795228f9f96b7f7e66166b3184ce", "structural_hash": "b5d380c1003d0916611152d8f00f53c8ee488db9c1dd76c3aaedd6be6329ef93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03639.ts", "upstream_id": "BenchmarkTest03639", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport * as childProcess from \"child_process\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n childProcess.execSync(\"echo \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "002ec2998e5ddb8f45e1054c8f3f40508d53386adf1cd428f816cb874697950c", "structural_hash": "e5d1dc1dd19f7f698808ee9c74aa4f5de814698b8e69b73327f4271c961cb7c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01190.py", "upstream_id": "BenchmarkTest01190", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\nimport re\nimport ast\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n try:\n data = str(ast.literal_eval(xml_value))\n except (ValueError, SyntaxError):\n data = xml_value\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c81964ed6e5bb71fac7415f3207210f1211a8215065a922f5e9132030b47acd1", "structural_hash": "fa7d4eca7537b3b00e64440359329d4f43bfec6fb033ffc8316f701837e633d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03390.rs", "upstream_id": "BenchmarkTest03390", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let (payload, _origin) = (upload_name.clone(), \"http\");\n let data = payload;\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n HttpResponse::Ok().insert_header((\"X-Custom\", processed.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "def874f9ee0c86cf7a76e979c64cab1c095ac693ecefd90f8859eed912ebb0c1", "structural_hash": "e15d3f73cd0e5eee27a20fb610a0eaa60e73e3e639c7b5d5d1a1023c3d32639e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00670.py", "upstream_id": "BenchmarkTest00670", "language": "python", "code": "from django.http import JsonResponse\nimport os\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n env_value = os.environ.get('USER_INPUT', '')\n data = handle(env_value)\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0fe377e20229d8809b64d3f3e878d8f848ccd6deac44919f0aa1dd7a5eaf8618", "structural_hash": "0bcf80ceae6c07d99d06088218f18f787ed2a2e9544a9b78ff780161016a07c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03741.rs", "upstream_id": "BenchmarkTest03741", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let (payload, _origin) = (upload_name.clone(), \"http\");\n let data = payload;\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "709c9482e0b10d046847dd107b372191f4b5769f2d9a7a54167b8aed4e5275bc", "structural_hash": "477ad5905fc4fb73af4e301d8506174067d722c1204e091631dca9dceabb8e7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06321.js", "upstream_id": "BenchmarkTest06321", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { checkServerIdentity: () => undefined });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dfaaf574f94c45b868d343656a87187253d15d3d7df3deeec2accc74ef3272eb", "structural_hash": "b0bc304e596efc0a69b638aebd317819dd74ba7c1ed1f8c0a8a13e1517e8d676", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02262.py", "upstream_id": "BenchmarkTest02262", "language": "python", "code": "import json\nfrom flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = json.loads(json_value).get('value', '')\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d5044dc575b8a82d37b802aceb6fe359df53ddfd10817d9bd6c3045afaf658f", "structural_hash": "b0df4c42da3e1c3c53953133506c55696ceb7f53ac45488757011850fb569aae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28457.sh", "upstream_id": "BenchmarkTest28457", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"${user_input:-default}\"\n printf \"%s\" \"$data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b968e1a0a87de7b7b1704af5076e7f4a734731599dacd955b735e887fe191989", "structural_hash": "4ba9c433861319e89017814c66ad8f90d0061a199cbedb80f0ce73bf06639a46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03830.ts", "upstream_id": "BenchmarkTest03830", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(data)]);\n res.json({ updated: true }); return;\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b81d502a2a0d02e37e26cd4d241271ea6d42619c1b107ddb62299bbb15244fb1", "structural_hash": "2146c8ea266c290ee1a91cce7390f4cbb5c8762d20c029d6e868ac3947c1e216", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19513.c", "upstream_id": "BenchmarkTest19513", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 0, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2088a7a81473e4f48c396e66a668b70c5c32bb17f7dda5b8de73adacba0145e", "structural_hash": "30524bf98afd685ef130e1abea8d27f3359f719f484e88f6dd8e72f231c82491", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01077.java", "upstream_id": "BenchmarkTest01077", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> userId)\n .thenApply(v -> v.replace(\"\\t\", \" \").strip())\n .join();\n if (!(\"true\".equals(data) || \"false\".equals(data))) { return Response.status(400).build(); }\n Object codeResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3242670a6675498013adde31eee6727c3cccfd9d8ead813e7949790bcf550e34", "structural_hash": "3ddba543e7a8d1d95342a2af2d8f4a1d0a79500dfc86fe2b02c65100a5f01578", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04091.py", "upstream_id": "BenchmarkTest04091", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom types import SimpleNamespace\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n ns = SimpleNamespace(payload=cookie_value)\n data = getattr(ns, 'payload')\n if str(data) == 'S3cr3tToken':\n return jsonify({'authenticated': True}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a446cffa2a814fc96410c751fb79a217dcc0b81e69ae5e2756b7c09691d64270", "structural_hash": "a8d9552efe1453d364939752946e994f9515ecf87e8b2295ae4f1c6208bed8a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13889.c", "upstream_id": "BenchmarkTest13889", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n const char *safe = data;\n if (strcmp(data, \"status\") != 0 && strcmp(data, \"health\") != 0) safe = \"status\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"%s\", safe);\n execl(\"/bin/sh\", \"sh\", \"-c\", _cmd, (char *)NULL);\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28bab5beaa7117fec2f3b753f63fe1958d4583dd2f27f65d3dc9713a83c872e7", "structural_hash": "47db09b60365feede9df491fd0068243bca31c2668324aed967131cad2b96eb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04583.php", "upstream_id": "BenchmarkTest04583", "language": "php", "code": "header('Origin', '');\n $data = vsprintf('%1$s', [$userInput]);\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ab5079779dfccec2c4a8ca260851fb250c79bf812622f4135aa13388bbc32ea", "structural_hash": "111f0865047dd2c3c6215dc8f48ec940e128a3cbe6306a4934006e0b97ec79f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02076.java", "upstream_id": "BenchmarkTest02076", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : fieldValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n try (PreparedStatement ps = connection.prepareStatement(\"SELECT * FROM users WHERE id = ?\")) {\n ps.setString(1, data);\n try (ResultSet rs = ps.executeQuery()) { }\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14da845fe67ec3a5c85d63b0c4f6400b23ba284b7d18d1c200109fe63ad081f3", "structural_hash": "9327347d74410f47cf64fa05e0bf2c8bc913ad71919f65e32661be566fcb7a62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03614.java", "upstream_id": "BenchmarkTest03614", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(refererValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n return Response.ok(data + \",data\\n\", \"text/csv\").build();\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "546a1e0699ab83456ff556bebfd657b1ba638527a68e29bc21c0622f9e2f0fca", "structural_hash": "ff3fce31a57034896348c4b4e31339d6c23faeeaa8d0df7ca537a163ba2b726c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00338.rb", "upstream_id": "BenchmarkTest00338", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = \"#{user_input}\"\n Digest::MD5.hexdigest(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1446b3a510adfa852006b07a31b3dcb0e1a02e44f1f4d0c9ec4f3a53dedcd313", "structural_hash": "95748637f9fc67f931ad5729c47043b57f7d4b78736810b069f3f93038a42948", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02861.java", "upstream_id": "BenchmarkTest02861", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Forwarded-For\") String xForwardedFor, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n request.setAttribute(\"payload\", forwardedIp);\n String data = String.valueOf(request.getAttribute(\"payload\"));\n java.security.KeyPairGenerator kpg = java.security.KeyPairGenerator.getInstance(\"RSA\");\n kpg.initialize(1024);\n java.security.KeyPair kp = kpg.generateKeyPair();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"RSA/ECB/OAEPWithSHA-256AndMGF1Padding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, kp.getPublic());\n byte[] wkBytes = data.getBytes(java.nio.charset.StandardCharsets.UTF_8);\n byte[] wkSlice = java.util.Arrays.copyOf(wkBytes, Math.min(wkBytes.length, 62));\n byte[] ct = cipher.doFinal(wkSlice);\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "725130c6ae6ebf754ce5d0cb6c9bc2931ec7ee9f17279c3910481c5026ff736b", "structural_hash": "25c65bb397971562209963564342dd00dcf3455c03175376feb782496411625d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01676.cpp", "upstream_id": "BenchmarkTest01676", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae1f4b610d3fee76fb433cd93b685c53641f17659dbb5c403c966a663e754839", "structural_hash": "0595824b113c21fdc3ae3636e4af8ea74ad5c388249925c60f5c3b84c5249330", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02093.cpp", "upstream_id": "BenchmarkTest02093", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74bdf0b078f026126174bf242a40017f78c85a91913e6e62a1b733ede3afdc1e", "structural_hash": "e6181aa1a5a1dad9f3521289e99e918cb20e8ec7e0de4a1a1adb6158088b934e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03565.cpp", "upstream_id": "BenchmarkTest03565", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data = cpp_module_transform(user_input);\n std::string _truncated = data.substr(0, 64);\n std::string _msg = std::string(\"DB error processing '\") + _truncated + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "205675a99dbfa8c0cc9f8d9273a9508380fc5acfb54f886c12eddbbed0cb5b00", "structural_hash": "4941a5e3e0c2bd928cf15baed57aab9fc9a88f1cf3c017b8d86745cf75ffa7b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00830.php", "upstream_id": "BenchmarkTest00830", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = vsprintf('%1$s', [$userInput]);\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7b4b7e7fbbe33e649eb1ed8211f720c771a88ce5d14e54675d3e4bd89a8e583", "structural_hash": "033a7e28c32c7d35ef72ce5ae3a01b4d8d942a077d3b4432972b1c587d9f150d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03122.cpp", "upstream_id": "BenchmarkTest03122", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n unsigned char _hdg[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _hdg);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.hash\", \"wb\")) { std::fwrite(_hdg, 1, sizeof(_hdg), _sf); std::fclose(_sf); }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ef332535823e924744e84224f98071bccc3a8964f7b8a35f29c34e5323fff48", "structural_hash": "d16b4b1321ad3d23acd4fdd4014b6ec2acd1e4720474288725650ff160f50b12", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04296.ts", "upstream_id": "BenchmarkTest04296", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.origin as string) || \"\";\n const data = userInput != null ? userInput : '';\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04c3be1b47bb28164db177049ebcc291100ab6038df85a09e6f9f938ab7283fa", "structural_hash": "bc0231227869ef833169eac7f330ea0a697f062855b46d497b00f3cbce75d2aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20161.go", "upstream_id": "BenchmarkTest20161", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvar data string\n\tfor _, token := range strings.Split(dbValue, \",\") {\n\t\tdata = token\n\t}\n\tos.WriteFile(\"/var/data/secrets.txt\", []byte(data), 0644)\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7387ae574301fcc4621a2ec09ee7fc7b41eea1241230c525458c73cc5c790b9", "structural_hash": "a58264088531c7fe83aa7d5ebb1471e540a60d4bbf9b2b9f672b1a70943dbadc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06824.go", "upstream_id": "BenchmarkTest06824", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tvar data string\n\tfor _, token := range strings.Split(headerValue, \",\") {\n\t\tdata = token\n\t}\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 1, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2822912596be74afd362c34730c7c900d675b9e6eef1dd6267538ef420f420b5", "structural_hash": "8cbf8b4cbb66d2f116833f6f61f674b7cdb0151a4732e63e3140a97e782b1e73", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04104.ts", "upstream_id": "BenchmarkTest04104", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n http.get(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff5fd1eff72bc152adee901cf0d3d2a1b3964fe46a4cd17882e8b4cf25d1b4e3", "structural_hash": "eaf4da5bb8125713747237dfeadf1f54090dab9eba0a283201776bce8be1b09e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04809.js", "upstream_id": "BenchmarkTest04809", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n eval(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-749"], "category": "exposed_dangerous_fn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ffed750be272472a79d58b3d61471695657ef01e3573f7deffc00cb5a7f6a8a", "structural_hash": "6cc6e362ffd0f86a4f50e928decc472338fc0f696291efaaa360d6fb931d29c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03976.rs", "upstream_id": "BenchmarkTest03976", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let queued = forwarded_ip.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n let _ = data.parse::();\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b2593a7ed2ffb3f43b02c86445418b15eb80bbe82ed50bbf27fb277340bd6d4", "structural_hash": "9953bba0283766783be9c1bdae5e6376d2a06141321fa4c4584c9ff6a446d6a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05245.rb", "upstream_id": "BenchmarkTest05245", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n response.set_header(\"X-Frame-Options\", \"DENY\")\n response.set_header(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "441f7a0d7b50c14d5925c387a9eb469bda33e5fc65d2ff8a569ce3e5c027d161", "structural_hash": "96fcd64a78fe916c820135761dd6f9decbbb70d087723967b736a1b8105c18ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04707.ts", "upstream_id": "BenchmarkTest04707", "language": "typescript", "code": "import { Controller, Headers, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string, @Req() req: Request): Promise {\n const userInput = xff || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (!req.session || !req.session.user) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n req.session.id = String(data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef22b7e7abe2695d6556bf0e45a7d0febdb3a04c8a0ef14672c17530b7f11dc8", "structural_hash": "0925b55cf6298c6cf8a901658cc96b50fa95eb6d4bcfaa8cbc6a1e9027c5039f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_30663.js", "upstream_id": "BenchmarkTest30663", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n db.execute(\"UPDATE users SET name = ?\", [data]);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4a05bfdd824d6ac0c14664a5adfb6a5320df3d6a9f94320c0f84fe8c33b5358", "structural_hash": "21c28876eb0059586b38a7b6100c5578e5c676561660a5976164d0a041dc846d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03124.py", "upstream_id": "BenchmarkTest03124", "language": "python", "code": "from flask import Flask, request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n ctx = RequestContext(cookie_value, source='form')\n data = ctx.payload\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': str(data)}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33aae854f554c024c5cc83ec510c9b341bcbb6721f9ec794b1d177e143016c77", "structural_hash": "7f4ed64e830d34b7eb84d18618c2d9dca8471babfa220fd0d7c8e27fab2d3261", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01771.php", "upstream_id": "BenchmarkTest01771", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73a5b1c4c58cbd931dc788d2ce64c6cdcba6563e560cbc0976143c280fd9c054", "structural_hash": "edb3d23f126c45d4d702d5e47016a7cadc89a6aa42c8c94f34cfbcce600846ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02385.rb", "upstream_id": "BenchmarkTest02385", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n Net::HTTP.post(URI(\"https://api.intra.net/data\"), data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d6f643e1ab153f09054bf9765df6b04144d4d0f82c543a428c61f6328b3da9a", "structural_hash": "ad05565353173ff4dc094cf44c19cbfc7f096588d35e3107953ff823cb5e1e7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00863.php", "upstream_id": "BenchmarkTest00863", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n [$data] = [$userInput, 'http'];\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return new JsonResponse(['validated' => (string) $data], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef6b85fb1685d5944e6ad23661d88c5d597dab32f3bc1e458bf1a6d69c5687e5", "structural_hash": "4f2459a858f23d77f36ec0cb38a831bd0bc8bdbcf89ef512bf7e66c35dcc9435", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03542.py", "upstream_id": "BenchmarkTest03542", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom lxml import etree\nimport re\nfrom pydantic import BaseModel\nfrom starlette.responses import JSONResponse\nclass UserInput(BaseModel):\n payload: str = ''\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = RequestPayload(json_value).value\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b05cf11bc0e5437a55ef0fae740e1e77c14b9e64639ed11a77551444beccd1c", "structural_hash": "d95856038c951ea3d2c1ffb73abbbf38d6563db2cbaa7dfe36756bf98a183253", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02267.js", "upstream_id": "BenchmarkTest02267", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (!/^[^\\x00]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n fs.writeFileSync(\"/var/uploads/\" + processed, \"data\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82c2c6df040778bd3430b8272942c747fb965d1471d76679659308bef35322a3", "structural_hash": "1606defe8ac758d97547f1946eb979b5e6db245d5c9886e2045c4a5bc6314887", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05405.php", "upstream_id": "BenchmarkTest05405", "language": "php", "code": "query('id', '');\n $data = urldecode($userInput);\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1071ea5f32b7825db061bb3500657f6e171de6e3e8dde49c52029a83d8a356b4", "structural_hash": "85b19d58f46f9a67981ab82f5232bfcaad776d801ea97bd7d503e02a3cf2baa5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_41538.js", "upstream_id": "BenchmarkTest41538", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const user = db.querySync(\"SELECT id, role FROM users LIMIT 1\")[0];\n Object.assign(user, JSON.parse(String(data)));\n db.execute(\"UPDATE users SET role = ? WHERE id = ?\", [user.role, user.id]);\n ctx.body = { updated: user.id }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76d205ff81b7deb598c5dcc6e5d873a3ed08137e14ff65911b9d97aac0c5a88d", "structural_hash": "82812ac039324fcead0a6eabb68658b0bfcb16ccb1a7d24c217131e8b8a484ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02797.cpp", "upstream_id": "BenchmarkTest02797", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "352b9cfaefbcb5dda163ca3afdec06362b1681d36b5cd310e49b36a1d3d97790", "structural_hash": "adf0b257726b2d0363cac473c06c554632957db8a637a7de853b67fb72261dd5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04011.py", "upstream_id": "BenchmarkTest04011", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n auth_header = request.headers.get('authorization', '')\n data = bytes.fromhex(auth_header).decode('utf-8', 'ignore')\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cce12cc9f75d0bc23f02ba7bfc449c40cd190235ebf6086b10b9c8a5b97ba19", "structural_hash": "f2ec5d38f965db2c56d49de57b61f5a0b6bd4eb36e41f81270461197f5229aa6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05139.ts", "upstream_id": "BenchmarkTest05139", "language": "typescript", "code": "import { Controller, Header, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a53b74151aa304644fc94253ab6809009e4db2923eb51999b9562eec64d65406", "structural_hash": "67907512f8b6498b3067d3d8e75e867cbeb1568c727e55ee8378cea0b500885d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_26370.js", "upstream_id": "BenchmarkTest26370", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const data = passthrough(userInput);\n JSON.parse(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b84f5bcd64ca3f69e5899b2dbf5a4077857e8318f8c5bced7468baa772fc4b4", "structural_hash": "75daa82746d86d5529d9937d3d5d96c23890cc63abab445871ecaaeec7cbbd72", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05293.ts", "upstream_id": "BenchmarkTest05293", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = host || \"\";\n const data = String(userInput).slice(0, 200);\n if ([\"https://app.jscdn.io\"].includes(data)) res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f6adcba199f236cf5ebbe67a88cba0b240208563c0db6366cdbc9a60aa030fc", "structural_hash": "95a2d9d2f8366ccbdc679236681098516d26c8af63f5165b865d0adbe5ea6186", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02910.rb", "upstream_id": "BenchmarkTest02910", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n entries = Dir.entries(data.to_s) rescue []\n content_type :json\n JSON.generate({ listing: entries })\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c010dbd16cc276497d4747accd15a45c524c49cfe26a7ad802326080ea771c41", "structural_hash": "4cc98bdce499a1d45f154140185669f53412b91a91d4d177051f115065d74f99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04288.rs", "upstream_id": "BenchmarkTest04288", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: json_value.clone() }.payload;\n tokio::fs::write(\"/var/data/hashed.txt\", crate::shared::hash_hex(&data)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e405d8ee12e96c6b9b5af94ba5dd960f4218b88f95b57a679cbef546e004083", "structural_hash": "0039a412d0a21e519c12e2379b7a94a665d40997a9f8325af2732ebab4540d0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_27375.go", "upstream_id": "BenchmarkTest27375", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/s3\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvar data string\n\tif len(uploadName) > 0 {\n\t\tdata = uploadName\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tsafeKey := \"uploads/\" + filepath.Base(data)\n\ts3Client.PutObject(context.Background(), &s3.PutObjectInput{\n\t\tBucket: aws.String(\"app-user-uploads\"),\n\t\tKey: aws.String(safeKey),\n\t\tBody: strings.NewReader(\"data\"),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf0172f8f1264da6b0fc43f0e805c353a085e9531f127bf18796da950b755e17", "structural_hash": "b92cfdb54ace2d6f9a9f953748b463828db291da0f59cf85563f843f35dbffe9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00343.py", "upstream_id": "BenchmarkTest00343", "language": "python", "code": "from flask import Flask, request, jsonify\nimport json\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n try:\n data = json.loads(ua_value).get('value', ua_value)\n except (json.JSONDecodeError, AttributeError):\n data = ua_value\n secret = db.fetch_one('SELECT secret FROM vault WHERE owner = ?', (str(data),))\n return jsonify({'secret': str(secret)}), 200", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "576a9d3a0435dde9f5d4f694988dddd384d28879c7c6aa5853513541281d2b94", "structural_hash": "8096f5855f952542d446c2ebbf52a55926f3c264a9aea6de628c5786add42aa3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00027.ts", "upstream_id": "BenchmarkTest00027", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = Buffer.from(userInput, \"utf-8\").toString();\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14346ba4432545b0089243d2bff9746d37eeb03a9301ab968a33b46f446c26ac", "structural_hash": "6f9f41351da46683df4fac2f4b9d4370d4554e5250cfad7da0e223cbd95364ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03727.java", "upstream_id": "BenchmarkTest03727", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n request.setAttribute(\"bundle\", rawData);\n String data = String.valueOf(request.getAttribute(\"bundle\"));\n new ProcessBuilder(\"echo\", data).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14d458912de1d2da7e0c7c61e62ee131b78d29a48c0158584713fea57f662d0b", "structural_hash": "c8cabab4448a43f771e9b8482d026cfb57df711fd645bda550a243089ecb0b5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02841.ts", "upstream_id": "BenchmarkTest02841", "language": "typescript", "code": "import { Body, Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0d2a067058ace2e31e3c1d859efdc0f2154ba96baf82ecbdf1d15f838519090", "structural_hash": "1536889dbff39c09c01bb0b97cac852e1e6841a3345a4dfd1d39a197f91e98bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03199.js", "upstream_id": "BenchmarkTest03199", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(userInput)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = userInput;\n ctx.body = nunjucks.renderString(processed, {});\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3425ca4af7d4d35d841942455da5d3f389e962037e4c6dc4de16d4380a69e81c", "structural_hash": "3bb33e95d513e1daad723e106bfc89e38207bd04846876ed1372ac76879764b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37717.js", "upstream_id": "BenchmarkTest37717", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { ctx.status = 400; ctx.body = {error: 'forbidden'}; return; }\n const processed = data;\n eval(processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-749"], "category": "exposed_dangerous_fn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f6a6f00e7f9eb952121609ab04cf070d22ceb954c9e4fc4fe04ba728b3609cd", "structural_hash": "ec03141a8a01879fdf867555c0ebccb48d8ea922332fefad6b67c9dfd997f979", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03142.py", "upstream_id": "BenchmarkTest03142", "language": "python", "code": "from fastapi import FastAPI, Request\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n data = forwarded_ip if forwarded_ip else 'default'\n with open('/var/app/data/' + str(data), 'w') as fh:\n fh.write('data')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9a8dd1ce697936c74a1990e41f72a0c7995ad0b7a5ca73a79281d1a0aa48919", "structural_hash": "7db9222ae4c5f2a8b37fd973d9765e4934695396de765d435fff387afc1d65ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03841.rs", "upstream_id": "BenchmarkTest03841", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(upload_name.clone(), |s| s.trim().to_string());\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf09f0ce498134b8981d776471807ab181329ccffe0198f6a85b4f08eb0b3c18", "structural_hash": "5d846a1152128ad506ff495badee39cb8cb300dff4f3026fb109704533867646", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05693.sh", "upstream_id": "BenchmarkTest05693", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(printf \"%b\" \"$user_input\")\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6e90b471b5493b35f3ba6630d877daaaf33713435f3ebddcea11240310956c8", "structural_hash": "ec22cf119d9a2e522707fee259a0a3d3afd414a235d7b3a1cd7a09b6784f70d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01707.php", "upstream_id": "BenchmarkTest01707", "language": "php", "code": "name;\n $data = str_replace(\"\\0\", '', $userInput);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4db76db78ddea85f016fb7df848eaadd9cf78b5990b88c57da73e61c4cc99f4f", "structural_hash": "b5d351c6c8b1c06e0eba645f5c3f9c6c268971252c15471713a74f7c0fce0161", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17556.c", "upstream_id": "BenchmarkTest17556", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc3f4d6fbdb6aa213dbfce9724873cbc04977c5c3edb476ff24bf60ac691d6ff", "structural_hash": "31e159b4b4e477830cb9db190011b511e88519dd3a168044a4d776454eb2486b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00246.sh", "upstream_id": "BenchmarkTest00246", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo $((RANDOM % 16))\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-331"], "category": "insufficient_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f13bf76b78c648fc80f6902b3474c2d8e3332b06f9999da5e2fafe60c2367596", "structural_hash": "d7bafa3fca8608f50e2eeeb828b382213fa921fb685e2a9652b3d1fffe2379fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00719.py", "upstream_id": "BenchmarkTest00719", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = str(field_value).replace('\\x00', '')\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "deab253869201221a64c5d6316f97db00e56bc8c70bb49f8daa71bfc88172301", "structural_hash": "af40f26f482f8bcd77a455f65bdb920ced74c55ef19dc998928533b43c93fcd8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00359.ts", "upstream_id": "BenchmarkTest00359", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const data = `${userInput}`;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c335af7c2b8f88bc71431ab98c80a1208e99cacbaad95fbb3bc6d7b1210af028", "structural_hash": "feecf95d6913738426892f985f604f7b78c3f74378dfa92afd17b781ff38837e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01343.java", "upstream_id": "BenchmarkTest01343", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String squeezeSpaces(String v) { return v.replaceAll(\" {2,}\", \" \"); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n String data = squeezeSpaces(envValue);\n if (!(\"true\".equals(data) || \"false\".equals(data))) { response.sendError(400); return; }\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad63332228523e064ce0e9998b00564e2611f9dd133b1eeeafafe823438c897a", "structural_hash": "d9ba9473f974b08bf31884641877cd6b6f101ba9328e890ff73c4bb14383da86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05161.rs", "upstream_id": "BenchmarkTest05161", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = forwarded_ip.to_string();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")).finish()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b11f238dc423d1c55b8ce50a69d0dcc05d885a41c75539292ff2066c3eb58803", "structural_hash": "d12b665d9cabf30c3b7f89430e33a412206dad320e5955b46723ec50ba261e17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05294.py", "upstream_id": "BenchmarkTest05294", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nfrom urllib.parse import urlparse\nimport ipaddress\nimport socket\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n kind = 'json' if str(field_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(field_value).strip()\n case _:\n data = str(field_value)\n parsed = urlparse(data)\n resolved = socket.gethostbyname(parsed.hostname or data)\n if ipaddress.ip_address(resolved).is_private:\n return JsonResponse({'error': 'private range blocked'}, status=403)\n target_url = data.replace(parsed.hostname, resolved) if parsed.hostname else data\n requests.get(str(target_url))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89a543ff6436bec879034a17d826d5083e4464c4e2be95184a08339e2026cae3", "structural_hash": "1ea7350377a9fe16773d2688a002c2b044400c4a65d851128943194ac04ed897", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_06047.php", "upstream_id": "BenchmarkTest06047", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n return redirect($data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ddeb784209357692db2f79fd5d51bc30be2d36d0e60ef90723a1d4c20db83fc8", "structural_hash": "357f52a1d5e634f1f2aa8ebd7042b9ba198bf815cb07f7d0ad906a1cc404b073", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03817.go", "upstream_id": "BenchmarkTest03817", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tcapture := func() string { return jsonValue }\n\tdata := capture()\n\tDB.Exec(\"UPDATE users SET name = ?\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1625f7a8e2e95f8854e004c57e5ff099c25cde58d8a588dc567efaf16ab1366", "structural_hash": "2d334ab64fc22be103e693258c091671f82b8837564381a68bd0b95e1d13abe6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04332.java", "upstream_id": "BenchmarkTest04332", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data;\n if (originValue.length() > 256) { data = originValue.substring(0, 256); }\n else { data = originValue; }\n jakarta.el.ELProcessor elp = new jakarta.el.ELProcessor();\n Object rendered = elp.eval(data);\n return Response.ok(\"
    \" + rendered + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9dbd6833c28fc2027d162c23d746f2258cd2c61bd304bd58add9c2d3011ed8e6", "structural_hash": "1811710f511f2001ff555a0ea1f50dc8f014d3eaec7b0324061d6701ff8a5017", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00271.cpp", "upstream_id": "BenchmarkTest00271", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = std::string(\"prefix-\") + user_input;\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n std::string _cmd = std::string(\"ls \") + safe;\n std::system(_cmd.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2df73b0ff4cc469dc068c9e23b916520fc50eabd06464c3dce6c4f6cd27e224b", "structural_hash": "78b9db1485b00901a7bb1ffe2b28a5188ab8190518b603c163d321b02605c6a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03703.sh", "upstream_id": "BenchmarkTest03703", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a3f5656fbcbc794694bd7c6b5d9ff6a8af0e66b7a15986db3cb974dc272ce50", "structural_hash": "15841d327fd90966d702e8ebc20fcbadd7dbe40cecd0f2ddc35da1fa3e2e62a9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04719.c", "upstream_id": "BenchmarkTest04719", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n void *_h = dlopen(safe, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df28d3dc7835b4ea829c333076b9a74eb6ff3254d87f2932c50d5157fe73fd16", "structural_hash": "78a7e45ace71df90c952dd1081531af5ade40d1b0d1d3b348d6b59870d00e0d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24330.go", "upstream_id": "BenchmarkTest24330", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(commentText)\n\t}()\n\tdata := <-resultCh\n\tprocessed := data\n\tif len(processed) > 64 {\n\t\tprocessed = processed[:64]\n\t}\n\tvar secretVal string\n\tDB.QueryRow(\"SELECT secret FROM vault WHERE owner = ?\", processed).Scan(&secretVal)\n\tw.Header().Set(\"X-Secret\", secretVal)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5aec6b5f0efda7b0580371602d244be323388027effc93ceca44317af6a55b2e", "structural_hash": "4ac53f58a2046ebec0275a49a47e4684ba5839273ab613c0d267dffaa6857cce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02026.cpp", "upstream_id": "BenchmarkTest02026", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb9c3f8ad67a6c1de8484a14d9cdb43501b8c533e901d464b61c9519aeae3ae5", "structural_hash": "26df8eda174c99b408a0df029420f041afc3cc472e349fe684297e3786204633", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03399.rb", "upstream_id": "BenchmarkTest03399", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n trusted_claim = processed.to_s\n render json: { trusted: trusted_claim }\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0620fe6c448bb9a3298b68611ebf3fa855dadb175988fba3417510389c985c62", "structural_hash": "cde33b69837046198160948887d990123a146e6a747faf3e3014b3451f52795f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22386.c", "upstream_id": "BenchmarkTest22386", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n regex_t _re;\n if (regcomp(&_re, \"^.*$\", REG_EXTENDED) != 0) return;\n if (regexec(&_re, data, 0, NULL, 0) != 0) { regfree(&_re); return; }\n regfree(&_re);\n const char *safe = data;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", safe);\n chmod(_path, 0777);\n}", "label": 1, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63f27a9d89a313d509c4323ca481811b1b143b571f88bec5b66493730de1c6f1", "structural_hash": "b1a58f3d472357dc9121b9a8b0ca0527baaa050e9f6fc0ea632702d61e02ff7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03616.rb", "upstream_id": "BenchmarkTest03616", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bda7a774c28fc272a94da1669ac61d0d1697f38f7c205948d6988b5aa8d9805a", "structural_hash": "35d5e49d956f09eeb413d389ae45d06392a01f69b1f8761bd582171c618e2b03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04999.py", "upstream_id": "BenchmarkTest04999", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = json_value if json_value else 'default'\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c53f2faaed265b435c83208889309c9a264dcaa2bf4e43955e4053c253b999fa", "structural_hash": "21a8ea89921467f7e8e040a3d176d6d8c399c8379498647a07c96d134880c562", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00216.java", "upstream_id": "BenchmarkTest00216", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport javax.net.ssl.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n request.setAttribute(\"payload\", commentValue);\n String data = String.valueOf(request.getAttribute(\"payload\"));\n javax.net.ssl.HttpsURLConnection conn = (javax.net.ssl.HttpsURLConnection) java.net.URI.create(\"https://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL().openConnection();\n conn.connect();\n conn.getInputStream().close();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "288ef6c6f32abee6c3cb05ee1006f9cf9278074c7503ff3db51eaeba2dd736d0", "structural_hash": "08c2da0bb194c8a7e89e3db00e87c2bc3d14a8377302d96fab658462e1ccea4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16663.go", "upstream_id": "BenchmarkTest16663", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := string(bytes.TrimSpace([]byte(rawBody)))\n\thtmlOut := \"
    \" + data + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b496393274735a94aa7c422fcf3546c66cc4f4b8b41454a6996c3e85f6497f67", "structural_hash": "63f91e74434dece0480dec6bf892e42c6e2eb07ca8b4cd4a5bc5804fb2a2fd77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23728.sh", "upstream_id": "BenchmarkTest23728", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca5dd05ff0627bafbd828b3294761d0ac1f57b3649f0a5420cf315fb5c783a70", "structural_hash": "4d72b006514b2f011610abe0297bafcc31fe116626794370843c0f7be7f8b9d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29575.sh", "upstream_id": "BenchmarkTest29575", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n local -a _cmd=(\"printf\" \"%s\" \"$data\")\n \"${_cmd[@]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "830fb9eee61cf11ec1112f25504219d83a8b50cef377e13ed70cc52e5122bf84", "structural_hash": "a61e2b3a092e07914e5db7fdff0a8a8c242ee8f01a7bbdebc9201b46fc94d010", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02103.py", "upstream_id": "BenchmarkTest02103", "language": "python", "code": "import ldap\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n data = f'{auth_header!s}'\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(data) + ')')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "786384196c2fb094596bdc9ba71f3cf22c4c2a41a02b6f15fc4f4541d60fcf99", "structural_hash": "91ac87bbc6a5c27ac4141cd3ab5f13ef7bfe5976fb64c53079546eb4464a7ed3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03907.rs", "upstream_id": "BenchmarkTest03907", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(field_value.clone());\n let _csrf_token = req.headers().get(\"x-csrf-token\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if _csrf_token.is_empty() || _csrf_token != crate::shared::expected_csrf() { return HttpResponse::Forbidden().finish(); }\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c038b9a2c3abea7caf8895647dbd70863341397fed50b113d09584ec09c2c8a", "structural_hash": "7fe9df9acb2e42babf205d3f943327c31b812404966264b2251fa4024be96842", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02211.rb", "upstream_id": "BenchmarkTest02211", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (ERB.new(processed.to_s).result).html_safe\n end\nend", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28194d4e4af42d345d4f89354ca32a0a77a253f95b71d96e12350cc94de5951c", "structural_hash": "fe7d748970eed75b0bcf740c0d9217cdc9f51e8297e007a67c5a429d96c0749d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05965.py", "upstream_id": "BenchmarkTest05965", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\nfrom dataclasses import dataclass\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n form = FormData(payload=forwarded_ip)\n data = form.payload\n subprocess.run('echo ' + str(data), shell=True)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cebc74067e5c089ec79d767060cf9ca55b1530b49670f3311bf6ec85e3c1296", "structural_hash": "0f219ffa8a33d2abf90d4e2d34f76c827992f0420fff528f597de7b9e2a38c38", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02376.ts", "upstream_id": "BenchmarkTest02376", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n req.session.id = String(data);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0856feff041fb735af3b9eb4c724929583d0020c60b007a1975202ef1c72f09", "structural_hash": "089d70422897ac098e8ae0bd3182351c33c36bece35061229a54435990b7387c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01713.java", "upstream_id": "BenchmarkTest01713", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = normalize(authHeader);\n URL url = java.net.URI.create(\"http://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL();\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n try {\n conn.connect();\n conn.getInputStream().close();\n } finally { conn.disconnect(); }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe3a7b922ffc283eefc2a4925ffb3cb3c1a69f97e4f27e7d5a6588bd64047600", "structural_hash": "685597afdbca48e9108db23665e170c130e78cc7699c5bfa7454ba48e9a5a32b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05345.rs", "upstream_id": "BenchmarkTest05345", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in origin_value.split(',') { data = token.to_string(); }\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf4a2587b6b711eff32db1a8a06ac2ea80e32a6c7f872ea45f5d6667adcea7ac", "structural_hash": "369ad8bd134ee0134dbfdc2c645705ad5eb960daf137fff30175292c23104667", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02127.php", "upstream_id": "BenchmarkTest02127", "language": "php", "code": "header('X-Forwarded-For', '');\n $field = 'data';\n $$field = $userInput;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$processed), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a152485ae0e9067c2f3b3571902b926b1d0643df001af6d0ef5b83d561d2a23", "structural_hash": "c340bfdf2dba5642a1759dc3a14540e66c38e770ec0d1893c29cde66632fd109", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01030.ts", "upstream_id": "BenchmarkTest01030", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const targetUrl = data;\n http.get(targetUrl);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67a315a7b3b25d8f3f3dfff4f9c283d6928f691da4856171170231fb45bcb394", "structural_hash": "5cf9944faf33017508ab52e036534edbd018ac30194032059ea54dede9f63416", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04952.rb", "upstream_id": "BenchmarkTest04952", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n unless session[:user]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n logger.info(\"error: \" + data.to_s)\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "573afc88bf14f897e9e3cce16dbcf49591f4352b66826df5363f4b4fab9098e8", "structural_hash": "04b996cbafd405560a8ce5334e187e5c4e228045a288763df6365e9a0a5f204d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04122.rb", "upstream_id": "BenchmarkTest04122", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c1a5559bda331415b18b61faf37f0b16039e243aee35b34692767fb92feaf9b", "structural_hash": "8034234dc089a61075b250cd5b09b79254e3c91ff09efd450d12a3cada810c04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02368.py", "upstream_id": "BenchmarkTest02368", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n reader = make_reader(field_value)\n data = reader()\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b1580e45303ecbb0205eda8ef4de60c5557d37a003d1ba54042405da455deb7", "structural_hash": "83a3e4f858a7769554224a653d3200dc65b4ae680f9b402ad9b09129d4686c8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05221.go", "upstream_id": "BenchmarkTest05221", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(cookieValue) {\n\t\tdata = normalizer(cookieValue)\n\t}\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1a89ef563fbfb3f23d47a4d4da54c1f3bdd4cd37b9824d7fbfd716165da605e", "structural_hash": "e1951906058d4132b3d3aad6667d9ce25f832ec536738aac8f7e63094e74c727", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02435.php", "upstream_id": "BenchmarkTest02435", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n simplexml_load_string($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c551ee1e91453049f18c7cfc64fe1aa1f8c8ba79fd2edf7bad4469d78126992", "structural_hash": "cc6a796e0d12ad8f6e8a61451176740f761724d520585ccb9669ab1456cca018", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01707.ts", "upstream_id": "BenchmarkTest01707", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT bio FROM profiles WHERE user_id = ?\", [1])).rows[0].bio;\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "477679d0e84e0f71a939abcac02b22aa626e208e9a45de31f98f33e027711cd0", "structural_hash": "4459f8d2e9ec62ce91ce01d95834b8d1fdac54af0c9660e1f71dcd16437edab9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02952.cpp", "upstream_id": "BenchmarkTest02952", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e592e0daba215143e5a18fd35807c47e42b64f4ea7c35c26992921abdfaaa6f2", "structural_hash": "f1c9db9da6899375ef711bc18dd50556f1a96f2131dbce13d4a11004fed998f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02270.java", "upstream_id": "BenchmarkTest02270", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"User-Agent\") String userAgent, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.Properties holder = new java.util.Properties();\n holder.load(new java.io.StringReader(\"rawValue=\" + uaValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", holder.getProperty(\"format\", \"plain\"));\n String data = holder.getProperty(\"rawValue\", \"\");\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69155112762ba32c9ea2bc16755266de3e89aaf19891798f8ad6c21f0589accf", "structural_hash": "6dffcfa67e60e6b2e6a558f2e3d309d72da817972540d5016acaa779a6a3d60f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01417.ts", "upstream_id": "BenchmarkTest01417", "language": "typescript", "code": "import { Body, Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }, @Req() req: Request): Promise {\n const userInput = (vars?.input as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49b09207180a5f4a141e8f164af2792dd9367140c4e89ed60e6d1462571f5920", "structural_hash": "ccf1f2ab80d02b0526d775d85de02cda4f4e47a4a60c8b4480db60e09a0b3398", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_15704.go", "upstream_id": "BenchmarkTest15704", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tdata := fmt.Sprintf(\"%s\", commentText)\n\thtmlOut := \"
    \" + data + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-86"], "category": "invalid_chars_identifiers", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a931be343e91abe6f57b5a1c7d9b2bb3f71f03b5b849fa4dcf1b7e85af2acc1f", "structural_hash": "c76f985061ef8762ac4b496e5e7d622395f4ae030c7fec3635f58299f60e5b42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05511.py", "upstream_id": "BenchmarkTest05511", "language": "python", "code": "import logging\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n logging.info('User action: ' + str(field_value))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a32b5a4dddb6936add11647e79b7626a8f0bc2ef52695e68528da54e98cb3132", "structural_hash": "1902b70a1014b7c7be888c4b249464068fd070185ee679a7bc2d7321453631e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07068.go", "upstream_id": "BenchmarkTest07068", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := strings.ReplaceAll(graphqlVar, \"\\x00\", \"\")\n\thtmlOut := \"
    \" + data + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6440ca763bb5b04148d6002cf494a8e814d4dc3aa20635de42866af72e304661", "structural_hash": "ddf31a2203fa38a93e3fe106046405817e0a99b8e0a498c21e71eca7cf8eb235", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00020.cpp", "upstream_id": "BenchmarkTest00020", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6141d4d4782ce8521609a35c6b54da690b6a19f4a3f2a631daa183e03f2e21f7", "structural_hash": "7fcecf223b0e8c1bde008947cee2594258beacfa2a52862fdd8342e8c7477418", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08271.c", "upstream_id": "BenchmarkTest08271", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37c7532f872345ef05f746de732676be30c253a7015301e26b49a2e6626f2abb", "structural_hash": "aaa79e1d2fc38bf5875d4eb0203aa6b37b5a03a837104c7c24e2c5241f13975b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00147.ts", "upstream_id": "BenchmarkTest00147", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const data = userInput != null ? userInput : '';\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01e2b9e97cc4ad80bb65bbe5d6a34f0a6de83fe87a390fb0f220908a44e18825", "structural_hash": "12ca6a04713c612e6afbb28e95fc6f1fee7be3eff104b6674cfc2f7d4b6c1c94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04287.py", "upstream_id": "BenchmarkTest04287", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n parts = []\n for token in str(header_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n return JsonResponse({'status': 'ok'}, status=200, headers={'Content-Language': str(processed)})", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc7a35e2dbd9236ba1a259219b1c0494bc927672d632c8cc5e188ff61851f120", "structural_hash": "1479df3b2cad57f2006a8a81c247306850279ed3f2a12f5124cc1107d34c98f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26395.sh", "upstream_id": "BenchmarkTest26395", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "555dd3b261bcc040d14cb3b6b75896122c054bc6dbc79d2673a4a5bb082913c8", "structural_hash": "d5ba6b000c9d83b76d99f66fc27d677917f609b76ed28d2f381eac3ec03628d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04399.go", "upstream_id": "BenchmarkTest04399", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(rawBody) {\n\t\tdata = normalizer(rawBody)\n\t}\n\tencrypted := encryptForStorage(data)\n\tos.WriteFile(\"/var/data/secrets.enc\", []byte(encrypted), 0600)\n\tc.JSON(http.StatusOK, map[string]string{\"stored\": \"encrypted\"})\n}", "label": 0, "cwe": ["CWE-313"], "category": "cleartext_in_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0269bc60bae902243a6d801c31bf236d259b66fbbd3c21b2191b9ceeda43e618", "structural_hash": "76d241e3af7ac494c32abc1415902e6803d3cb391f3ee912187eef365a3792be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01623.ts", "upstream_id": "BenchmarkTest01623", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = `${userInput}`;\n childProcess.execSync(\"echo \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "702479b89e124dd9f38206bf746b92dcbf0263e438f6deaed5a02df710c87f2f", "structural_hash": "b522e353e59cfd60ffb7ebbe221f546f6302fd5ed13f0d201b63e7e66aecb67e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02226.py", "upstream_id": "BenchmarkTest02226", "language": "python", "code": "from flask import Flask, session\nfrom flask import request, jsonify\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n data = forwarded_ip if forwarded_ip else 'default'\n if session.get('user') is None:\n return jsonify({'error': 'unauthorized'}), 401\n session.clear()\n session['user'] = str(data)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d19062de59e6cfbc5413547eb7a36fb01d199c64da392aa9af3d22b10792af0", "structural_hash": "bad04f5cc29dc17242b2660757361a1f2ffe710589adb9a4ed0bd4c7c6dd9acc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04893.php", "upstream_id": "BenchmarkTest04893", "language": "php", "code": "header('Authorization', '');\n $data = call_user_func('strval', $userInput);\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return response()->json(['validated' => (string) $data], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eab58a4d08616452ab73db48dab9e94f48431c39c5404e1ae285915a18ef2cab", "structural_hash": "cff5c9123e15f581ddccc3dcbe401fac85a84eef6f3f7164b3d8f7e11bf106ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04683.py", "upstream_id": "BenchmarkTest04683", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom starlette.responses import JSONResponse\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n data = '%s' % (multipart_value,)\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d21149d515deaf0c351be091cd500cd90f7f9cf76cd020a6af69281195decfc", "structural_hash": "e4d4c040112740c209955458722daa2334899046dcfec7e4d78c36cc06a2cefe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01777.rb", "upstream_id": "BenchmarkTest01777", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n Net::HTTP.get(URI(data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c24b09bceaef3156b39a936116d68b5244c75e600777dc5cf741c2daaf7b2d48", "structural_hash": "92717a629b6f00692219a3d4423ad10196ca94bb3bfb6d4f196f3401c5b6d758", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24699.js", "upstream_id": "BenchmarkTest24699", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de3bad8e50c8288ff03f9b0ade871d4fdcf055a0abf0ce1a836513df447323d3", "structural_hash": "ea20714eb9dea9039005ec00fb205a9f8c2329663c218863645258d89021720e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01289.sh", "upstream_id": "BenchmarkTest01289", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=$(printf \"%s\" \"$user_input\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n mysql -e \"SELECT * FROM users ORDER BY $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ace954d7e2d2aeb246f71c915ff5e1ad67a0c50b70c1faf70b22bc217470bb8b", "structural_hash": "eae86ef5d791509eedc7bc8d62668fba2ff4c7f4dd2a75ba802152690e0bc7ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22125.sh", "upstream_id": "BenchmarkTest22125", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac2cc7ed4d0b31b9f7f87b1351907f39d3f2a289bc41e81c19e1e2c9ac193815", "structural_hash": "40e47c128287d64aa246f820c1befdcf30488d7742e74e233606b05fd577b467", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04478.rb", "upstream_id": "BenchmarkTest04478", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n requested = data.to_i\n wrapped = [requested + 1].pack('l').unpack('l').first\n render json: { wrapped: wrapped }\n end\nend", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f00ce39c8c4de644458b3e1025f762dc10814fb4ff6e2a5ed31af9594a0f8834", "structural_hash": "f75cd400d137d782f1354423da3f6465ceef719cefca39fd4de7887a9da1a31f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27341.js", "upstream_id": "BenchmarkTest27341", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n ctx.redirect(\"/dashboard?hidden_field=\" + encodeURIComponent(processed)); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f05a52f9752fc00c29e6f801597599e9b361135521cf6f3c85eb09baa1c365c", "structural_hash": "6fd3e0de3e538a6588b27268a2dbec93e200af75af7be6fed72ab61bc2df7396", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04975.php", "upstream_id": "BenchmarkTest04975", "language": "php", "code": "fetchOne('SELECT body FROM mq_messages ORDER BY id DESC LIMIT 1');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $errno = 0; $errstr = '';\n fsockopen((string)$data, 80, $errno, $errstr, 30);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3665cd7e5bc620509214ccc26b71e463c9c7973fa00240b5915e94cf40e93241", "structural_hash": "5a9c27e54b47af521078ab01a99389e3911bb6edeca6a75a29d9fe5ed4f0ed96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31506.sh", "upstream_id": "BenchmarkTest31506", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f2a3190b519474922f79a68d0db5609d2ed94fcb178af17622beedff55b0bd6", "structural_hash": "042f4b6111126c052cb69157b31153f39c65af7035857cb5dfb2f2e04a23d118", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31308.sh", "upstream_id": "BenchmarkTest31308", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n trap 'rm -f \"$tmp\"' EXIT\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4036c72432a5ee723c76a5559d61885175d72208ceedd8fa4eee3b058def0fa3", "structural_hash": "1c378fd57541b882bf2323dcb662f1d525b055762f23a639c3ecee9d1336045d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01564.py", "upstream_id": "BenchmarkTest01564", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n parts = str(user_id).split(',')\n data = ','.join(parts)\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return jsonify({'name': str(value)}), 200", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a88f5c20a953e59522ea0bf633836a03194fcd1b09bfdbeb032f9a4a772e1cd4", "structural_hash": "f01e3ba210cb60b354ac1bd4c1b57185254a4554cafef9b95c52e1eb2a50c0b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_26928.js", "upstream_id": "BenchmarkTest26928", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n try { JSON.parse(data); } catch(e) { }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0a1332b53d9e6df9b2fa62ac1d6159cdf7d08af21fe27de79fb007f3e7f603d", "structural_hash": "ded6a1b501ed64ccbc1458d0634ed3924c09d925037425fcb346fd68764a21ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05921.rb", "upstream_id": "BenchmarkTest05921", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n render html: (ERB.new(data.to_s).result).html_safe\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12cd942128f108b027bc5426be36363ff0f903424f592e3a1b72ca54b4a0e5f2", "structural_hash": "9c4ffd25614f03dc6300b3b6b656e5945f040db01f45b3150ce24e328a2f95a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03878.go", "upstream_id": "BenchmarkTest03878", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- jsonValue\n\tclose(_jobs)\n\tdata := <-_out\n\tprocessed := data\n\tif len(processed) > 64 {\n\t\tprocessed = processed[:64]\n\t}\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adb44cfbb9174353bdf7c1b35a0c10c50f3615f861af31c1ac743c211c7667bb", "structural_hash": "e3e7edfb66d1d80453e9ca35e3845b9643357442e6bada917413a9c5bcae1dc2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05133.ts", "upstream_id": "BenchmarkTest05133", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n res.status(500).json({ error: \"Internal error\" }); return;\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1dd566c29eb2ca5ff973e9c74e7a763b7f16d96ec868f5da10662c1236b79527", "structural_hash": "f9c98d3293f2b9d9985d819a85312f4a31c17e5bea4dd7a6fd8e0e81f62bf91d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_38242.js", "upstream_id": "BenchmarkTest38242", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n if ([\"https://app.jscdn.io\"].includes(data)) ctx.set(\"Access-Control-Allow-Origin\", data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "daab0955e04f2c1b674ad86ddfa57bd33e745711f345b681f7753b5b02bdd6ef", "structural_hash": "d1b89ef98da36a48c3bdf3b88d9db3aab584452dadaf087d498e6d0b02cebba1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_21695.js", "upstream_id": "BenchmarkTest21695", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5e07ae74e1fdc6ff5af8dabb495abbf29c8a0c2b387c3874cc69cee152645e8", "structural_hash": "eb9fd2b9a81868878ef3397e0d70c31e5f45f233b00e61c6bcd508f77ec544d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04760.php", "upstream_id": "BenchmarkTest04760", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$userInput, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac6140b3569bd09a67908cbea9aa6d4783ca837a066984992d21b7dd63d758de", "structural_hash": "a9e088efd028fcbb819e061e762c05febfa8ddd24a8f04818cc7fa1523d5e6c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04013.cpp", "upstream_id": "BenchmarkTest04013", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20055e0d3ae85d5812cb50358e68ee12bf86d5242344c2b1bb863c4806ae0daf", "structural_hash": "9712bf9814506700c8365ddb4bba3ca0f58901a868b23a010fdf5bb26e9048fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03382.rb", "upstream_id": "BenchmarkTest03382", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "373d6e1432c828d5f7a3815862a136c26ce3497692c159d58010261a96627d1d", "structural_hash": "b9fe106b6ed8b192d90366c655869d060ab5c6c7b57a900b271260515e0c05b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02490.c", "upstream_id": "BenchmarkTest02490", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n unsigned char _digest[16];\n MD5((const unsigned char *)data, strlen(data), _digest);\n}", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cee7919f5299bb6e729c94b33a852ea5d3bec641394baf30f13dc6fcc9441d34", "structural_hash": "2fa1d34baec062551ecf8ffc467711de60fd04962af0dea8bd9c74274df46fe5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01618.cpp", "upstream_id": "BenchmarkTest01618", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87e067009cd6112de69183993825e765ca466174866686b988e4f5ac61874047", "structural_hash": "dd03b299a48a0e1fa43bbaf7041c858ad4199dd57ef433607814c9b6bee313be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03162.rb", "upstream_id": "BenchmarkTest03162", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"config_secret_test_abc123\"\n data = Thread.new { user_input.to_s.strip }.value\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n content_type :json\n JSON.generate({ encrypted: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34e65f88fb9bc7b542e97bf79a5a2b5b1935b19c6cb9c0668ce08f2172a50be3", "structural_hash": "940b5ab06ca85fa6a6f0486f254b9da627c480ba52a389662a6e3f5a20bbacc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00924.php", "upstream_id": "BenchmarkTest00924", "language": "php", "code": "header('Origin', '');\n $field = 'data';\n $$field = $userInput;\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d834cdc7c1658d8c789e29da5ff57a3937c1bf4410e06e2120b2d980876e4417", "structural_hash": "24bbe5b6f004d18b7fad68f4a5fe650818917018b5b6ee7b3693330b367679f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02867.c", "upstream_id": "BenchmarkTest02867", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "156e129ce14cc5524b5694b770722e5111acff34d3518b62e6c5832c073e9035", "structural_hash": "97b86d859f3b7ad8376dd2ef8e36465c044efbb37f940cd93b73806176659912", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04635.php", "upstream_id": "BenchmarkTest04635", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $data = (!empty($userInput)) ? $userInput : '';\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c542d02c3b5bd709aa794dbca251c7547acdf85ab0f5726a5b5feef36d986686", "structural_hash": "8d5084d210ed9d1b4a0ac1ab091ede4cf6fddad3264de257699487240bc191a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02523.rb", "upstream_id": "BenchmarkTest02523", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f9899096de6e0c44b53a3d0bbb146509e1e7960b31f51c903303a74bfa50086", "structural_hash": "d89ea74831d6274eb603cd2c6aa4cc2f9c609bc6c1f4c41a052242a448ceb722", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02119.java", "upstream_id": "BenchmarkTest02119", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = xmlValue.replace(\"\\u0000\", \"\");\n return Response.ok(data + \",data\\n\", \"text/csv\").build();\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3d506c68af81fb26eebfb3c7ba9d7420f2b3192d4c7b48c379bf7690b87e498", "structural_hash": "c873f878a7c837462885477f67ac6c87aca29364deedb9f08a73174bc05e3789", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04621.rs", "upstream_id": "BenchmarkTest04621", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n struct FormData { payload: String }\n let data = FormData { payload: multipart_value.clone() }.payload;\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return HttpResponse::NotFound().finish() };\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "851f9c865235caa557e160026fd2218f89f4367f9b80efa8d618af227a6f2205", "structural_hash": "b56f2dc85bcf2fb84fe112cb27e2838a3ceed2bd446baec30a9520b9ccd58091", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05454.ts", "upstream_id": "BenchmarkTest05454", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n if ([\"https://app.jscdn.io\"].includes(userInput)) res.set(\"Access-Control-Allow-Origin\", userInput);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c99629cada07925f983b763ff12f04ae642003200f95d17b61c1bcb880ad4ed", "structural_hash": "b6934f846c6d5df61c08d457b1e61503b62104378c7a7ef5272ccb151d2071b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01860.rs", "upstream_id": "BenchmarkTest01860", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"secret\", \"p4ssw0rd_test_xyz\")]); m.get(\"secret\").copied().unwrap_or_default().to_string() };\n let tokens: Vec<&str> = secret_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let _ct = crate::shared::encrypt_with_key(&data, \"sensitive-data\");\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "750de6433c20028f9b49093235f49d06df754b6458eaa729ea4b03701bbe8a02", "structural_hash": "d39b5b7c6da82d791ee07a65b8f5312b24d47c49efd376089f580575a340dee5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03328.rb", "upstream_id": "BenchmarkTest03328", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n headers[\"X-Custom\"] = data\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3954da961e06d0093f2c721e0075f774a74c46aa159cd0574410069431065971", "structural_hash": "d24eefe9b8a2b46a1f75423d2423c642fe1a0d4595e3c4701b04639558c799a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08357.js", "upstream_id": "BenchmarkTest08357", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = \"\" + userInput;\n JSON.parse(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d8a479d7b509be3546bff213ffb12c0a50017818e1ecbc411b063f837f2ee8b", "structural_hash": "9787dc5524e1bc7f7811e05892b8ed04442fc748a5a1dd44789a84536482f624", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14479.go", "upstream_id": "BenchmarkTest14479", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\t_prefix := \"\"\n\tif len(pathValue) > 0 {\n\t\t_prefix = strings.ToLower(pathValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = pathValue\n\tcase \"f\":\n\t\tdata = pathValue\n\tdefault:\n\t\tdata = pathValue\n\t}\n\tblock, _ := aes.NewCipher([]byte(data))\n\tblock.Encrypt(make([]byte, aes.BlockSize), make([]byte, aes.BlockSize))\n\tc.JSON(http.StatusOK, map[string]string{\"encrypted\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-320"], "category": "key_management_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "446fe4d9f3ae4ebc2f72db97f89946abd8e862ecf7e33b23f2be4dcdc1651c2b", "structural_hash": "60cacffe5187deca0d56e6ce55a2ec8606a0466d7fff85024645f559638810c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17670.c", "upstream_id": "BenchmarkTest17670", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n char *_found = strchr(data, '=');\n printf(\"%c\\n\", *_found);\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4fa9a66ffdfc89c4824532f0618b0d4c65944f6eb08e7e6b6b69f6924c932f5", "structural_hash": "5a293603e358ad8621d84402815de7d3f75d9f22698ad1d015097599d8cc83db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00613.js", "upstream_id": "BenchmarkTest00613", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ece1b260cfaff360f64841ec77ea5d170e0172ffcfa039311883fe81234639d", "structural_hash": "c9c169e15fb835dea41a81dbd6dc6cf7bc9f589f9ecb521d3284d381fdf74291", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03537.rb", "upstream_id": "BenchmarkTest03537", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n @user_input = user_input\n data = @user_input\n processed = data.length > 64 ? data[0, 64] : data\n eval(processed)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38006a3f44a4f73c3e4c0b2af17367e4a04ba5451441989ff04988f518b0b719", "structural_hash": "7a86e8753f5688a43c45fde552f02eedc7aae18637fa1b34da083e6d4ac29895", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02447.java", "upstream_id": "BenchmarkTest02447", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n FormData payload = new FormData(headerValue);\n String data = payload.payload();\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b5bd7db6c0bad83167f1bf84d21f0bf0d99d3c9f35ef94d497d0a1262bb8537", "structural_hash": "d375923cc85188c0a6ed00cccabf0b0989a3a29c678bc6dcc5de964b8d5a6675", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02011.c", "upstream_id": "BenchmarkTest02011", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n unsigned char _digest[16];\n MD5((const unsigned char *)data, strlen(data), _digest);\n}", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18f5647033d46d599aaaa909238c8f7e05965b4a2f751002322fa84a2c8f7851", "structural_hash": "a0dd09474236295e41421ed446791a5196a351bdf04386efc7031cde7d3aa477", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04980.rs", "upstream_id": "BenchmarkTest04980", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", user_id).ok();\n let processed = data.parse::().unwrap_or(0).clamp(0, 2147483647).to_string();\n let requested: i64 = processed.parse().unwrap_or(0);\n let count = requested.clamp(0, 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b2f286efd15e049d708a70154762b5b385a2612de51c12c8e49f93ae9bfbd9b", "structural_hash": "a31d14fc1ab096da44a6fe8d669bc64de00135ad2dcf764b0a06c1639bbe7e81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03180.rb", "upstream_id": "BenchmarkTest03180", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n render json: { error: \"Internal error\" }, status: 500\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88b829d6dfe5e864bb13a6a4bc1352ca4f418c5d6f5652f647ea056925de2cc9", "structural_hash": "1de6dab8b8114bc64354ac92c45f988de358c6b3aa45dee0bb58085b572c7efd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03002.php", "upstream_id": "BenchmarkTest03002", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n eval((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "814479060abead8cbb0bbc8f3cd1dce68b3ed6af33901356910f2ff0aa73587c", "structural_hash": "1edd0c02f5ec27b411f3b8cef8e130df1d61875983daeba26bd01e7a0e062169", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02267.cpp", "upstream_id": "BenchmarkTest02267", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d0326a096199149847afcc1add94200e570498ac94c8885fd38c8fd928875d0", "structural_hash": "a1c580d16636975bbf137145f3324345c03f32bb14de835302c01ae8852f3a2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08416.c", "upstream_id": "BenchmarkTest08416", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n FILE *_tf = fopen(\"/tmp/app_export.tmp\", \"w\");\n if (_tf) { fputs(data, _tf); fclose(_tf); }\n chmod(\"/tmp/app_export.tmp\", 0777);\n}", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78377ec0958ed994aaacd67ae589fe333adefbbf9f94e53d70388eca1ac8e4f0", "structural_hash": "13840182308d3d1ce7d2af8e4fbe5de41c18917d50ad8147f14a7a480a4fd077", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16115.c", "upstream_id": "BenchmarkTest16115", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char *_p = malloc(strlen(user_input) + 1);\n if (_p == NULL) return;\n strcpy(_p, user_input);\n free(_p);\n free(_p);\n}", "label": 1, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ea4f1b29945ce3a0369a95583b34ce04dcf4811343ca5aacf9b862ae73640d0", "structural_hash": "1b8af99f79652def0ceb908f407832ecbf1975cf448404bdea6f67363e6dbf83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03050.go", "upstream_id": "BenchmarkTest03050", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tvar data string\n\tif len(cookieValue) > 0 {\n\t\tdata = cookieValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tloginAttempts.Add(1)\n\tif authVerify(\"user\", data) {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3d394df6282772a5b3d098faa6cf8881d4cb4f85fc96d77f84eae4a594096ec", "structural_hash": "07a31f99462b096fe7f82b747dc59f9779660430accbc911609032ff470b9624", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00799.php", "upstream_id": "BenchmarkTest00799", "language": "php", "code": "name;\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce51813ad05fc35e9add383a66f8e5e6a1652dc6bb5f5be9132d533e64171e9d", "structural_hash": "f6417031a0ff5d2192929fc96163c634e1e59491bfff7e440b09432197e25030", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01746.php", "upstream_id": "BenchmarkTest01746", "language": "php", "code": "input('field', '');\n $data = trim((string)$userInput);\n register_shutdown_function(function() use ($data) {\n simplexml_load_string($data);\n });\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "643caff6a1f560128437eb27d27011476893b11b601732a62b99bea10b19e02e", "structural_hash": "21e5a32149ce3dc2614fabe136d0666e83c3f836e86d575921e4f02a682fd598", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22014.c", "upstream_id": "BenchmarkTest22014", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_passthrough(user_input);\n (void)data;\n if (setuid(65534) != 0) return;\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12418631cc4013cd7220b164b11dd4b64295d97b1d78801b7613d02474b94d66", "structural_hash": "2b87947f4d4c22ea6842a3fc60d09adeeeaa63cf85fa69d5818d9a1941ab9ed1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01504.py", "upstream_id": "BenchmarkTest01504", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom lxml import etree\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n parts = []\n for token in str(multipart_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b5ac9eb33aceefe18616dd8570255b8b2c07c0a6ff3ea037283fd79151bcf39", "structural_hash": "904983fb35c4f83e8e4ea472ba7aead427d7eaaeef5f142bff14a0a6ecfa466c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_02956.js", "upstream_id": "BenchmarkTest02956", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const data = String(userInput).slice(0, 200);\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a859b36f7ad51cb00025dc7d6d47ec190b03a5a4400756925756fbba1a8a7ffb", "structural_hash": "f913df55b5dac26f8d0501e6a526458988f88f8c7bd83e1e1d1ae94719f1a3e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04903.py", "upstream_id": "BenchmarkTest04903", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nimport os\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n parts = []\n for token in str(header_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58bbe86af561bdf79fe7663ecdc322af5bced7ac08f71c5a95ac59ebeff94cea", "structural_hash": "30fb7c2cb681f44b32400ce46f3553337bffba05695e743e28d4db30b34773ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31135.go", "upstream_id": "BenchmarkTest31135", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tquery := fmt.Sprintf(\"SELECT * FROM users WHERE id = '%s'\", uploadName)\n\trows, err := DB.Query(query)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de096a6ba8e0f0eb69174cacd64fe46c3d4807883922ba699fd978d2386844f9", "structural_hash": "191684937bced5b47eafc5e563670d270f968ce0285310860e5108f1afa69c05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01447.py", "upstream_id": "BenchmarkTest01447", "language": "python", "code": "from django.shortcuts import redirect\nimport json\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n try:\n data = json.loads(db_value).get('value', db_value)\n except (json.JSONDecodeError, AttributeError):\n data = db_value\n return redirect(str(data))", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e05f6f141f9d3cff010f9ad73074d1730c8e917ebd972047054f471db72aab9", "structural_hash": "35d906b791807d2f87e8414e54122853fa1c4dc65df7c255496fc3bb9fe55c43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01748.py", "upstream_id": "BenchmarkTest01748", "language": "python", "code": "from lxml import etree\nimport re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = (lambda v: v.strip())(referer_value)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aceec3004013a9aa36cbe36fad8d38080d26c584346cbe46deed6a84bb009a96", "structural_hash": "33ad2858f44ae09561c4d69222d04501c3d61dd2657c221b6e15954e8ebab8bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04217.rb", "upstream_id": "BenchmarkTest04217", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n data = sprintf(\"%s\", user_input)\n _resp = URI.open(data)\n _body = _resp.read\n _expected = ENV.fetch(\"FEED_SHA256\", \"\")\n raise \"integrity check failed\" unless Digest::SHA256.hexdigest(_body) == _expected\n ActiveRecord::Base.connection.exec_query(\"INSERT INTO feed (data) VALUES (?)\", \"SQL\", [[nil, _body]])\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "735c5cf7243c622337fef505cc1df98922e1b19a4c49a800e52686f185c5f1e2", "structural_hash": "1fc2def05624046195f4b26a8f8a2f833f8163f8fe56bb9c0d26549bf549fd20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_26232.js", "upstream_id": "BenchmarkTest26232", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n if (!authzCheck(ctx.session.user, data)) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-284"], "category": "improper_access_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52610bf2746a4d572c3f9970f02f2000de7a55ed8ecc78b63ec0469e5ddb2a68", "structural_hash": "e6cd956f2039b8c8f89de25e7ffdd8a6e3f2a20d99471a08267c625dab0f2055", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03345.js", "upstream_id": "BenchmarkTest03345", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = `${userInput}`;\n ctx.session.data = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17de4a752c688e5687b951aadabed52ccd985b3a9b483ed84e74a06b1469fd9f", "structural_hash": "fdeff61e4e41f9bbd346c315dfb9cd3fa50945b477c33e052da747b7190a2c58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02317.py", "upstream_id": "BenchmarkTest02317", "language": "python", "code": "from django.http import JsonResponse\nimport os\nfrom app_runtime import db\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = '%s' % str(comment_value)\n entries = os.listdir(str(data))\n return JsonResponse({'listing': entries}, status=200)", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff7ce6087950d5f7afb5b9ff3c51b5aa3a1e012b84b16b3a530512ed9ed61aa8", "structural_hash": "80710f69334e4888629bf5a90b4fe6528c40ab55bd5341ba58e2dc01be31d059", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_39448.js", "upstream_id": "BenchmarkTest39448", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "420585ff2965134b9b63534d141587d534fbf4a9bcccfe1a6f27c7b6b3d3bd53", "structural_hash": "467ada198b81d9eafbf08bc4cc48288eb0849eb35988faeb8e1aad5bbc8dcc18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_34347.js", "upstream_id": "BenchmarkTest34347", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "404535f7e949f689aee062200875244edf015907690414e830355ba1595398ad", "structural_hash": "46b019882c857a6d983f571b2b1d7f41ce200e3b0919ca74f2c99f1cef782579", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05914.sh", "upstream_id": "BenchmarkTest05914", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df4eb2c5a903eda4de7588ff5a5ec6d8df1282f002006168a84a775003a8fb67", "structural_hash": "aec4e50516422f0b19fab8ed5699b9213a1d14e5ffd1a9bb2d909f366dd93fb8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05655.rb", "upstream_id": "BenchmarkTest05655", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n data = Thread.new { user_input.to_s.strip }.value\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df3988b12fe04fdfcdfdfc634ba4f885bdcde7409e417ab2ed0a5fcd2b995ca6", "structural_hash": "03ffbfe7b01a3cb502261c7218e153fabf871561fb07048fb628616ccdb36cec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04647.rb", "upstream_id": "BenchmarkTest04647", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = Thread.new { user_input.to_s.strip }.value\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c491da1a9d7f4a5cafb1360bde353c870cbcff992f447c2eb6c717a87b213f38", "structural_hash": "94b172515b5bb662cb23b4cae85147724549d9c8e2c5f1a708b5f7e9d486fd20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04055.php", "upstream_id": "BenchmarkTest04055", "language": "php", "code": " \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$processed));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23342884e72117fffdf1bfb453130b0473c5d83a28c749f24c0907caca00684a", "structural_hash": "5b8742bb0f7cc9ad838d02bb8b8c7457901b4449739eef35cebea7841a3b750e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00565.rb", "upstream_id": "BenchmarkTest00565", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"bunny\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = Bunny.new.start.create_channel.queue(\"taint_q\").pop[2].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n JSON.parse(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f496640475f2f625458150172491effaeaa74f681f923a2f1cbbc494ee9d500", "structural_hash": "2fad29f7548a454cd9ae2c733c296dfb90de082be894e1b746755de27e8587a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03214.ts", "upstream_id": "BenchmarkTest03214", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a965f9702555061d4d09d11adbb32c00aa61940c72addbcead45f29aa36fd21", "structural_hash": "6fdb6eb313456218da9300c61e9e06fb67e108e0079230172a6f81680d4fedc0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00526.py", "upstream_id": "BenchmarkTest00526", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data, _sep, _rest = str(field_value).partition('\\x00')\n store_cred = os.environ.get('APP_SECRET', '')\n auth_check(str(data), store_cred)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d6da57b0c231f8ac1d3bf96e34283f47bbbbc3726a65319bf07bcee85eef7af", "structural_hash": "14fd21566edc8fc0bb30c4a7d9503c20c2c01b6e500588f8aeca0cdeab4f284c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04810.py", "upstream_id": "BenchmarkTest04810", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n with open('/etc/app/config.json', 'r') as fh:\n config_value = fh.read()\n data = handle(config_value)\n requests.post('https://api.prod.internal/data', data=str(data), verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19f447cb411df8018cb1e89c08df9c7016e100c98e936f8ed50a89a75b577a37", "structural_hash": "1a167f1a280e184e865e72eb79e9f4e05647b35ddcf20ab4e838405141eda235", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04685.ts", "upstream_id": "BenchmarkTest04685", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4bca79c99637d69e615469199ccfb17af30092ce5f44daaaca2784ae2f360099", "structural_hash": "1e91947410d001ffbcad23c4d17f1b3abe5311e60cd6e4a6fbad3e811d998831", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01887.rb", "upstream_id": "BenchmarkTest01887", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = \"\" + user_input\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39097c863f0d2be72bc4167aaf0c5b29e2c99323e1b918e2e632569f61b9d4b0", "structural_hash": "5385141f69c579cc42d0d95e45130c8ed0bd83f28e9aed533a89c61ad09cc2c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01982.rb", "upstream_id": "BenchmarkTest01982", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n _buf = \"x\" * 1024\n _ = _buf\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dbc1c5bdbb718071aca796a6a4d48605a0af4be3176d5efd475fe104c38a0d6", "structural_hash": "bc7712e9c03cf6b105321c7067080bb625f4d614ea67bd8e0b084f44347648ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02619.c", "upstream_id": "BenchmarkTest02619", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "298e8f30a25b19269c33a74711e8108e81df6b24c960eaba2579265da591e6ac", "structural_hash": "0f69e6f6ca339d09cfd82d89df6e9ec3239ce2a9b8f7456ee3edeff6eb0ec913", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03060.rb", "upstream_id": "BenchmarkTest03060", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => processed}).first\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4b514609dccc6513660e4930662fcc17980c2d9b2ba66b94086a3076d11099c", "structural_hash": "335fe51bff377a47c06fd511b1bd3cff24c1b22055022fba154f8b99413c14a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14389.c", "upstream_id": "BenchmarkTest14389", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char *_found = strchr(data, '=');\n printf(\"%c\\n\", *_found);\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78831f133e26b86299e6070972d765f3c25e99269bcc600cfd528e10c72d6b22", "structural_hash": "0bb037610ba27ee53b066503c2f9a5ed665432037cfa9e023166b94e7e49ca92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00283.rs", "upstream_id": "BenchmarkTest00283", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n let queued = multipart_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Access-Control-Allow-Origin\", \"https://app.edgecdn.io\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "055967384cd46e76c654ae8410e2dac956228d8dd3ce0c2136c5d2c088ed4005", "structural_hash": "17c900d19198a10a443357a36916962f3a704d0224dbc2329e32421836fdc751", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08337.c", "upstream_id": "BenchmarkTest08337", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n int _d = atoi(data);\n if (_d == 0) return;\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1eb2508c7120fd188847c097ba70f332b0b0a67a4c27327064f0c1987143824", "structural_hash": "5e1bfbf765573f6a4559851ac596d4536bcbab46dbef399e02dfe6fa60a487f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04821.rs", "upstream_id": "BenchmarkTest04821", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: cookie_value.clone() }.payload;\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed5ccbc734eba34e78a386c81124ae6214d4acfc03695415722404adf8a2e873", "structural_hash": "54660d165d9e06f00ccf35dbde7f9bd40fe659849f9bf078ebbb88a9e504646d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05692.java", "upstream_id": "BenchmarkTest05692", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + authHeader;\n String data = valueSupplier.get();\n String escaped = \"\\\"\" + data.replace(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n return Response.ok(escaped + \",data\", \"text/csv\").build();\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7b14526f8c82ad6f7a3473411bbc04f01fe4c6b61320f733c5ac47d2f75f406", "structural_hash": "2eaf0c094a4738b5e35041140b284d3084f66937858d0a4140bbe525c0342824", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14605.c", "upstream_id": "BenchmarkTest14605", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efd522cbf4152cdbc11b0b2e52cf2f8e2d71e590e7fe30a34798cfb70ea9e5fc", "structural_hash": "ef8a85cc4d6fe3962535f125d23632bc094317ee4d5558e4d3ae21b3499a02fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_40168.go", "upstream_id": "BenchmarkTest40168", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(graphqlVar) {\n\t\tdata = normalizer(graphqlVar)\n\t}\n\tdefer func() {\n\t\trecover()\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 1, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "338c697abf2b75c8032b561c94ae6c8d063f5ab0265735a0e0d04277e25f1d50", "structural_hash": "d38a969d1bb7d22ecc962e5538d8a7be92e112ac943a86254bba4575dd5cbaf4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00837.rb", "upstream_id": "BenchmarkTest00837", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n File.write(\"/var/uploads/\" + File.basename(data.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94bbc35e043fa2eb93f6326b4c49a7d45023b19eb1c9c5fd53944c59eecdc67d", "structural_hash": "1aabb8324c5143771a70dfeb610df10e75800213f1b4d4fdb828535ebd3fdf4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14026.js", "upstream_id": "BenchmarkTest14026", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "399257cc6bcb9fe4d4395719b7a5472bbb0eb3bb58dc337b4f7523e15b4d3102", "structural_hash": "592210c079cb0c2669991a82f49b6c4fde354d3f764043b686e96ecc3121f3b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10892.js", "upstream_id": "BenchmarkTest10892", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f612228d8c6f7ba31d122730f6a4c5ba0815f7b3301b5e3f5c44753ab17e2e0c", "structural_hash": "3f38e2971eb7480b9e278c8b901f7b14d0e3e5463439f614671a0f2531baf563", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03604.py", "upstream_id": "BenchmarkTest03604", "language": "python", "code": "import re\nfrom flask import Flask, jsonify\nfrom app_runtime import db, mongo_db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n kind = 'json' if str(comment_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(comment_value).strip()\n case _:\n data = str(comment_value)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n mongo_db.users.find({'$where': \"this.username == '\" + str(processed) + \"'\"})\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3663393ac01ad836bcb523ac24246f317602d9c9017d95c81e067f0ae8ada124", "structural_hash": "925e5bff077e64a0cbebdc666a5ed9de2a73a23e02b20f1a038fe7d883c33096", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03738.ts", "upstream_id": "BenchmarkTest03738", "language": "typescript", "code": "import { Controller, Header, Post, BadRequestException } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87000088943964372ff2aeaa2c03d29ccf7ccaa283fb89f9547bd626ca918989", "structural_hash": "7bde79fac7101f260860c901ae2971c80619c6e799cba4b49bbf643298671937", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01323.ts", "upstream_id": "BenchmarkTest01323", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data = `${userInput}`;\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b982dd0747f6748c0c1fbb260750c2eba0fd30ddf6296455efeb5626b9844b81", "structural_hash": "5b449debb565453fe347c41ceef8fae2f370e4e2b35fb1d435c39e9c9e2a47b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02446.rs", "upstream_id": "BenchmarkTest02446", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = raw_body.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4419758864572c0fa94aeaa5751f2679efffebde124c9480f1b5ac2729da7f46", "structural_hash": "c64a94488b13059d3bc835c04e7887cbe3deff870318a08ede0a793cf5fdd15c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01009.cpp", "upstream_id": "BenchmarkTest01009", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"User-Agent\");\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dfb817a23d1e0549a77d3523d6e4673e653a685c18473453f14171b89ad4749f", "structural_hash": "7756e7afb3c76b32059b8a1f0ecf4fc036b91548f14df74808430b9c19df9f06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02020.cpp", "upstream_id": "BenchmarkTest02020", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string safe = user_input.size() > 4 ? user_input.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da7665acfd1d0bd3f8d854e015c435ce170332aa7b5833c98cfe223ea662eacf", "structural_hash": "ff5ed9b3e87acfa281bc9141cc1031addc1f27b8feab6c11200ae9d7c219dc01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00647.go", "upstream_id": "BenchmarkTest00647", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tform := FormData{Payload: refererValue}\n\tdata := form.Payload\n\tallowed := map[string]bool{\"https://app.gocdn.net\": true}\n\tif allowed[data] {\n\t\tc.Header(\"Access-Control-Allow-Origin\", data)\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb8ebe73eff5809d37146b98f7b5701e1a96bfb0b055eae7c2f244049a6bc107", "structural_hash": "8e6e7bfe3c1d07cd01187eadd86c77ed29d48dddb089dd5362918ca2d7aee279", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01395.rs", "upstream_id": "BenchmarkTest01395", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", env_value).ok();\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02e2e5f7d80a1edafa45fa8d7d7cc38501c0e2d88fcfaeba2e25bd1cdf63a019", "structural_hash": "ee436b964aa02830e1547ad188efd4d959c3a205c97e7714d3c62f1b5bacadf5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01030.rb", "upstream_id": "BenchmarkTest01030", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n logger.info(\"Action: \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41bcf569565b00ea6ef400361164cc0661c49b0142b0634c5860a297c758b393", "structural_hash": "63259b2d93bd587791aa0309718d62284de00f13ba995d85d4241d4284477cb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10194.sh", "upstream_id": "BenchmarkTest10194", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n curl -s \"https://api.lan.local/lookup?q=$data\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7a15c3cad2d600c6cd458e97fbc161bfadce6bfd303c3811ea1997f258c26a4", "structural_hash": "2b2935718a3083ab9f02e1c57a4350b687e7ef603fdfd5e55e23c56b7a2114f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01825.py", "upstream_id": "BenchmarkTest01825", "language": "python", "code": "from flask import Flask, render_template_string\nimport re\nfrom flask import request, jsonify\nimport json\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n try:\n data = json.loads(host_value).get('value', host_value)\n except (json.JSONDecodeError, AttributeError):\n data = host_value\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n return render_template_string(processed)", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78e73862010e099926c0b699998bcc15d40cac458a24dec0dd103b26cf9631da", "structural_hash": "afd31b795f061a3a84d3bb29ad78a50e67c84f2bafed4e40d45bea6115b60d80", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03725.php", "upstream_id": "BenchmarkTest03725", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $data = '' . $userInput;\n $_body = file_get_contents((string)$data);\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_body]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8958fc1cd9450818bdf425dcd53767c1224409d4178e5ef3dc0c1f4a98f8b69", "structural_hash": "7cfba3668cea64674f69b0073ac437bc6eadb3e8320b5025cdf6a70120fc3158", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02812.rs", "upstream_id": "BenchmarkTest02812", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = match user_id.chars().next() { Some(_) => user_id.clone(), None => \"default\".to_string() };\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "790170905132519ca5d04cc9dc82c9d9eb1e250c11d2d603ad17915a40334041", "structural_hash": "850c2163ac05807e1dc0cc9a0533204fc7dd8bd1bbd76507f3d4267814ef3400", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04372.ts", "upstream_id": "BenchmarkTest04372", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = cookieToken || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n res.json({ status: 'ok' }); return;\n }\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "640c4d2ea6526c11acae7f606f22846948f6892e4d34c059860d519e0afd58df", "structural_hash": "e7c60d64f720cdda9804a41e3d50dd4d4ea1cb13de101700671cc8153be45c95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03747.php", "upstream_id": "BenchmarkTest03747", "language": "php", "code": "query('id', '');\n $data = ($userInput !== null) ? $userInput : '';\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99585bcaeaa6b70b19a169bbd91794fcf7554bcdf21b30cc66a090bceea37489", "structural_hash": "cd254e4123c265f4bf561690f9fea8e93d09c9f05883daa8af4310cbeff96c40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04042.py", "upstream_id": "BenchmarkTest04042", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nimport re\nfrom app_runtime import db\ndef trim_value(value):\n return value.strip() if isinstance(value, str) else str(value)\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = trim_value(comment_value)\n if not re.fullmatch('^[^\\\\x00]+$', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n requests.get(str(processed))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9e3f168751c4249d5d95fdc062630329c60004ccee1e5bb447cc5519b2939ab", "structural_hash": "324e815303e3bcedf2e78aef76dea6bf611ab05a61bd100832b26e06d935178c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05376.ts", "upstream_id": "BenchmarkTest05376", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as nodeUtil from \"util\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "493c5028857da5e00de3b30393723f693eb2ef1f5fd6a5a9c52014b7de23beab", "structural_hash": "25041f2dc6b150fd3b140c081f9df41ccc698d2b41fa200f66de3757ffca3123", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26003.js", "upstream_id": "BenchmarkTest26003", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const storeCred = process.env.APP_SECRET || \"\";\n authCheck(String(data), storeCred);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "547682cfdcd809477c9e30582abb8ced9478899f3ae61f0ff03eff0d46f45dae", "structural_hash": "61350d23e03bde16b7f6a5afd7aeb4741f1094f40e533d21eb633c014e6c0ca5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11876.js", "upstream_id": "BenchmarkTest11876", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n const normalized = String(processed).normalize('NFKC');\n ctx.set(\"Content-Type\", \"text/html\");\n ctx.body = \"

    \" + normalized + \"

    \"; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7db16d408bdfaa19419cef736a3659aa0aee6a4d6af8711fc089a6b96f5ed357", "structural_hash": "233547683111e6f2b36636cce660c074856c17c904a1049f7bbd72ecc388005a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01041.rs", "upstream_id": "BenchmarkTest01041", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: graphql_var.clone() };\n let data = payload.value().to_string();\n Command::new(\"echo\").arg(&data).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e70d145ea51a2877ce0bdd618933eb1ad67427a1319b5374bd458e1ba8decaa", "structural_hash": "b10f57cbba8f74c6c242768c29be273197016eb2de4915e67ea0c6dceec7c649", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03282.php", "upstream_id": "BenchmarkTest03282", "language": "php", "code": "getContent();\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($data); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return response($_elOut)->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f92f307cff03632a9c1acc6fba0a9e2b6cfa1feca9b6edc807b134ba097a4473", "structural_hash": "71747cedb11631b30aeddf2739c5987f339f3b3da6923160b816ab3260f39703", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02443.java", "upstream_id": "BenchmarkTest02443", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"field\") String field, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = String.format(\"field_%s\", fieldValue);\n Object codeResult = new jakarta.el.ELProcessor().eval(data);\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "746ce2abb833e31834bfd199d2633f47db84b5b5db24f548efbc0c6da7de3cc1", "structural_hash": "a184c629da3aa9c729b35c5be9447d80ad4ca160f96729ecc14c12ca821145ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02748.php", "upstream_id": "BenchmarkTest02748", "language": "php", "code": "getContent();\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n $valid = is_string($data) && strlen((string)$data) < 4096;\n if (!$valid) { error_log('schema validation failed'); }\n $processed = $data;\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$processed), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c28af2f93ba13cdc644ff8a4543f2afb27c2d99e9df1deb946c9e05f925fcf8", "structural_hash": "c71211a9565e11768dc0441724c11f97e1a6180dd8f415fb47e40b2a37e074ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15173.sh", "upstream_id": "BenchmarkTest15173", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf85b69d59f446aa3c778ceb30e834d34f34e2d6c697b422c3170d28dfd99525", "structural_hash": "73312e99741d238dc09bd9a064f214edd7069537bd25b0aab28090f06828fe55", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_22046.go", "upstream_id": "BenchmarkTest22046", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(headerValue))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\tc.String(500, err.Error())\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "191607f8fcced662586c46831ec6422dbf658b643d304160bf1e49672a33cb6d", "structural_hash": "559d5d68de029572b4950b4d7bf540226bc7117390d7c8d83f5be33f2d58e865", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_37519.js", "upstream_id": "BenchmarkTest37519", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = userInput != null ? userInput : '';\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-284"], "category": "improper_access_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7fb6a4dbab3f9e9ee03fc558efc1d4f281a272e664b96ce97a577f8c2dd2025", "structural_hash": "37cb6eed5dc47bd6f90ff72cbc784454ad73036eee5ac239147a1520b217bb05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05085.py", "upstream_id": "BenchmarkTest05085", "language": "python", "code": "from django.http import JsonResponse\nimport os\nimport json\ndef benchmark_case(request):\n env_value = os.environ.get('USER_INPUT', '')\n try:\n data = json.loads(env_value).get('value', env_value)\n except (json.JSONDecodeError, AttributeError):\n data = env_value\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0029262a45a4230b6d712b6562c5d36bf2ab8713da038998fa420ab1046e9e3b", "structural_hash": "a72ebb9ea6f801a74ba0dbbfff3776235fd9c0269ad80598d139df620cfa5c8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05313.rb", "upstream_id": "BenchmarkTest05313", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n trusted_claim = parsed_bool.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a306e4a3f6f2b11fa218a538b826178dbd7fe788a4a9c6259542d36d6748dabd", "structural_hash": "7d6f2763f6a259abf8a8e5512a84323c0ca4685fa0922fbeaa4de67737bff31d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00631.py", "upstream_id": "BenchmarkTest00631", "language": "python", "code": "from django.http import JsonResponse\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n ctx = RequestContext(header_value, source='form')\n data = ctx.payload\n if request.session.get('user') is None:\n return JsonResponse({'error': 'unauthorized'}, status=401)\n request.session.cycle_key()\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f882f0b78a565e998b8b36b9993165f986fccee93f8971988ab9a73bbb9ece1c", "structural_hash": "5e336c821047edfdd6f60bbebd0a57eb4aae8e2e5dad41085508807dbd3a4834", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03444.rs", "upstream_id": "BenchmarkTest03444", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(field_value.clone());\n let result: Option = std::env::var(data.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38f7e3aaac190478c8ccd373cb9045af81dda509c66655ebe14b78ecafe2ed05", "structural_hash": "23024a2c42a78d5cfa382a37a24511c78787abbfa41ad03a7decb3028eaf46ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16572.sh", "upstream_id": "BenchmarkTest16572", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c28751a24d292980304d3a9188fc897c1f6abda82c7e6417ae75ea66a08c2032", "structural_hash": "764aae2ae5f3fe69e30a575c4470e49688319b93c4cc73410b91ddc498252e96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19787.sh", "upstream_id": "BenchmarkTest19787", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf 'SETTING=%s\\n' \"$processed\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14ad8d8025ca8bad4af7c6910e71fb3198dab492caa7c868132d4767b9333878", "structural_hash": "f7b5205e16c1ab568d8c13611d4ce4e83563491175db3880e19e90bd18aaf134", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_21040.go", "upstream_id": "BenchmarkTest21040", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- userID\n\tclose(_jobs)\n\tdata := <-_out\n\tallowedBins := map[string]bool{\"ls\": true, \"cat\": true, \"date\": true, \"whoami\": true}\n\tif !allowedBins[data] {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tallowedBin := data\n\tcmd := exec.Command(\"echo\", allowedBin)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97d0f892ce3373c5e04ee5201f446ce840f02541972c933d44ababdc08e7e108", "structural_hash": "2e6152998e38e246c86aef2b9357558748d12015ef03dd64453be47a4075f3ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02799.ts", "upstream_id": "BenchmarkTest02799", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ba90fbba55e0c79a8415b8fbd5d9168f8373e327b1562bd4eabffc9a7092e3e", "structural_hash": "c642ad8d282cbeb2d9dc575a11d4776e73fc22f71ab273c9120e48cf17e8b6c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07002.sh", "upstream_id": "BenchmarkTest07002", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86f76942296046b96ea48045c5e3d316cfe38ec64919f89933b08d7770552d5b", "structural_hash": "615b619b0c9a1fec013ae18d85d0ea4fdf750bb8194d7ec86aa8e3b30def9f80", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_18319.go", "upstream_id": "BenchmarkTest18319", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tform := FormData{Payload: originValue}\n\tdata := form.Payload\n\tallowedFields := map[string]bool{\"name\": true, \"email\": true, \"bio\": true}\n\tif !allowedFields[strings.SplitN(data, \"=\", 2)[0]] {\n\t\thttp.Error(w, \"field not allowed\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tparts := strings.SplitN(processed, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "debc07f688eae3194634c20ac96aa1c834bae896e00d2f376175dcbbc5fd8efb", "structural_hash": "544cbf86980c82f6176a057d94a8bd647a3545e2b1af791a0a2dcf655833ffcf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02781.rb", "upstream_id": "BenchmarkTest02781", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = format('%s', user_input)\n _resp = URI.open(data)\n _body = _resp.read\n _expected = ENV.fetch(\"FEED_SHA256\", \"\")\n raise \"integrity check failed\" unless Digest::SHA256.hexdigest(_body) == _expected\n ActiveRecord::Base.connection.exec_query(\"INSERT INTO feed (data) VALUES (?)\", \"SQL\", [[nil, _body]])\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03180797ce51747254468f9dd29676949c72c5372d22262944b5aceae860e506", "structural_hash": "7d81aafb3560038f1b2d20d74d536654976672a6bcfffc13c5431496473ef921", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06629.c", "upstream_id": "BenchmarkTest06629", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", safe);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97b9eaa6bc413e93acc437fb1676c2fa7e3723224abc7aa4394596575181e433", "structural_hash": "b7b227e415f1d065288b7fb781e9a7b60be190a4fe8ed7b36b71d740f6900178", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00188.py", "upstream_id": "BenchmarkTest00188", "language": "python", "code": "import logging\nfrom flask import Flask, jsonify\nfrom types import SimpleNamespace\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n ns = SimpleNamespace(payload=comment_value)\n data = getattr(ns, 'payload')\n logging.info('User action: ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc76a2a2cc092f4feb349e52fb44e9c54503b8cf7c4e92271156ef52fc138770", "structural_hash": "52d4b797ac862a129f04d7ef9d11a9dad71cc9f38a9e81ca9b51b0b09188dd7c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01564.sh", "upstream_id": "BenchmarkTest01564", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n printf -v data \"%s\" \"${user_input}\"\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07ec72e3a95d95fda6ecc699a8b35891cadb71124aaf8f772f48f58c8baa9d53", "structural_hash": "aae3956e1ff83b0d64834d75b565a729d27ade5b636c9c32d557911b0ed4491a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02219.rb", "upstream_id": "BenchmarkTest02219", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = user_input.force_encoding(\"UTF-8\")\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41976a7494e3a031c4d8024cd4dddafc8a5168286102f9ac3153e3368fbe836e", "structural_hash": "ba7b4277f6c0f1f997749210347e778e8dc0ded517ff380701b9d77a1a25ca31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08425.go", "upstream_id": "BenchmarkTest08425", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tpending := strings.Split(multipartValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tallowed := map[string]bool{\"https://app.gocdn.net\": true}\n\tif allowed[data] {\n\t\tc.Header(\"Access-Control-Allow-Origin\", data)\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-346"], "category": "originvalidation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b4d18d257a1d2eddc8f5b62287da127b680e70a2fbfa8be65be330cfa815bc7", "structural_hash": "4398d492656bdb35f230652d774e3b360bc09c4ad2c16be0039065e21f59a2a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30716.sh", "upstream_id": "BenchmarkTest30716", "language": "bash", "code": "benchmark_case() {\n user_input=\"b5Vc8Kp2Mq9Lr4Wt7Jz\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n curl -s -H \"Authorization: Bearer $data\" http://api.internal/data > /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cb98ec7ea8f6354be5b5f1fc1980f8665d7edc1931ffdd49605013149f260dc", "structural_hash": "afffcbd8438e92a1c856f232f2bb579d35c7af73cecf2c2bd81332579fd97b12", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02006.cpp", "upstream_id": "BenchmarkTest02006", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f8030618c374591bb0a8d84d434e6d088c08c6fee959d372806fbf4ac14d370", "structural_hash": "40865693ebfd4d6d187eac7e18b0a6561d1904177b1d2e917713ec9920b16a31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03411.java", "upstream_id": "BenchmarkTest03411", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String data = String.join(\" \", commentValue.split(\"[ \\\\t]+\"));\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n javax.crypto.KeyGenerator keyGen = javax.crypto.KeyGenerator.getInstance(\"AES\");\n keyGen.init(256);\n javax.crypto.SecretKey key = keyGen.generateKey();\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d5e2767eb8f032bdbd31f90e0fd52855f1cd6909b5d8c430c0e511e7275518a", "structural_hash": "ce0ca44a4d16367f900789f0415e81864a00b8417be258022436da273b6232ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02598.php", "upstream_id": "BenchmarkTest02598", "language": "php", "code": "getContent();\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$data . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4196ca71606400f8c98b9b2bf93b5af739748681cc2d9abe524bb75159c8ebe6", "structural_hash": "e357bd4c6638b8b83f3542344f550d4b0182f77b1784bfb6659225abf8b8b207", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24439.js", "upstream_id": "BenchmarkTest24439", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { ctx.status = 403; ctx.body = {error:\"host not allowed\"}; return; }\n if (!allowedHosts.includes(parsedHost)) { ctx.status = 403; ctx.body = {error:\"host not allowed\"}; return; }\n const targetUrl = data;\n ctx.redirect(targetUrl);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1022"], "category": "window_opener_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95339b4cd9d8c2327f533ade3ee624874ebf7d588df77d38ba208267c61266cc", "structural_hash": "a7bf106954272a8cd13f638d7b30b227ec38a78983a0aebf6e4fe33b08345597", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26590.js", "upstream_id": "BenchmarkTest26590", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4610ed7e1d491c08be08c0b1495ed46ded3a9809fb0af1b47f00860222874eb0", "structural_hash": "e55dd938bdfaa3a7cbf573f33d52a213e94a2ce83fe1ed9a5d0e46c3a1dfcdac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03126.rs", "upstream_id": "BenchmarkTest03126", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n let transform = |v: String| v.trim().to_string();\n let data = transform(multipart_value.clone());\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95c8135fb8df23c987b38f5d57a4296cc2c8bcba4d3e76de66efb70f96405bd2", "structural_hash": "1e075d6fab8d818f6221318f364f8c06950247e9bb692f8c01556383ffa3ebbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_15227.js", "upstream_id": "BenchmarkTest15227", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.redirect(\"/dashboard?hidden_field=\" + encodeURIComponent(processed)); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2b1f848b08f4cae479f8dd0367c1c30d9ad11d055a224775c1e887faacda468", "structural_hash": "5dfc839c7e50eba280f9d3b03ecb61ba1d0fad18a3d395a094268bcc9a2b900d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22727.sh", "upstream_id": "BenchmarkTest22727", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n case \"$data\" in\n aes*) echo \"$data\" | openssl enc -aes-128-cbc -nosalt -pass pass:legacykey -out /dev/null;;\n *) echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5c2ff390e23a93632449f62625a095e96173ec3ade157688bbac3ff438fb31f", "structural_hash": "16a2f5476cf11d9f0569cf5e7c46d5852bf4fd258e7a5978ce156a0dd4bc7f20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24696.go", "upstream_id": "BenchmarkTest24696", "language": "go", "code": "package testcode\nimport (\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tdata := userID\n\tif _, after, ok := strings.Cut(userID, \",\"); ok {\n\t\tdata = after\n\t}\n\tallocSize, _ := strconv.Atoi(data)\n\tif allocSize < 0 || allocSize > 1024 {\n\t\tallocSize = 1024\n\t}\n\tbuf := make([]byte, allocSize)\n\tcopy(buf, []byte(data))\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13d0ba08ca5fe3dee2d60aabecb90c9881c10d104a491cc3380507119048b39b", "structural_hash": "8b7b0a6da2aedecfeb2f1004006f7a2ce793f7af955a58d349f0a98547555a6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00985.rb", "upstream_id": "BenchmarkTest00985", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n render json: { error: \"invalid type\" }, status: 400\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6746912a54022127c1fb3f3674f9f2ec9afa4ea854f9178e34c56a26d7af2e37", "structural_hash": "d0f9d5a78c4d9d9726367b4194766e35883d30632df591bb1adddd00ad448397", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03744.py", "upstream_id": "BenchmarkTest03744", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n origin_value = request.headers.get('origin', '')\n data = ' '.join(str(origin_value).split(' '))\n return HTMLResponse(Template(data).render())", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85618941e5d660c806548f2d63376bdf3f9ad8ad8212b67124ab675c3807a66c", "structural_hash": "71824f832076ecf773e56448ce8586da6f33178717b3ace7b75f3c7412b551ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01577.php", "upstream_id": "BenchmarkTest01577", "language": "php", "code": "cookies->get('session_token', '');\n $data = sprintf('%s', $userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b9289dbb91863a8c73237e2ec387fb7c7adbcf4eec6e0400ca9e94aba5f193e", "structural_hash": "800a66e57a8fd876d9328bb9530de51345523a083104e37d2ddbca8916deb87f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04771.php", "upstream_id": "BenchmarkTest04771", "language": "php", "code": "header('Authorization', '');\n $data = (!empty($userInput)) ? $userInput : '';\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2bb1f70ea7b24c019b2c2ebc1a6a8e5e92b7ee5a86370e16c014b27a8dc05c19", "structural_hash": "41b8f7bb025d47caa7c38692ecaf09d18375e92ec783f0d0c11ea7a80ee2bafe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03836.rb", "upstream_id": "BenchmarkTest03836", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = \"\" + user_input\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca002eb254c669d0145ef9eedfe9d5987a6a07abde981e938098f5c7add8f88e", "structural_hash": "314cf17767692acfd1cb5dfd226b2164165b3f568e2c3ffe1b0871554950756b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09399.sh", "upstream_id": "BenchmarkTest09399", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config.yaml)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bb68925ef63d50ac379e4f0a9c483bce8b89de05e1a1de8edfca523df0a89c6", "structural_hash": "20e494f283c12bc9a433f1444f61d716296df255f819cb461936fd179ac8f8ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_04038.cpp", "upstream_id": "BenchmarkTest04038", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string data = std::string(\"prefix-\") + user_input;\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "743885c5bebf2234a2826daabc352a97658f806d4f5347abc8b68064d67906e1", "structural_hash": "0a1667327e1bb1639aa68ec100f2dd280e16ddad52f7368d83785995edcf034b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02926.ts", "upstream_id": "BenchmarkTest02926", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const fields = [userInput, 'http'];\n const [data] = fields;\n res.set(\"X-Custom\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "650f55e8cf6bf141770ff80fbeffd6a4bf4d61c1d9fa90074593a15b0409719d", "structural_hash": "14badc3300d523643dc1819e12d1f5f3608448de657e8be3140b84983565466f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_18267.go", "upstream_id": "BenchmarkTest18267", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tvar _b strings.Builder\n\t_b.WriteString(headerValue)\n\tdata := _b.String()\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-340"], "category": "predictable_prng_seed2", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bac9b8121ae8386f64bec1bc023d9f04670744e7c31e8cea9dfa4ec66dd2237", "structural_hash": "7fb0be4c6dfcad489bde80095973357de9b39f12129ba5b5504ee5f0957635c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01994.cpp", "upstream_id": "BenchmarkTest01994", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n const char *_sess = std::getenv(\"SESSION_SECRET\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9179ff3c3365f9b38c6bc5aeae1f07fdb3d46153c699ebea7e4adf7f6d93df0", "structural_hash": "736bf4af042c8689a1d0497a50f932b66474a3326f1b148db5ad3f4923237f43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17002.go", "upstream_id": "BenchmarkTest17002", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"net/http\"\n\t\"strings\"\n\t\"text/template\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdata := strings.Join(strings.Fields(cookieValue), \" \")\n\ttmpl, _ := template.New(\"unsafe\").Parse(data)\n\tvar buf bytes.Buffer\n\ttmpl.Execute(&buf, nil)\n\tw.Write(buf.Bytes())\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6981311ccd391e2b344269aa563a49817edca38ea4cbda4899253bfa1eac9d1", "structural_hash": "ee5dd0af06cdd57b9eab4bd3fb08d83bce3993a2dc61b84d618aaa2397dc04d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21665.sh", "upstream_id": "BenchmarkTest21665", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n curl -sk \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06555642f6a8acecf09027aac8ae14b46e2aafae4c16c0ecdf834ca0e4ccfdba", "structural_hash": "bd384c1c684eebab11fd6a00f4f2a0d899ab5a36e85ea9c5a498747af9f20918", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01886.cpp", "upstream_id": "BenchmarkTest01886", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93100caee56cedd95c5393f746de092f897ea9d66c1b58d4d1ce0bcc110d7327", "structural_hash": "941058fe6f361d84c15906f213131b89e148b702b458c4e3890929ecdc922e93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16786.js", "upstream_id": "BenchmarkTest16786", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if ([\"https://app.jscdn.io\"].includes(data)) ctx.set(\"Access-Control-Allow-Origin\", data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1237882d2f8fa90b8b1144f0d9c682571155a75eb582dbb8ce86f3604492678e", "structural_hash": "bdd483495ba8908f81310bde6d97be7d933ae875972a0bcedacb044e7dadc838", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00023.ts", "upstream_id": "BenchmarkTest00023", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = userInput != null ? userInput : '';\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n const _digest = crypto.createHash(\"sha256\").update(_content).digest(\"hex\");\n const _trusted = \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\";\n if (_digest === _trusted) { fs.writeFileSync(\"/var/app/active/pkg.bin\", _content); }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43a95f2c8861cf7fad74186fda536d2cd15e5c22338544dbeb0b001391c63929", "structural_hash": "f3bbcda6fdde774eb173bff024506677d72f8565ed847249b9a09a44ae6109d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03225.cpp", "upstream_id": "BenchmarkTest03225", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::system(data.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "409c5496fa560b2485e434d365cbd277ebc20c7f5ee84a5d599b92de74069c27", "structural_hash": "f0f2f3508a24ab3874117f4202d0131ec774545cb87c5a88c75c79cf9a618ce0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04150.py", "upstream_id": "BenchmarkTest04150", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n if forwarded_ip not in ('asc', 'desc', 'name', 'created'):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = forwarded_ip\n eval(str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2362b10a66cd8149847184b956102017306eed03e149b4f33523fe50e8336a64", "structural_hash": "bb2b888eb282920a19b6a7537760c67a4ee2e7c3d6119eab64289e8aa8324e0b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02694.php", "upstream_id": "BenchmarkTest02694", "language": "php", "code": "json('payload', '');\n $field = 'data';\n $$field = $userInput;\n mt_srand(ctype_digit((string)$data) ? (int)$data : 42);\n $token = mt_rand();\n return response()->json(['token' => (string)$token], 200);\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "044d8a2c12d78ff817127bbacf37c6710db99494e9c3503e090064a8d9e44025", "structural_hash": "0f404f4e5d76e9419040c5854a60a6dfdc808251037b8e3c1ad5368e5259391c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01489.py", "upstream_id": "BenchmarkTest01489", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n parts = []\n for token in str(db_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n return JsonResponse({'error': str(data), 'stack': repr(locals())}, status=500)", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "784a983a2e0fbf0c85b3113430182be7522859e6da2e2ff540dedf1e74078764", "structural_hash": "4713799d08717470675086d8f499c85ac1651053849b7a0eca946c6c51b5bcfe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00659.go", "upstream_id": "BenchmarkTest00659", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar data string\n\tfor _, token := range strings.Split(jsonValue, \",\") {\n\t\tdata = token\n\t}\n\tc.Header(\"Content-Type\", data)\n\tc.Data(200, data, []byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 1, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fea8c85dc3edc04db5eff7163d4d6f77e43c7bb4fb3228e88556a79b0239f49", "structural_hash": "9c05a011f53b779fadb3451a03a9e63573674c25d1e9a5fd7501293b90d2b913", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02877.rs", "upstream_id": "BenchmarkTest02877", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = forwarded_ip.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "256ed5ac9b9d4c61b91aad5bbb3c45d6989b657effe38fe98b66ff1ace01d434", "structural_hash": "d0e13636c8abdf7c88dfa5c5cf8447b3e0e9a076d89b1f0222ee107d5eb6448b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02412.py", "upstream_id": "BenchmarkTest02412", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom types import SimpleNamespace\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n ns = SimpleNamespace(payload=json_value)\n data = getattr(ns, 'payload')\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8ec05922c76fb60f9a367a943e06d57d174d04bc1c6d21530255f0643c19a36", "structural_hash": "cc6dd8a9f8ef28c4f9674a6cd8e1fa42592985c3e05844dc5d2d9bfe1c6866c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_33251.go", "upstream_id": "BenchmarkTest33251", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(commentText)\n\t}()\n\tdata := <-resultCh\n\t_handlers := map[string]func(){\"primary\": func() {\n\t\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\tw.Write(content)\n\t}}\n\t_handlers[\"primary\"]()\n}", "label": 1, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29d0052350f74bfb9ac2e5f62c61a335980207fc9a62e8214007c65d697bd668", "structural_hash": "d3295b192035fecb1b0c30ea831d3093ceaa1b35ac4b9a9ea7f90c2797019c1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33413.sh", "upstream_id": "BenchmarkTest33413", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54002bded8544309622fb7b5e664032b54498dce87feae4ac6f2101fc55cacd1", "structural_hash": "44faa6d755bf0702c96b034eccc0e4fa12e450532de4e329e8eac8148f86718b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35865.go", "upstream_id": "BenchmarkTest35865", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tvar data string\n\tfor _, token := range strings.Split(forwardedIP, \",\") {\n\t\tdata = token\n\t}\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02cc0cc62947e821cfbacb62e3e7730c39996bbcc28a266320cb7150c89f8442", "structural_hash": "8633fb3260ec84bf5704ec8027fa7ca9ccd3fbee1c02079cca489061ec294509", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05722.rs", "upstream_id": "BenchmarkTest05722", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let event_value = serde_json::from_str::(&std::env::var(\"LAMBDA_EVENT_PAYLOAD\").unwrap_or_default()).ok().and_then(|v| v[\"body\"].as_str().map(String::from)).unwrap_or_default();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = event_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n if std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) > 0 {\n reqwest::get(&data).await.ok();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1137627d3e0d478c46b0b85a1b011a3f998abcf38ae10b5fac4494b0df502d36", "structural_hash": "dc6b4c2e9e25b44bd978eedd0378330067c8436843aa342513aac831df6a8981", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02176.rs", "upstream_id": "BenchmarkTest02176", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n let mut pending: std::collections::VecDeque = config_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n tokio::fs::write(\"/var/data/plaintext.txt\", &data).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b115b8074666bfd43279919ad5892f37f2b56830f5cff3d842a35cf8561915fa", "structural_hash": "1e171e517e2f8a3544daf22b37be19b3582629ffa95193173a3060707be688b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02756.java", "upstream_id": "BenchmarkTest02756", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n response.setHeader(\"Access-Control-Allow-Origin\", refererValue);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5624313d31b0f8eee678e3dc14482ac9be118a35c305223276a71de00dc3ce64", "structural_hash": "801dd9fd08f3c624d52a3e67a0ca8e07a92f41769ed14173d4f8a415f7e257ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05785.rb", "upstream_id": "BenchmarkTest05785", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n logger.info(\"Action: \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d57b48bc23185f5e541e03c8e04ee8a4371a8a0827833bd124efc65776b1e7a2", "structural_hash": "22e6ea7041092c333b58ab70814fc0a81ca151728d1233ca1d36df31232a8ba9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01959.ts", "upstream_id": "BenchmarkTest01959", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d398daf3b843b3b82590dacb0ba1d1aeea0dce6fde27ec325e6bb02bd97bbc2", "structural_hash": "a49d95eae5ba699f69956f61dfe6e85670c2b8adb19ed1888175daf81918e0de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01228.rb", "upstream_id": "BenchmarkTest01228", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n content_type :html\n \"\" + data.to_s + \"\"\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86d8b27571962e9e4b8ba450cf65fef0a7d6a10ba9f3b7b81094287a3ddad83a", "structural_hash": "17b8a88dcb63791c7b4cb1a2c2b8d69a406da7974052e424fb01ad96cb9b2dd6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40993.js", "upstream_id": "BenchmarkTest40993", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { res.status(403).json({error:\"host not allowed\"}); return; }\n if (!allowedHosts.includes(parsedHost)) { res.status(403).json({error:\"host not allowed\"}); return; }\n const targetUrl = data;\n res.redirect(targetUrl);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1022"], "category": "window_opener_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6056ccf12e1359642352a250de0ca219c4a8ece224f9312e77c6517ff9b6a9d", "structural_hash": "c6b3aee656da1ede0414012765df3e3f457309aa5fc7be1c66b06f71aae7ba16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04153.rb", "upstream_id": "BenchmarkTest04153", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = format('%s', user_input)\n if data.to_s =~ /[a-zA-Z0-9_-]+/\n content_type :json\n JSON.generate({ validated: data.to_s })\n end\n end\nend", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1778df2644a2a92cd0b68c8bf3306ba72a031575cc39405a81578e9b414f4e0", "structural_hash": "04b2069addf4ab122e0e9c1fa93207ef8e876b3f4c4b937eded4641ee42e65f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07197.go", "upstream_id": "BenchmarkTest07197", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tvar data string\n\tfor _, token := range strings.Split(multipartValue, \",\") {\n\t\tdata = token\n\t}\n\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(data)\n\tw.Header().Set(\"X-Lookup\", strconv.Itoa(arr[idx]))\n}", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "741b7e23e12eede0c3ed36197a243e4e8cf2594263d94afca227e59809f278fc", "structural_hash": "e4e27f652d026ce2c3c642db57c7734445c0f3e127db7f554f6e9855acdf39ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03194.rb", "upstream_id": "BenchmarkTest03194", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n render json: { error: data }, status: 500\n end\nend", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e193a0aaa4ac42d767035e76b398142d42f2d0eb729312eaff4a61ad1ac08a62", "structural_hash": "705660de0cda37f8077c8aeb464325d182d26b8ae4e54ea3442fda7f962d67be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01837.ts", "upstream_id": "BenchmarkTest01837", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c105f4114ee090f0debb25d5638aae0305b0dd1a240d95cc3a075af22c639b7", "structural_hash": "0de82277b4c622d5d659ba10aa4900a27628f5f3ac2c694acca515be63468c8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06456.js", "upstream_id": "BenchmarkTest06456", "language": "javascript", "code": "const path = require(\"path\");\nasync function benchmark_case(req, res) {\n const userInput = (req && req.file && req.file.originalname) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const safeKey = \"uploads/\" + path.basename(String(data)).replace(/\\.\\./g, \"\");\n require(\"./shared\").s3.putObject(\"app-user-uploads\", safeKey, Buffer.from(\"data\"));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "305793fae7a2d77cc54481d6104935f06f46e4da4ed018dacc2573b9bc6b6ef0", "structural_hash": "e1461a309973dbb5e325d09b1eea0813b0dde5d6e0801ac416befd3eee0b4a11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03428.ts", "upstream_id": "BenchmarkTest03428", "language": "typescript", "code": "import { Controller, Post, Req, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File, @Req() req: Request): Promise {\n const userInput = file?.originalname || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const role = String(data);\n if (role === 'admin') { return {role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b854e3b543ae04b9835ffc3b410d2e49e67444e93cf892342aa2524961ab2e0", "structural_hash": "8c3d07d464227af146d66f50df0cff8744a4dfaf87d741d3b82bfa75dbda4c40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02767.rb", "upstream_id": "BenchmarkTest02767", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n @user_input = user_input\n data = @user_input\n DB.execute(\"UPDATE users SET name = ?\", [data])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "295f7147cae7bc9cfa344e26cf421be576ba25f81b85ec1c6ea42dee43c2f68d", "structural_hash": "b0665eb2542dc1bf30697c9ec6f9b7fbdb8008c245d178c261861c4a4a34bdaa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31043.sh", "upstream_id": "BenchmarkTest31043", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n data=$(printf \"%s\" \"$user_input\")\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9730a25bb8306c5bdd534d4f721d38971dd6e981bd3697510d3692d07fd73db1", "structural_hash": "56bd59c54364d75b5e13eb38f891a59bba68e207291fb6a9a8cd288f70ebcbba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04836.go", "upstream_id": "BenchmarkTest04836", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tvar data string\n\tfor _, token := range strings.Split(originValue, \",\") {\n\t\tdata = token\n\t}\n\tc.Header(\"X-Frame-Options\", \"DENY\")\n\tc.Header(\"Content-Security-Policy\", \"frame-ancestors 'none'\")\n\tc.JSON(http.StatusOK, map[string]string{\"status\": \"ok\", \"view\": data})\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea95ed0bc402ef66023b7cf4de264127172d2274947664c018c50adea2d98295", "structural_hash": "39a1a9f0302cd73b8499a2a1869f9b01d0999460cb7e95c85acf0479e77df885", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00615.ts", "upstream_id": "BenchmarkTest00615", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(userInput).toLowerCase()) ? \"true\" : \"false\";\n console.log(\"Action: \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd2a6d7ae507ba48384bd77267a55092bc17e22f3bfb321249511ebe4c962f1f", "structural_hash": "078a19c25c90c8ee7df5599f3a2917d8ea74f4598de340d22f160f499e47553b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05594.java", "upstream_id": "BenchmarkTest05594", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data = originValue.isEmpty() ? \"default\" : originValue;\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0785960c18447c3f093411fc062fd7e2b57cd49f569551599a1b33dff838bfcc", "structural_hash": "4d97383e3155a3b8a20ac6e17eeb9054873c088b2116f83f24acac16f33975ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02002.c", "upstream_id": "BenchmarkTest02002", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f19e5d37cf95ef18040770d167a9c5e8091947ca91606efa43f972de8c8777a2", "structural_hash": "bf201725ac864732c9e5e4ac408ca309bce79cbb0ea3ed4b80e8000968b6397a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04998.py", "upstream_id": "BenchmarkTest04998", "language": "python", "code": "from django.http import JsonResponse\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n data = RequestPayload(user_id).value\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n exec(str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "453a78e3b28546533da6be5c5665f2d32dd0d95ba7e6c90d336f778ab92bcbcb", "structural_hash": "9af8ee9d47f61d29e9014ab0f8cf6cb91f494d234f983395d722fa0e6ed4b4c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10652.sh", "upstream_id": "BenchmarkTest10652", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n checked_path=\"/var/app/data/$(basename -- \"$data\")\"\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca496571be6057096fcac7ad639b94c320d3b55a9f90394c2699ace75abfe5a8", "structural_hash": "6132a6c960d7d7803e6a716222a5104faa4f59caa62973c5323710ed9b929370", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00136.php", "upstream_id": "BenchmarkTest00136", "language": "php", "code": "header('User-Agent', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b213e56be8b78415a5a11bb354f98b50dee26b7219e84b54cafc3744c027aae1", "structural_hash": "14d0392e3fe4545c62961894dfe11ef77bc70471cf0e1eca8d1e6528023025c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36398.go", "upstream_id": "BenchmarkTest36398", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tform := FormData{Payload: forwardedIP}\n\tdata := form.Payload\n\tallowed := map[string]bool{\"https://app.gocdn.net\": true}\n\tif allowed[data] {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", data)\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-346"], "category": "originvalidation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8e68ae09665a8d276408be65986c47169aaab0abdf26fdce74aedddd9999a8b", "structural_hash": "5618e8ec7ff73508ba31d66870fc7766bf0f69884e68644e7db4c82440a1b725", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02229.ts", "upstream_id": "BenchmarkTest02229", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n res.set(\"X-Frame-Options\", \"DENY\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9831203aad2e0434510eb2cc566b9b4eb5de3c506422031e1d236a0bed0bc861", "structural_hash": "18f312ee825a1f018e0087a98cd822bc3f6719f06faa87bfe18355d9549dcc49", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18249.js", "upstream_id": "BenchmarkTest18249", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "177ba93d83ec075cf8937398d3a264386ce22c29a0895eed050f0f0bb84331b1", "structural_hash": "139f9c181cc74d509bbcd3cec63f29a3f1d41218a7dea0e581b90e3bef295d9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00727.php", "upstream_id": "BenchmarkTest00727", "language": "php", "code": "fetchOne('SELECT body FROM mq_messages ORDER BY id DESC LIMIT 1');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $host = parse_url($data, PHP_URL_HOST) ?: '';\n $resolved = gethostbyname($host);\n if (filter_var($resolved, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) { return new JsonResponse(['error' => 'private range blocked'], 403); }\n $targetUrl = $data;\n file_get_contents((string)$targetUrl);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9430e33e1105c04379987a76b1589ad0c68b009199b74b296e02e81a9e4071e7", "structural_hash": "2230da83589446f749478c29e60399e192ee5bc7724e5b34a544621b02365fde", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15792.c", "upstream_id": "BenchmarkTest15792", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a738146aa49cbeff0d3f63ca1bd94d49f30d4145fb0d2c50a38447cd55cf17af", "structural_hash": "15ef76d6f5bc15155de9ae80b48ce484d20ed6873dc7e45bd452d0ef406460bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02370.py", "upstream_id": "BenchmarkTest02370", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = cookie_value if cookie_value else 'default'\n subprocess.run('echo ' + str(data), shell=True)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66536c6433a543b03365d85196d5e9f7f78af582a1cb759dbfc64b55175dde17", "structural_hash": "1b25ba19aa6f19f5651b0ecfda9f1528e4dcc095886907193dd2e25914d7504e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15618.c", "upstream_id": "BenchmarkTest15618", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n free(_p);\n}", "label": 1, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2824e05b3cfaa860059437e5fecf04681fc39dac701b6b1cda3d98405a091f91", "structural_hash": "27b0f5ca89f4f829fcf3c4fb572f501c4ee732a129b7baf7c1c5954296e3a32a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00219.php", "upstream_id": "BenchmarkTest00219", "language": "php", "code": "cookie('session_token', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n return response(\\Illuminate\\Support\\Facades\\Blade::render($data))->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0085d5523bce935b9e8456fad5798faf795bb42eddc69f0f3a52e8e74930ab4", "structural_hash": "a8ec00eee9a1f93a691c1a96e440c245d6a5674a2a1fc206669698992c230576", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33895.js", "upstream_id": "BenchmarkTest33895", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const data = passthrough(userInput);\n if ((req.headers[\"x-csrf-token\"] || \"\") !== ((req.session && req.session.csrfToken) || \"\")) { res.status(403).json({error: \"csrf mismatch\"}); return; }\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-309"], "category": "password_only_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55a4a89acbcd8aae50ec49fc01e8ee73515ed6392d897eaf984d040b9d440600", "structural_hash": "15ada75f8f0de0946a89c7566995d3a89a63d61cb6864980136489d83249192c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03836.py", "upstream_id": "BenchmarkTest03836", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n try:\n processed = max(0, min(int(upload_name), 2147483647))\n except (TypeError, ValueError):\n return JSONResponse({'error': 'invalid integer'}, status_code=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JSONResponse({'allocated': allocated}, status_code=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2b18cd180936d655329d356c1592292775aa09c38a04301869e2ec18ac8686d", "structural_hash": "2746c2e77fee4739300620121f38785fff1fb8a149bd66317668f8bd968dfff4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13279.sh", "upstream_id": "BenchmarkTest13279", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n printf -v data \"%s\" \"${user_input}\"\n case \"$data\" in\n aes*) echo \"$data\" | openssl enc -aes-128-cbc -nosalt -pass pass:legacykey -out /dev/null;;\n *) echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d77e6a69fe68ed2713e67059639f3b846cea1915a90f62c9af8cea9931f5ac97", "structural_hash": "86b9b6a26aa990b9a21b867f3e932a0bb38152d973e31cc76c096f9d21aa954e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03934.cpp", "upstream_id": "BenchmarkTest03934", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n unsigned char _digest[32];\n SHA256(reinterpret_cast(user_input.c_str()), user_input.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66f52b6c42e8c7be9a210763aa915d2f2ec009e96a05a284a4be6f9b3f5164b4", "structural_hash": "bb14394343534f04965349830c43a7d5094af8f7a432415300e0467e035deb9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04868.rs", "upstream_id": "BenchmarkTest04868", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", comment_value).ok();\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6b2a225b7c758462476db674deee84289684c3a535cb805818cc38885809d06", "structural_hash": "e548c2050284f50f2189e7950c1750caf381d46014421d4325965a3ddc0d5694", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03222.cpp", "upstream_id": "BenchmarkTest03222", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dfd9bea663b866413bea159058ec2f5db14efaf91e414af3dfbb1f2af1e9eaf1", "structural_hash": "617733e359a44b835c528dab70f36279794dfa882e39ef9ae84dac32a5d874ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00017.java", "upstream_id": "BenchmarkTest00017", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(cookieValue);\n response.sendError(500, data);\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f62567087dd07d585a1478801e385e474be23023ec61731420bc082e23753f12", "structural_hash": "52cfbb98c9b1b682264b6de700ce079792e38ef28e23d7afa394257418218b08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33542.js", "upstream_id": "BenchmarkTest33542", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n res.set(\"Content-Type\", \"text/html\");\n res.send(\"
  • \" + String(data) + \"
  • \"); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8e954b371517262a652412f91699d3d563bd32f30ce0e246504890e2330acf6", "structural_hash": "eebc5e1b4bd0d2a299e5175be0c5b7bc20bcd332eed2c969f5cefa2823140350", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05326.java", "upstream_id": "BenchmarkTest05326", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = \"item_%s\".formatted(rawData);\n Object evalResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00745b82dc5e22b0ee8f8aa3d39648e342ccd40d3d3fabb21be290a923be8088", "structural_hash": "514c8d9d377fcfb3d0d26d034c534352090f4c8cd9678e13e44848067de8c617", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03945.java", "upstream_id": "BenchmarkTest03945", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = \"item_%s\".formatted(multipartValue);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47fa0df70fef983b02e28f55c021746d0ba0f01958d2aa0b9c35f513d7d0b4eb", "structural_hash": "8915ebef7635092b6a1b041a8c56881452271c32f7bbd9c5ea25cd44773655cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_31596.js", "upstream_id": "BenchmarkTest31596", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n res.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb60b2a728bbc43e33628c91086782b88c2fef916c0f17173f2569fbe594b7cc", "structural_hash": "3e9aeca6bc7d436049f143d9d513b294acd13f7d2e3b672dac8a7a35d809a07d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00234.py", "upstream_id": "BenchmarkTest00234", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n if forwarded_ip:\n data = forwarded_ip\n else:\n data = ''\n return HTMLResponse(Template(data).render())", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50f3efef803dae7e5fbd8d62d1c1e2b2c9cce6ec7468ff494792c877224b466d", "structural_hash": "1be9224979fa0b62e4d6172b5af4ca1860f20aa99a52e55d40ba3ea677dd7113", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04243.php", "upstream_id": "BenchmarkTest04243", "language": "php", "code": "input('multipart_field', '');\n $field = 'data';\n $$field = $userInput;\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aba885cb4a3ad2f6d11daf9ecc2dcc36f59b2e9dd4842205ceeaeb8b5cc5e4ab", "structural_hash": "7aaed2392a4ebc50dd22c60ac1a733a2f7846f331617b0d6deaff58f32dcbe56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00757.rb", "upstream_id": "BenchmarkTest00757", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n logger.info(\"Action: \" + parsed_bool)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d84bebcdfa951cfeb4b58497f495953f07123ccac13bb1da5ce81bb54a8d791", "structural_hash": "37d77b2a0cfc88c849de1eea61fb16ffeb7020d562d9ea23f811f65025c27706", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08001.c", "upstream_id": "BenchmarkTest08001", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n int _vals[8] = { 0 };\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 0, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94eb0430076b5a322b72014c4a1f79fc63b531c690ebfeda36135d641576d5d2", "structural_hash": "1dacb442483e33cb52f86fae10d8285886ad03d6f7e0cb57d0bc5e54ea05459c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00521.rb", "upstream_id": "BenchmarkTest00521", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless session[:user_id]\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a32cdc7ed63122c3212005ecdef080312a7b18ff38bf94ee4a04a06710a61f9", "structural_hash": "73f3538bb57a580a7c3f1db1753cf5b174383aa505bef7410d6d0a95f7ef5a6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33085.js", "upstream_id": "BenchmarkTest33085", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n const scopedPolicy = JSON.stringify({ Version: \"2012-10-17\", Statement: [{ Effect: \"Allow\", Action: \"s3:GetObject\", Resource: \"arn:aws:s3:::app-user-uploads/app.json\" }] });\n const policyName = \"scoped-\" + String(data).replace(/[^a-zA-Z0-9]/g, \"\").slice(0, 32);\n require(\"./shared\").iam.putRolePolicy(\"app-service-role\", policyName, scopedPolicy);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f97f7d0929a606c5bb787d4afeb973b9375bffce12db60b69ba8aae56cfa3a9", "structural_hash": "35a8c3aa2a76b8430b95b08413dcd93a08d13852cb972e663b7643d21ef9808b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00491.ts", "upstream_id": "BenchmarkTest00491", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.origin as string) || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n if (process.env.NODE_ENV !== \"test\") {\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e892862857a5c68abae3a865c9de0b4556d6fc5042d91c14968a493c015fbeb3", "structural_hash": "7008a41817fa1dfb050f2cf9c1d8576bd32e981cbdf4db1e17abf0695310c28f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04818.java", "upstream_id": "BenchmarkTest04818", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = \"item_%s\".formatted(userId);\n Files.delete(Paths.get(\"/var/app/data/\" + data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c110b74775211da1bc043eb2d3816f226572cb5d67729c4e7c9109557db2943a", "structural_hash": "72985895978297c89943c16160f22e071a2db392b8f905fce12c776e5baeb9c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01462.php", "upstream_id": "BenchmarkTest01462", "language": "php", "code": "request->get('multipart_field', '');\n $data = '' . $userInput;\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6fb5796a85488db9628cf6f90c6076116c98cd975c8b148838c8cf637e50522", "structural_hash": "45766f8f5a8e4138fe19c4a080628444ea431228da6bcb1860e70db1291156a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01477.java", "upstream_id": "BenchmarkTest01477", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(refererValue)); }\n catch (NumberFormatException e) { data = refererValue; }\n response.setHeader(\"X-Frame-Options\", \"DENY\");\n response.setHeader(\"Content-Security-Policy\", \"frame-ancestors 'none'\");\n response.getWriter().print(String.valueOf(data));\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dde3e781956027e982e708647caf828c264a4917a9df634cd2bd5e2939e5dbca", "structural_hash": "0a40cfb117a200396fdf9a1bc2855b5daacb3f225c33ee811038e8e41280ce9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01082.ts", "upstream_id": "BenchmarkTest01082", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d54439b240b8d9ffdc29365407fe1baaf253963244593686d8368fe52e0d228", "structural_hash": "b2678b9d75c1698c0f6894d5aba148f4bf7e815ce8782101b2e2380b8f439063", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19381.c", "upstream_id": "BenchmarkTest19381", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f71449b15225363f1641a3e9adeb46c67332e10f3e60c9592ec5b8a7571a11e", "structural_hash": "ffee562af5bf3de063d810c2b1cf1a2e773544130859d511762001381c328340", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11665.js", "upstream_id": "BenchmarkTest11665", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const data = userInput != null ? userInput : '';\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n ctx.session.data = String(processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-501"], "category": "trustbound", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d5a072e2666bae7b60d8ae416536661c54a7ec4180e04aac2dcbaf2c50f077d", "structural_hash": "09554ce7a178cfa9637353ac61006d01eb50091ad915efd5ae10c7c6fd99807b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05756.php", "upstream_id": "BenchmarkTest05756", "language": "php", "code": "cookies->get('session_token', '');\n $data = '' . $userInput;\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b6eeb343f5a9205e460222732c3d62a62dc5edd4b13a88bf872c0d4c24374cc", "structural_hash": "ebc8a1de2f8d7e5f9a744edc369d454b01c2e8932ff2cf9ce04236a2a0f40d3c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11118.js", "upstream_id": "BenchmarkTest11118", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n res.json({ listing: entries }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1268928470cd862a11b2f26187a5df74432c94e61b8d1f6f74ba301fdb2ddac2", "structural_hash": "bf150cdab549b854f05e67948c19caa68eef707352e9bd693da213f334b0e4eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00949.php", "upstream_id": "BenchmarkTest00949", "language": "php", "code": "getContent();\n $data = (!empty($userInput)) ? $userInput : '';\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc8428fd04b2b53cb8361fd862fac2e934031d315fae8e4e6445d88a57691185", "structural_hash": "fc0e424d69c3ba1fe38073549d0299882ae2ad77c5f38292fb8c21bd6602e305", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01357.rs", "upstream_id": "BenchmarkTest01357", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let mut data = String::new();\n for token in xml_value.split(',') { data = token.to_string(); }\n let processed = data.parse::().unwrap_or(0).clamp(0, 2147483647).to_string();\n let requested: i64 = processed.parse().unwrap_or(0);\n let count = requested.clamp(0, 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1bd9dd6eb3b430a7f7cc67ea3bf7b6172855da856b0d16a0ec2d5e16e5e66fc", "structural_hash": "6fe0f0b7dbf54b13a77075149c7d495c1b034414f44942200d64b26bf07ba921", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04413.rs", "upstream_id": "BenchmarkTest04413", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::store_session(\"data\", &cookie_value);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45fe6a9e4d20ae15bb851e2b9a0aff19d0e027a56f6eccfd1b7499df704afe77", "structural_hash": "abeb119ca57c68e5fe13e5a94f569a763d10f9215edca7900e9a2ca2d5dd7a25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30170.sh", "upstream_id": "BenchmarkTest30170", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a7f1f8846a02bf8a9433708dfd8a47cecfe05c860d318753f0eda8405f28873", "structural_hash": "dd5496e56d9a39c9490fc680b62b344c7e7b2684c9938213ca76d3cc04fa7fb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05296.rb", "upstream_id": "BenchmarkTest05296", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n render html: (\"
    \" + data + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe1267047c83d2ff22e4ffd5c626e4a725831f4c3f032bade86a9d6144bf299a", "structural_hash": "dc87ac615f139c8a3f8f6a08d5207b1badceec082c5a67470082ea5e55484184", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05162.py", "upstream_id": "BenchmarkTest05162", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n data = handle(ua_value)\n subprocess.run(['echo', data], shell=False)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98628714ef17c4f4d0c783fdf3cbea749f5e72ab1b6f581489707b3f0fb98983", "structural_hash": "a8fb709eadf75618293ed59bb0c97d75a912c0eb86041abe3ca42b5f8ee39f08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06061.ts", "upstream_id": "BenchmarkTest06061", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bf90994729c13d0150087c2facd6a90e29a1f7274e364064a3f046d2d4ac9a0", "structural_hash": "dd401de84a27613768ac24b5515deed539b2981a2cd0119c45204d21a9c3bd2f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05218.rb", "upstream_id": "BenchmarkTest05218", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n data = \"\" + user_input\n render json: { error: \"Internal error\" }, status: 500\n end\nend", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28cbc50c69a44677ceaa2d3b634e08fdff687ba41357d2d6925253020ad3398c", "structural_hash": "b94774ab05ddeb72fa3e947cf40daf64473ec8c7dcb71b3876c9ba51baa97409", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01895.ts", "upstream_id": "BenchmarkTest01895", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const data = String(userInput).slice(0, 200);\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n const value = (row as any).name;\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5056a48505e081eebdf710d7949b61696f4c4015a153850b0313cdcbe77b7a8", "structural_hash": "1d28370d1e4d67a950231c371beda579b0c802e67c97ffab79d8c94b3f9e37ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04100.ts", "upstream_id": "BenchmarkTest04100", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as libxmljs from \"libxmljs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n const data = decodeURIComponent(userInput);\n libxmljs.parseXml(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eedaeba9c4f687f397cac9727b22b373728cb23c13df7c3dbc94c921cf933cbc", "structural_hash": "0fd156c7e90b93a9bc813ce4421e759cf8696aaafaebe6e09f9cce2abdc37197", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03795.java", "upstream_id": "BenchmarkTest03795", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n FormData payload = new FormData(rawData);\n String data = payload.payload();\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "207c2866eba3a8441a604875e2e613bf61f3713cd76e6f572e6ddff8d78608cc", "structural_hash": "5778ba683f63b02a48339831cef676e9ebe65f8d9affec731644fea8c0914800", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00810.py", "upstream_id": "BenchmarkTest00810", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import auth_check\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n parts = []\n for token in str(raw_body).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n auth_check('user', data)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7012f365f50b5fd5a6c00e4e3e98a7755b984cc3714d6027c0d63cf85f185db6", "structural_hash": "9e35c8b53990310819dbfa0afc6cbe29813f467791d59278018576e95f175495", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14919.c", "upstream_id": "BenchmarkTest14919", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n FILE *_f = fopen(data, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a16c492485e1186828c39ae0c345c8cc71d5e2524abbc0685e5b78dac6d39bd", "structural_hash": "1488df44d64e72d41c35eeee71d054dbda11aa1e8b2dd7036d630e883867febc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00322.py", "upstream_id": "BenchmarkTest00322", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nfrom starlette.responses import JSONResponse\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n pending = list(str(multipart_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f5e930fe7d224bdf551ac7ff50fa7604de4f9b6f7f6e9229f1445d61e6710be", "structural_hash": "0fc9fa18fbc6643033c9861e0b4b38d534bcd14ec535c67a886b102395e71ddc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02885.java", "upstream_id": "BenchmarkTest02885", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n request.setAttribute(\"carrier\", jsonValue);\n String data = String.valueOf(request.getAttribute(\"carrier\"));\n String processed = data.length() > 64 ? data.substring(0, 64) : data;\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(processed)));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c2963adcdb9c9e39b7e0d4bde97d3cf21756bc964bc50396b61ce7ac9075c96", "structural_hash": "6bdd2adadee375d2cc0cf04b35ab47385a5b3f13cbc85cdb3faabda008d9d89d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_06083.php", "upstream_id": "BenchmarkTest06083", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n return new Response('
    ' . $processed . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efb92dbc25e77d56f649176b2d23ad717d90b92984ab633adc55aca1b5f583e6", "structural_hash": "8a2947b509596d47bf435e089f5577db5d563422f18415d63e67955dce06413f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19381.js", "upstream_id": "BenchmarkTest19381", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const data = userInput != null ? userInput : '';\n const { publicKey: rsaPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 2048 });\n crypto.publicEncrypt({ key: rsaPubKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING }, Buffer.from(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ef3ce0faae31fc2fb589595e349274bb508c12a345a4370c97a24c664fce960", "structural_hash": "44ff37ae6a0c28cbb5335f85f261695318361210dec45c08d80fc6f217dc244a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19531.sh", "upstream_id": "BenchmarkTest19531", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n mysql -e \"SELECT * FROM users WHERE id = '$processed'\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2567dab691249651415db72a0d365ca430a7114a8a99ff27f24a3376f6a33057", "structural_hash": "02636755195b0f314d077c1c50754c7bb8c6d5d25ae5af91e862168855cfd1ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04841.ts", "upstream_id": "BenchmarkTest04841", "language": "typescript", "code": "import { Controller, Headers, Post, NotFoundException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n if (!row) { throw new NotFoundException({error: \"not found\"}); }\n const value = (row as any).name;\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "406966b4c96e47c4aafd4d989d040c9aea4c64a2993b1a2b4ea6ebb7a8032ed4", "structural_hash": "b9ba3665d2fb485e70c12a213faf67264bf034a7e18d03303990de664b5c8699", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04529.rb", "upstream_id": "BenchmarkTest04529", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n processed = data.length > 64 ? data[0, 64] : data\n role = processed.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b353d837e7eca9fa07996595cb8df6a399ccab752eaa4b0a739f8a5e5ee9c647", "structural_hash": "1bc150d3aa853285cc0b5951b48ee27cacdcee68ead55f6cd985c28986272890", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05000.java", "upstream_id": "BenchmarkTest05000", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data = hostValue.isEmpty() ? \"default\" : hostValue;\n byte[] buf = new byte[Integer.parseInt(data)];\n response.setHeader(\"X-Alloc-Bytes\", String.valueOf(buf.length));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3c487709acdd336a487cd87515891765ff93d44c25b705c195c583e448c6bfb", "structural_hash": "1175f71557ffdea466d267900f848f933e6060e9f6327d098fff7ca8f6689fdf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05339.rb", "upstream_id": "BenchmarkTest05339", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n headers[\"X-Custom\"] = data\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b34da26196ab0f18c6ea8dc69dc31308d2e7f3b19d482536fdc4f351bd2a9e0e", "structural_hash": "1c509eda92b6e6a82c416d6b2610ce8caf2f6283fb6b17af6d329f2e511f4ae5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03989.ts", "upstream_id": "BenchmarkTest03989", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n return { token };\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c6cf69c9e48b7a629c50882dc4c089f0050d29a22dd820fb7532d1723f3c9dc", "structural_hash": "17c72b7e6bafcf5c090dafd9b5a3d77d9eb7f868f65ae42d0838c92f8ea15b0c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04390.py", "upstream_id": "BenchmarkTest04390", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\nimport hashlib\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n data = (lambda v: v.strip())(upload_name)\n _resp = requests.get(str(data))\n if hashlib.sha256(_resp.content).hexdigest() != _resp.headers.get('X-Content-SHA256'):\n return jsonify({'error': 'integrity check failed'}), 502\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "104c92774b79bd80461e3912a87e645fe04c11786c352b0f56525de6c6e68dbe", "structural_hash": "271ca06e85bec50b91e50d20ab6e553d0d40b5299620ef164f66270163b2663a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03793.ts", "upstream_id": "BenchmarkTest03793", "language": "typescript", "code": "import { Controller, Post, UnauthorizedException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = await Promise.resolve(userInput);\n const _credSalt = Buffer.from(process.env.CRED_SALT || \"\", \"hex\");\n const _credHash = crypto.pbkdf2Sync(String(data), _credSalt, 100000, 64, \"sha512\");\n const _storedHash = Buffer.from(process.env.CRED_HASH || \"\", \"hex\");\n if (_credHash.length !== _storedHash.length || !crypto.timingSafeEqual(_credHash, _storedHash)) { throw new UnauthorizedException({error: \"invalid credential\"}); }\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0755d1e8cac6df7475600f95bb43889063cc7c43dc94a8540f261f104c849882", "structural_hash": "bc8be100c71490ebc4a322844f9948f35683ff710da3288111f381282424d547", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41689.js", "upstream_id": "BenchmarkTest41689", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n res.cookie(\"session\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-784"], "category": "cookie_no_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52d7bf5b57b59bf8004b54d359f40f1cc34951d18907d9cbba1511fd3ddb60c3", "structural_hash": "0643e5ce133321cd4a4588e42eb8d5caf5979b0099987c0b153a90e7e17979d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05605.php", "upstream_id": "BenchmarkTest05605", "language": "php", "code": "cookies->get('session_token', '');\n $data = urldecode($userInput);\n eval((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1db67f215eb31ab87115dba059994ff802c1c043cea9a5b092209a714c1d0d4c", "structural_hash": "b71c7a80aac5d5a6f22d11779ff56b163d9823b6aa52cdb144fd4a8d4df51b2d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05017.py", "upstream_id": "BenchmarkTest05017", "language": "python", "code": "from fastapi import FastAPI, Request\nimport defusedxml.ElementTree\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = RequestPayload(comment_value).value\n defusedxml.ElementTree.fromstring(str(data))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4395ad5f88682190238b609eba070de76a5b7a31bee0225a2d4ee76f6c2d6d2", "structural_hash": "ee8eb9e17c4d37f096fc9b4a198fc88f1232a7dccad1ecc33282efab4f83b21e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16958.js", "upstream_id": "BenchmarkTest16958", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-324"], "category": "key_past_expiration", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:key_management_error", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb1b6e63edbf565b9a667ef1d115ad9b3fecaf6ce07765c3e1227d7f978ffa18", "structural_hash": "f977338d57f289f6b1d0ffa02a44e89af37977b9f110ce706639966ce4b2d0f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_26986.go", "upstream_id": "BenchmarkTest26986", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(originValue)\n\tpluginPath := filepath.Join(data, \"report_renderer.so\")\n\tcontent, err := os.ReadFile(pluginPath)\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5735a583a2b43a776076c52e6ec24d27d455cf9423f7df289d07d9a0867f2d3b", "structural_hash": "bb06984764885d61bd5b417d7a552a0c225d323f478f29499f1850da66513866", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31297.go", "upstream_id": "BenchmarkTest31297", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/tls\"\n\t\"io\"\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdata, _ := url.QueryUnescape(cookieValue)\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\tresp, err := client.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tw.Write(body)\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb2e491146cad33907b0e85676cb1f385a3e710d2f4308d316a60ad3ece94eb6", "structural_hash": "b0c233b306d70a4ccc608a1c0a4549281fef61d46ba8ad0c8b3a3f509d3a4c68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04427.php", "upstream_id": "BenchmarkTest04427", "language": "php", "code": "getContent();\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$data . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a11033ebbf119951425f1ea847defb3e76afb414edc1dc3115dbbae9b90b5d4", "structural_hash": "fcdbee3d9fdc71efbe08e3fa0c0d68195543661f84d9f5b345c8dd86c6b2164e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03150.ts", "upstream_id": "BenchmarkTest03150", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { res.status(400).json({ error: \"out of range\" }); return; }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7582bd5dc40496556f4e1732f15b16a5e424f9890ca969d46e2bc8e15ec7596d", "structural_hash": "7e80b1260742db55fbc126ee7b4ab6c2d91eb2df62c1bc755eb93727baba9248", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03105.java", "upstream_id": "BenchmarkTest03105", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = \"\" + refererValue;\n long seed = ((long) data.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2be1b12cccd1f2f6ca904882d70ae7a2d6c8016004e3e03f13ebe3cd5e2e7eb6", "structural_hash": "26a7bed771bef152fa220b7f72d392ade5607d9a887974a5a87885c1bec0b119", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04991.ts", "upstream_id": "BenchmarkTest04991", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f155eb88b57488297b40b334023f8c99c422ee0301b4045627e3362f7956641", "structural_hash": "920cce631f66ca42af51ce82d48fb43b8e43c1b1b9a47a43078e9d176ed06c5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00290.go", "upstream_id": "BenchmarkTest00290", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tif !verifyBearer(c.GetHeader(\"Authorization\")) {\n\t\tc.String(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"status\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9895443cc66d0523d4c817b0797c7adcc2cde14071605354d95cfd4264159f68", "structural_hash": "38b27ca922b283461a0a33a3b6a0f511f61b9f47e6db7729689f5739418338c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00837.php", "upstream_id": "BenchmarkTest00837", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $data = trim((string)$userInput);\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return new JsonResponse(['error' => 'forbidden'], 400); }\n $processed = $data;\n $trusted = (string) $processed;\n return new JsonResponse(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e56ba92c4ca4584a02dee1e07538e1f91b0565c4475bdf049554e6d06604a54e", "structural_hash": "f39f075e14b062828551a67da86a67937a44693c686922f170e55e5d095f9ba7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01727.rs", "upstream_id": "BenchmarkTest01727", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(ua_value.clone(), |s| s.trim().to_string());\n let requested: u32 = data.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f5f73efde5d40d10001903a5e536a0eeadd74336bd669a67a4710440e547973", "structural_hash": "832a605dc60daed1e4fca8bbb256a1292e5edac7417da5ecae18aaa2304e6c20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11486.sh", "upstream_id": "BenchmarkTest11486", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _input=\"$data\"\n if [ \"${#_input}\" -gt 64 ]; then _input=\"${_input:0:64}\"; fi\n processed=\"$_input\"\n echo \"$processed\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fdc0bb6f4e6b936b3b363d663d701231bde3b35ee5c98b54c14accef67a14ad3", "structural_hash": "ed070a76bcc9265534db81e2814ce28462782253d0d2310621e8c0202c070e84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03094.ts", "upstream_id": "BenchmarkTest03094", "language": "typescript", "code": "import { Controller, Post, Req, BadRequestException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n if (![\".jpg\", \".png\", \".gif\", \".pdf\"].some((e) => String(data).toLowerCase().endsWith(e))) { throw new BadRequestException({error: \"invalid file type\"}); }\n const entryFile = path.basename(data);\n fs.writeFileSync(\"/var/uploads/\" + entryFile, \"data\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ae8d8c6b1fdcb145549c5b84f59a6226a7768eaf30d0e5f0c23bc015c1f9c97", "structural_hash": "f748375d61c7a1119c363c6e807346dfa73307ac8c33345f92893bac95730ddf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05368.rs", "upstream_id": "BenchmarkTest05368", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let queued = env_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n let processed = data.replace(\"\\\"\", \""\").replace(\"'\", \"'\");\n HttpResponse::Ok().insert_header((\"X-Custom\", processed.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35ee2890c48f775483318a5017d9142dafd387bd0a2ec662f0506b97518b7f60", "structural_hash": "ec1dcb7703287a5d20d3293f0f5584fa4038b0b38b64469c2a6d29069914b8ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03258.php", "upstream_id": "BenchmarkTest03258", "language": "php", "code": "text;\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n session()->regenerate();\n session(['data' => (string) $data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b23ef4cfce72c17c4364d63d4199768e83ba9e11a0b2b64000ada72c440ebe05", "structural_hash": "b03035aef03c1e98cb476f77241c58cc5bcb565f78bd6561baf675f8c1768468", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_34515.go", "upstream_id": "BenchmarkTest34515", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/text/unicode/norm\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tcapture := func() string { return jsonValue }\n\tdata := capture()\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tnormalized := norm.NFKC.String(processed)\n\thtmlBody := \"

    \" + normalized + \"

    \"\n\tc.Header(\"Content-Type\", \"text/html\")\n\tc.Data(200, \"text/html\", []byte(htmlBody))\n}", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99c212c50c0309671aaa4a4931f233f062baa1da55d565c7f411cd89f37778b9", "structural_hash": "c2689c092eb1cc7f99b60dc8447249d33ba9ee41b2733cd24d8c5d4a6832e8cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02710.java", "upstream_id": "BenchmarkTest02710", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference atomicValue = new java.util.concurrent.atomic.AtomicReference<>();\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n atomicValue.set(uploadName);\n String data = atomicValue.get();\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20e3414f4050da4c330c5ab65a07335ddb2fa5c887c1e29e039477f682421249", "structural_hash": "744a549812256d719517b7e388fee34d2212beab6c4053092f440b72ad829bf6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20530.c", "upstream_id": "BenchmarkTest20530", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n long _v = strtol(data, NULL, 10);\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 1, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2b3b180cdf68438705a601cfb8bd84397990b3a4bff1555bf1593948f995c0c", "structural_hash": "df9278158b49cff3c0b789bfd80071e459e28533f906460d224314aae8c08a70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17564.go", "upstream_id": "BenchmarkTest17564", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tvar data string\n\tif headerValue != \"\" {\n\t\tdata = headerValue\n\t}\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e9fdb70705c8b432fff86ae3a67adc42afb49bf3f5299a676942ca38b1a4df3", "structural_hash": "f59f94563b7e4c73574bba2531ba2be312a6fa5d48b16f6281dee77de564a27a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03781.cpp", "upstream_id": "BenchmarkTest03781", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"http://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10e8da111a2091b803d49e70b62302c111ac4f227179141c686beb73ee5b019f", "structural_hash": "5f6926f3d41520ab8c792a58bc2b3aed8c044e3eb4202bb5d89db49eaf0e6e32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04760.py", "upstream_id": "BenchmarkTest04760", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n data = '%s' % str(origin_value)\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "138bee1cf1dad0d4965ad7025a7945d5b606b905e2ecdb0193add147695d6891", "structural_hash": "5a9104e7c1d62908ed6419597e2b2bb20d5754f87f022bd0b094db9c893a533d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10106.js", "upstream_id": "BenchmarkTest10106", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = { secret: \"p4ssw0rd_test_xyz\" }.secret;\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n authCheck(\"admin\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-259"], "category": "hardcoded_password", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:default_password_use", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c38001975af0bb1aabf947d1dfc51d825f404a3c83f79ebf6c7fdf208224fa7d", "structural_hash": "b57aa851aed432c20b1128003891132c7cd5e62b0c1983c1de0bedf55c678003", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02146.sh", "upstream_id": "BenchmarkTest02146", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(echo \"$user_input\" | base64 -d 2>/dev/null || echo \"\")\n chown \"$data\" /var/app/data/managed.txt 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f064289cdc1f430efacadbaaf0d5294b6e5df25effd9f8e68eae0f9cd8845d5", "structural_hash": "6c477c349a292544a00b7d81bc5c92399d7aff9e7b3a0086405a62704b514743", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00468.py", "upstream_id": "BenchmarkTest00468", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = handle(raw_body)\n record = db.fetch_one('SELECT * FROM documents WHERE id = ?', (str(data),))\n return jsonify({'record': str(record)}), 200", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9c4e23dbf982277a327734d512c32dd405cac38d993613b0b1fa701831eccdc", "structural_hash": "59406cfdbc8d239a34adf8db578ac53476be5659891f2113e1afd576cc624e84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07820.go", "upstream_id": "BenchmarkTest07820", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tcapture := func() string { return fieldValue }\n\tdata := capture()\n\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(data)\n\tw.Header().Set(\"X-Lookup\", strconv.Itoa(arr[idx]))\n}", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1c26889a432a64150e7e7d5b7f5e32321c4859e2740f16ace7a7b91bf2fb05e", "structural_hash": "4646d8945b754daff1f3bc673d175849714beb5fbf6a1d929db1338a3185122c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04310.rb", "upstream_id": "BenchmarkTest04310", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"feature_flag_value\"\n data = user_input.split.join(\" \")\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bc5d58ddd76f445ccc0bee3afa788aa504917590c251d1be51c4c2d455f3eb0", "structural_hash": "abc73438f574318c9018c6816aec9257caeef371a6ea216fa7295edde7289b78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06164.go", "upstream_id": "BenchmarkTest06164", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tvar _b strings.Builder\n\t_b.WriteString(refererValue)\n\tdata := _b.String()\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:16])\n\tstaticIV := make([]byte, aes.BlockSize)\n\tcbc := cipher.NewCBCEncrypter(cipherBlock, staticIV)\n\tptext := []byte(fmt.Sprintf(\"%-16.16s\", data))\n\tcipherOut := make([]byte, len(ptext))\n\tcbc.CryptBlocks(cipherOut, ptext)\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"aes-cbc\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08cfeee36908f7477a9d032f4275dc3dd2ab2ea3f30e351b51167eaf25fa10e7", "structural_hash": "bacd43f1a12e01bbfdd92ac0d564436bd4c58b8f17ae4e0630a7a2645ec96107", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00147.py", "upstream_id": "BenchmarkTest00147", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nimport json\nfrom app_runtime import mongo_db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n try:\n data = json.loads(forwarded_ip).get('value', forwarded_ip)\n except (json.JSONDecodeError, AttributeError):\n data = forwarded_ip\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n mongo_db.users.find({'$where': \"this.username == '\" + str(processed) + \"'\"})\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03a00a99536701c29bd366b99520ee492739685720c238931a80994060cf3f8b", "structural_hash": "b2978e8b5d33f7d5b6c3c20018a69390944b698fdf39c7326626e62650c436bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15445.c", "upstream_id": "BenchmarkTest15445", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"uploads/%s\", user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0777);\n}", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b9306012c3b258e235de7e04c075550e95d0e4e2d112d38da3a7d6d6466b32e", "structural_hash": "972b721274263cbc7e857defee39ff5cdd258c32adbcedb20f1a070431aef62f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04868.rb", "upstream_id": "BenchmarkTest04868", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = user_input ? user_input : ''\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "402ea3b7448daed91532c6c1e6b11b5c2169d4c2749898ac8a1014785c5a1ef8", "structural_hash": "51c856c51b2b2754584eca1b66140a9f435ac58f166b3903b794a98a7855be17", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00411.rb", "upstream_id": "BenchmarkTest00411", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n redirect_to data\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7dfcab53f28e7b619406bd1215287f7ab767b40bd0bde2816bc876eb97dc4e4", "structural_hash": "15e57dac709f6622c94e93705f7af9407e98d28b6cfa9f8710baaaa2827e858d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03915.cpp", "upstream_id": "BenchmarkTest03915", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n static const std::regex _re(\"[\\\\s\\\\S]*\");\n if (!std::regex_match(data, _re)) return;\n std::string safe = data;\n std::cout << \"Location: \" << safe << std::endl;\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a8d05169848ff4bde183e29162d1e8464b91e9e53557f8178161635d8a57a65", "structural_hash": "c8a2d79b4bcdb8d48cd95f0fab15a8bb9f06219517fb4d92a8de9a81fe802631", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08718.c", "upstream_id": "BenchmarkTest08718", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char *_found = strchr(data, '=');\n printf(\"%c\\n\", *_found);\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff883786276b762a21c2a69290e55d1713e98a08bbed097aa57f0e5739e46dff", "structural_hash": "7988a5e14bb6acf3489a33f082bdfe5c1dc22dc29ed418552cf6d7888a4f416b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02563.py", "upstream_id": "BenchmarkTest02563", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = json_value if json_value else 'default'\n with open('output.csv', 'a') as fh:\n fh.write(str(data) + ',data\\n')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0647f3e0fed0fff53a2e3f753242be53b84f66f1f1e7c3602f53917192686588", "structural_hash": "8ae0f4dce326e9e55ed0ca6e2c267817212840ce750c65900a4d90470ae9e97b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00574.ts", "upstream_id": "BenchmarkTest00574", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n res.set(\"X-Custom\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d6f97387af71ed3b1cb875e6c3ec723c504e26b7686e8163a44996fd17c3cb4", "structural_hash": "760196d713ed78e138ee17bfa137e5a568dcd917ab44c783572ab2f180d85c33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05052.php", "upstream_id": "BenchmarkTest05052", "language": "php", "code": "getContent();\n $data = (!empty($userInput)) ? $userInput : '';\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $data)) {\n return response()->json(['validated' => (string) $data], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b97dfca3d0edef4d16ca57a17059a70f9c4f97093eabab01fb4c85a4935cb15e", "structural_hash": "5281f5547ec38f3fb0bc9f89457cd4fc161e189206704f00752d0ae12610cb32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21493.sh", "upstream_id": "BenchmarkTest21493", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=\"${user_input//$'\\x00'/}\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bcc798b1f962b84d40a0fd4cbd4fe3f9070dbd708ff1297a8d753f0840b9e3b", "structural_hash": "fb99f5416bb700fc3729dad13996a3b0c3bbf39cf5e74db2fe72cf6f8d1ab4e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04786.sh", "upstream_id": "BenchmarkTest04786", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"audit actor=$data action=session_revoke result=ok\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b27a0e8cb7b0d06dad4a46fa180adbca972223ee6260158302ea0a5433148a9e", "structural_hash": "bae7bcd16697666ab10b9cba693fb10c57b7d621144835ee1ce6ec68e87405ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00826.ts", "upstream_id": "BenchmarkTest00826", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Req() req: Request): Promise {\n const userInput = cookieToken || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c865950a1bd5f50b35caacadd6d58b7f69289adc3dc8256a4b16437a04678290", "structural_hash": "975ecda96d7a28c153604647674e36709a337775ef061163e80faac1758f7c4a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_02725.js", "upstream_id": "BenchmarkTest02725", "language": "javascript", "code": "const { db, authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT bio FROM profiles WHERE user_id = ?\", [1])).rows[0].bio;\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const storeCred = process.env.APP_SECRET || \"\";\n authCheck(String(data), storeCred);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e510ba9128d4916db0e1baaa4446241d451da90061e9b5bea9c5772b7af174a6", "structural_hash": "3620ee55e18cb175c07e37776300283878160f78e440a2c263c652adbb2efc70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05660.rb", "upstream_id": "BenchmarkTest05660", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"yaml\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = !user_input.empty? ? user_input : ''\n YAML.unsafe_load(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "932665aa57d0479c22d18eac5204b95d5cd5c72d2f29c397b3e858674d86019b", "structural_hash": "73f39a1169007009c5da09032d083489e4656183a65e07aca4e7cbd7fafd8d6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15422.c", "upstream_id": "BenchmarkTest15422", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_OAEP_PADDING);\n RSA_free(_rsa);\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d3cd0ea5a624447577fcfe1d203f2521e3d5ed570e2bb0efac7aa01e0899a7c", "structural_hash": "b55d3f13b7af5b5de5b8f79021dd27da6fd98eed8633e9e504afcc90275fe250", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00273.rb", "upstream_id": "BenchmarkTest00273", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99194b4083fb0344b9f4b8ec25b487b17efd6fd903b9df9de1b2e30068b93072", "structural_hash": "abb135afea14993fa4f846daa9da1fcfad47aae76f69fb91725bc51e6e6b21fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01240.cpp", "upstream_id": "BenchmarkTest01240", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "712ce058b0c7b6378fe3dd05ebcc2b33f614a21b996a89a22702caf0d1aa0ca7", "structural_hash": "5203c2c1f9e51b514c9eb2d853e812e9ca4e372aa47a3a518cec210bffa5c418", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04113.py", "upstream_id": "BenchmarkTest04113", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = RequestPayload(field_value).value\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n return JsonResponse({'digest': str(digest)}, status=200)", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ffd3f8de8b389877dc761ef94989a7d491f76378fc4f58e1feb25cbe2b4fad0", "structural_hash": "7da87f47c1c728ac68b833e9fee97888af32dcee43a689818de5da62b324fb5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05768.rs", "upstream_id": "BenchmarkTest05768", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"secret\", \"p4ssw0rd_test_xyz\")]); m.get(\"secret\").copied().unwrap_or_default().to_string() };\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = secret_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n let _ct = crate::shared::encrypt_with_key(&data, \"sensitive-data\");\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69c8b148e557705be06f77df6fa22dd66bfeaacaa031667a621c7949d4d49509", "structural_hash": "795bb4545bcc82b59e0280cc22b9f3caf0580ee5b0e9a449c1bb6aabba3aecd7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13555.sh", "upstream_id": "BenchmarkTest13555", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n chown \"$data\" /var/app/data/managed.txt || { echo \"chown failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f255aca9349a2980df76b1a9ac83e2b0c2c10d5e8b26d5f41707388584f9aaf5", "structural_hash": "0a62fb50bd4e7eb9c8cb5c8e9395e8839b9deaa93b91e7fb796eb7ab4ef0f1fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19651.go", "upstream_id": "BenchmarkTest19651", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", graphqlVar)\n\tdata := _sb.String()\n\tpluginPath := filepath.Join(data, \"report_renderer.so\")\n\tcontent, err := os.ReadFile(pluginPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68ffe5dcdf6d07e60b35ca85d21a717925107b4b34fa565817aa308e390fcff9", "structural_hash": "7f73d6dad780594166af5cbba37494499e32cb5c7a77c3b81593b96223e93a9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01929.cpp", "upstream_id": "BenchmarkTest01929", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = !user_input.empty() ? user_input : std::string();\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51ba331989dfcc6295b4e777e635bb0edad52243f1e707580d2c2616309d6331", "structural_hash": "5771c02e1a4fb11d722f7f9ea26826cb07085220433443b0c813a70206809c19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04321.py", "upstream_id": "BenchmarkTest04321", "language": "python", "code": "from fastapi import FastAPI, Request\nimport random\nimport os\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n random.seed(int(env_value) if str(env_value).isdigit() else 42)\n token = str(random.random())\n return JSONResponse({'token': str(token)}, status_code=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc164a3b8edeedde2e6588b547241aacaadceeb7591b775279df0810ee559a64", "structural_hash": "9293c82e2d5b8f5502ccc9c85f98c5d0cc7507afa2401fea7be7ccbc23af8bb8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07354.c", "upstream_id": "BenchmarkTest07354", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad186f434151c3f1dd38be68cd927ec2d6aef01512c133fbdb53cee2f8238604", "structural_hash": "7155729bc04a9019e4adf4fe367c3e9e0d5ed6665d842260b9f167aa3028b388", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08456.sh", "upstream_id": "BenchmarkTest08456", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n _host=$(echo \"$data\" | sed -E \"s#^[a-zA-Z]+://##; s#[/:].*##\")\n case \"$_host\" in \"[\"*|\"\") echo \"private range blocked\"; exit 1;; esac\n _ip=$(getent ahosts \"$_host\" 2>/dev/null | head -n1 | cut -d\" \" -f1)\n _ip=\"${_ip:-$_host}\"\n if ! echo \"$_ip\" | grep -qE \"^[0-9]{1,3}(\\.[0-9]{1,3}){3}$\"; then echo \"non-ipv4 host blocked\" >&2; exit 1; fi\n if echo \"$_ip\" | grep -qE \"^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.)\"; then echo \"private range blocked\"; exit 1; fi\n target_url=\"$data\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ca3a2b088552e17554245b4fca1004bc00ab81a767419eb98bc1823414e3be2", "structural_hash": "1bff608a063a03308e912fea5cb2925143bb9c95c15920c3462b15b7659215ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03220.py", "upstream_id": "BenchmarkTest03220", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = f'{json_value!s}'\n if not auth_check(session.get('user', ''), str(data)):\n return jsonify({'error': 'forbidden'}), 403\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2400611efed33da9edac0543fb412a449f930308bf0dbed07b5969aef85d7245", "structural_hash": "24ace11417dda2962446681f98f58d9f723efb316da6921af6cb333d8db0e9b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27302.js", "upstream_id": "BenchmarkTest27302", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = userInput != null ? userInput : '';\n if (![\".jpg\", \".png\", \".gif\", \".pdf\"].some((e) => String(data).toLowerCase().endsWith(e))) { ctx.status = 400; ctx.body = {error: \"invalid file type\"}; return; }\n const entryFile = path.basename(data);\n fs.writeFileSync(\"/var/uploads/\" + entryFile, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb01d301d269699175c88caa742b713378c9a90181b9506ced729cb253e4a808", "structural_hash": "c982b54ecbd8c95f6f848f72cde08d3dd66dd9956763ad0f901fcd9b2513aa56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24262.js", "upstream_id": "BenchmarkTest24262", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const data = await Promise.resolve(userInput);\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { ctx.status = 400; ctx.body = {error: \"field not allowed\"}; return; }\n }\n const processed = JSON.stringify(_incoming);\n const user = db.querySync(\"SELECT id, role FROM users LIMIT 1\")[0];\n Object.assign(user, JSON.parse(String(processed)));\n db.execute(\"UPDATE users SET role = ? WHERE id = ?\", [user.role, user.id]);\n ctx.body = { updated: user.id }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef708499e2babbe8b3b2718bc2b5396f7c7830e7719fa09acde5531f9d5cf0b5", "structural_hash": "6f18f984870ab89cc419aaf9d9cbf505e3e26a192f027c13fd2e28f2c7eb0ace", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04635.php", "upstream_id": "BenchmarkTest04635", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27092ad07bdef8d7899fe95dc0136cb05edb44284f053dd10fdca3ae7373dfda", "structural_hash": "233b4cb449b5b72ecbf7a413563e9d24d3edb95fc7bb9e1b8c3298bffa154776", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00790.rb", "upstream_id": "BenchmarkTest00790", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e12e10aedd7dc29c82b87cc658fd1824cd3696dbde621a69e100f8e33697979", "structural_hash": "7d59ca7f6a755c5f334211e9f5e2a87991d5fc72ff5784087bc6a77da32bd79b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01031.rb", "upstream_id": "BenchmarkTest01031", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5793334ca8be37c421674df200a497ab1e52b1b032666054470c2682b75a3b43", "structural_hash": "19685e9e3330d956064fe03e1a77df3b95777c681703e834ff2cb4da8366535b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14255.sh", "upstream_id": "BenchmarkTest14255", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4bce60076631eb93aa57c0526136d2b67ba8e184d0c0a6d07b95b0be2cebc995", "structural_hash": "156177a336d440c350dc4127d0f01eb21414fe2ab6d0fed765a888424eb1757f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27574.sh", "upstream_id": "BenchmarkTest27574", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d002d96b9e2b66c6e71f8414d67aeffe3ddd384ac7218cc13190d82c81b2081c", "structural_hash": "821f3b2a7830f347489d512449f140a1146dbfc8ddc2370935889faf544966f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04213.rs", "upstream_id": "BenchmarkTest04213", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(field_value.clone());\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c0371b2869bed923d3db822f9f2c907d752f4424a233d7d54759922fae4a1de", "structural_hash": "b97400668ec7c711ff4770c4828be0ee375fe8bc6098ee1f45149bbc71e89611", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04679.java", "upstream_id": "BenchmarkTest04679", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n private enum AllowedValue { INFO, WARN, ERROR, DEBUG }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String prefix = refererValue.length() > 0 ? refererValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = refererValue.toLowerCase(); break;\n case \"f\": data = refererValue.toUpperCase(); break;\n default: data = refererValue.strip(); break;\n }\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c629e099c456bca9e99fb4eacda2e8bbd5c5a3accb1a03881a8b19e558f26fdb", "structural_hash": "e35d93bc95a71f9bf35d939e8b4d6d2d74616719116fb79c5a447fd16cb7b8b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09034.go", "upstream_id": "BenchmarkTest09034", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", graphqlVar)\n\tdata := _sb.String()\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 1, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5551e32b00739e170e5b992a9dfd3f8fcc870f02537ec04e8f6239acba2d346e", "structural_hash": "9db633b216fbca53de7273b55b11ba93783687cd02738d92e159cf6fb89e80ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35547.go", "upstream_id": "BenchmarkTest35547", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"time\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- graphqlVar\n\tclose(_jobs)\n\tdata := <-_out\n\tif time.Now().Year() >= 2020 {\n\t\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\tw.Write(content)\n\t}\n}", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9921e408898f5e6d520194dc4f12bcf299410df4b6fdd775be89cc29383861e8", "structural_hash": "f99a6a0298c0fb1c8904fc4c30c3646d922777b6975fe23349a14ba2ece6e6d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00120.ts", "upstream_id": "BenchmarkTest00120", "language": "typescript", "code": "import { Controller, Headers, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string, @Req() req: Request): Promise {\n const userInput = origin || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f18d9a94604bfe9a2f5603824fa02f7ef1c4e812d952d7fdcb09b835a6e39188", "structural_hash": "5bb39c46a5687e8666773ad14cadb53139f31cda99d6175c558a95c9dff827de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00709.rb", "upstream_id": "BenchmarkTest00709", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => data}).first\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aaa5eac69ee1d2499299681c2509acbba7a89b1e70877130ea48f2b1872e01a6", "structural_hash": "5269d36cdf5581b11a9791d14ff57c1f7d0a102771d541bf95895415e53bc07a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04531.rs", "upstream_id": "BenchmarkTest04531", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(ua_value.clone());\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2fd4213f28e05e1d0f4eb73e97c0fbfa7b9341561eef2fbbce8fb648d19a096", "structural_hash": "f7bd55885f78331d3fe582be57dc52e338be0c56852796b49345f8da769e1390", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25370.js", "upstream_id": "BenchmarkTest25370", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n db.execute(\"DELETE FROM sessions WHERE owner = ?\", [String(data)]);\n console.log(\"audit actor=\" + String(data) + \" action=revoke_sessions\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10c58c24dfac1e6d3eeee676ad8181b017c28307fd5d9d9c391e31d75be9fd5d", "structural_hash": "0213ee5600d98342c2e1a91bb3e93f2358915b4b555080e87b08ab8932f8af3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02864.php", "upstream_id": "BenchmarkTest02864", "language": "php", "code": "json('payload', '');\n $data = str_replace(\"\\0\", '', $userInput);\n $cred = getenv('APP_CREDENTIAL');\n $_match = hash_equals((string)($cred), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7927f36953440777181feacbcc3d7edbc2eed37ddf7745c0224c9db6fce2c0ec", "structural_hash": "97ae3b0ce518ac22804e8600ac79cf9b6a26b76fdc7c9865d5f8cf6d2120467a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02684.php", "upstream_id": "BenchmarkTest02684", "language": "php", "code": "header('Referer', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $_body = file_get_contents((string)$data);\n DB::statement('INSERT INTO feed (data) VALUES (?)', [$_body]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16a9e7a4bc644dc8923cb43782a0d81c11b7c3da67d51fc3d29868f3d244b21c", "structural_hash": "b4766d5ca1d2f2d4d9532afda77cf1115c641437850a9a00a938a3178fb96c46", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32052.sh", "upstream_id": "BenchmarkTest32052", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n rm -f $processed\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3aa80c45b1aa4e1f24f27f5bfa28a7a7febaae8daf4815ca1786526b35502684", "structural_hash": "4178c9d9857e5e2ed48ae72a066909a252e4fd2d224471181a46613668d4cb74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00933.php", "upstream_id": "BenchmarkTest00933", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $data = trim((string)$userInput);\n $processed = str_replace('&', '&', $data);\n file_put_contents('output.csv', (string)$processed . ',data' . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "587c94f3296c86077b19a3bdd04a81462bced9bb21a4845cdce3eb67be2b27f2", "structural_hash": "b09108df49fedccf85fcff0b3acfee023dbc3e2da06e2908fc64b569b17818c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_06088.py", "upstream_id": "BenchmarkTest06088", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n if auth_header:\n data = auth_header\n else:\n data = ''\n os.system('echo ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ba4ffafdcefde65e2a0527819b16a96f6bc04bd772dcf1738f1117d8b6c9bd1", "structural_hash": "cff3b8a16a2ab778e70ad37e97db05dd2f29514df4d5caa03dec2013a159a49c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00199.py", "upstream_id": "BenchmarkTest00199", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request, path_param):\n path_value = path_param\n data = '%s' % str(path_value)\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3429944aca2c9bde596fafa2c3fbf6dd6af6186010b129f78bd2d9748f31dbb", "structural_hash": "dfa1070581d2365529b6602579406177a675c92c625a65fb9eb4dcb4d36f2388", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02099.rb", "upstream_id": "BenchmarkTest02099", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n Net::HTTP.post(URI(\"https://api.intra.net/data\"), data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb2c3815553031195a3f556043b6662e247e871eb20df199f79ec3553d143adb", "structural_hash": "9d7a0cce3e084d2f8fcb6fd8b83f3613286d405538777d6530b6184dca1cade9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01263.rs", "upstream_id": "BenchmarkTest01263", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse tokio::process::Command;\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = urlencoding::decode(&user_id).unwrap_or_default().to_string();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef6f9349e92f2315aa10c7fd69b9a4a79634c87bc11fe723964892eb4ab23dcf", "structural_hash": "fdfb8294079c14d712572999b412545fd0bc1e5fb82df29a9c01a15358493bf3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02632.ts", "upstream_id": "BenchmarkTest02632", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const cell = /^[=+\\-@]/.test(String(data)) ? \"'\" + data : data;\n fs.appendFileSync(\"report.csv\", cell + \",ok\\n\");\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c956ead09b91c61e304af8a2e2e6c8035be4d430d4f9ce27e1369c7b6ce8883", "structural_hash": "e210bd5705772c5e5ad4a111c01a06860658bfb52be589b92c3d6191d1bb003a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03458.php", "upstream_id": "BenchmarkTest03458", "language": "php", "code": "getContent();\n $data = sprintf('%s', $userInput);\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$data]]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "202fd490d5381afcc09d29f5a87345ceca13fb239f02728e3b7ec408a07998fc", "structural_hash": "e558c26bc0372a254bdb8102d2c9b71a2b1936aac28d2748b595f5d70bf1485b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00268.sh", "upstream_id": "BenchmarkTest00268", "language": "bash", "code": "benchmark_case() {\n store_cred=\"$APP_SECRET\"\n openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$store_cred\" -in /dev/null -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a029b1f8055ed1630a7b408e031a036323e94655fc64d7c9205ae3a588921bf", "structural_hash": "90e0940d5d72709a725ade730d25e862fe6039f33be02821ea9aacfe186e6a37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04701.py", "upstream_id": "BenchmarkTest04701", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n data = '%s' % (auth_header,)\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n if result is None:\n return JsonResponse({'error': 'not found'}, status=404)\n value = result['name']\n return JsonResponse({'name': str(value)}, status=200)", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99ebec1d3970c51f4537abe8abdb0798d0947da5fa0b0d940a2bc5fdd8961271", "structural_hash": "7516bb1c26b159deb0531028f7d2fbfa674c6264663fd64a518123cc19b8e51e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08327.c", "upstream_id": "BenchmarkTest08327", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", data); fclose(_cf); }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f87e89222ca06aaa8b8fe17c7cbd479f582d3b0d26b39e7927905a81e996d1be", "structural_hash": "61b818f8504c6c18465a89f738e2a7d5f2e3c22379687c39c978cece5318a2dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_34760.go", "upstream_id": "BenchmarkTest34760", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(authHeader)\n\tpluginPath := filepath.Join(data, \"report_renderer.so\")\n\tcontent, err := os.ReadFile(pluginPath)\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68f040e09ff34d6280dba2cb5bc30848e8f94fac16778b2bce836ce3b6e15b3e", "structural_hash": "b83cb04ba2ed42a2401aff7d0c6fe8c5728ac4536925382947b897ad5ebb8abc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02789.cpp", "upstream_id": "BenchmarkTest02789", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9229135225063b82389ba8b1c66c7bd4386515b7d6f479291d757e38a3e3a607", "structural_hash": "8d1eac5ab96e84550b350bf665187f06f22cfbb1aae406506577a2dfdc111c28", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03469.java", "upstream_id": "BenchmarkTest03469", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String stripWhitespace(String v) { return v.strip(); }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String data = stripWhitespace(commentValue);\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n response.sendError(400, \"forbidden\"); return;\n }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0421fcf6673b0358dc022bc1fb42c3cdff6253b3469341702d8ea1fb31736c78", "structural_hash": "be71c30665aa3c03e7b364da06f34395cce76358b2d10d091510e8b374c667d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02049.java", "upstream_id": "BenchmarkTest02049", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : authHeader.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n java.util.Set allowed = java.util.Set.of(\"ls\", \"cat\", \"date\", \"echo\");\n if (!allowed.contains(data)) { response.sendError(403); return; }\n String allowedBin = data;\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + allowedBin}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2fe3fadfe1c7e9f769ee95b1e1055dac82e56c5c6af2d757a1ac256cb7f1892", "structural_hash": "63bcdcf307d6f0a2d69866dc344464effdbf5688d903e75023c75ff30571e22b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01762.php", "upstream_id": "BenchmarkTest01762", "language": "php", "code": "json('variables.input', '');\n $data = call_user_func('strval', $userInput);\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return response()->json(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n return response(\\Illuminate\\Support\\Facades\\Blade::render($parsedBool))->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "332bec16d0824d8b8b2d9df34b1d1d81eed28aa64e47c7486d7b4797e7db8f2b", "structural_hash": "ebd563669b43571fda1f6ec98ce1aa7221763be79462645bde6330baaab666fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02145.rb", "upstream_id": "BenchmarkTest02145", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n @user_input = user_input\n data = @user_input\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3715abb81fb21dbcee0dac636835f2ab2e94766293cf1e86a4bb8f6593d53c04", "structural_hash": "8126a6b5f3df175379af96bb769a00768d722a648b76256f25e690f063581279", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00086.java", "upstream_id": "BenchmarkTest00086", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(headerValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22442a6ac6432a1c63ffccdd3c10c8a84596d66310c91ec8f5e8795beddf2510", "structural_hash": "7ef54e930d7fc5d1bb79b7035fde0f788871ea3ea2fb7772bab531d2bd068a7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05549.rs", "upstream_id": "BenchmarkTest05549", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = cookie_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n let _: serde_json::Value = serde_json::from_str(&data).unwrap_or_default();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ad7558c9a95cbef7b48b9120783d189d72b4e07069a18be4eb12505e665dd9f", "structural_hash": "1c78b555cfd6229d7a96f62f15c8e797513a4a8b5bfa127530abe5d6f5f462d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04864.rb", "upstream_id": "BenchmarkTest04864", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d364b861e58996e5f231578b4120047ebf071c6d25862d4ed6940d1571279bff", "structural_hash": "d3c7ce8c31a73fdcad70a1e766de3e4d5e3e8dd84aef93ad6466eaba03755cd8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02144.rs", "upstream_id": "BenchmarkTest02144", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(origin_value.clone());\n let requested: u32 = data.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "220124c233877832d5323888ee137e547ef136970d59b005594e084b355440c0", "structural_hash": "15403e1670f8b84f24d05e570b0cdcef837fa31f8203fc3423f149e5d299b5e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02921.sh", "upstream_id": "BenchmarkTest02921", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(printf \"%s\" \"$user_input\")\n echo \"$data\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12fc451f24f1ca8df5c79fe7905714d8eeb3daa06b72ca3cd80526fff4781006", "structural_hash": "fc625d484db286cbb97a27cf26582ce4389942e489fdf7b15654998cbe853477", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03131.rb", "upstream_id": "BenchmarkTest03131", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n response.set_header(\"Access-Control-Allow-Origin\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "114605a78f0dd6eb98566a09fa2ae1c27a85ab572554109209b663c188f9938c", "structural_hash": "0ede2f54dff685c70b329a56f20256c0cafdddd95cae44262a06b4cdf8a6f1ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02809.java", "upstream_id": "BenchmarkTest02809", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n private enum AllowedValue { INFO, WARN, ERROR, DEBUG }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.List tokens = java.util.Arrays.asList(envValue.split(\",\"));\n String data = String.join(\",\", tokens);\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c33ca37943761ba4d0d7d3fe01e580a6ec2294a78884a234aa60ad44d065ecd5", "structural_hash": "bc130ae04a89e841017c73e55f8e44bb38804b4fdcda9e38f352575eff24758f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04233.py", "upstream_id": "BenchmarkTest04233", "language": "python", "code": "from flask import Flask, request, jsonify\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n reader = make_reader(forwarded_ip)\n data = reader()\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c079af68f173cf866b4b08e6435064c4d5afaa38e0b0765ea395a34d6dadeb81", "structural_hash": "7fd6a3e6635552f4a377300df56dae52af3445ccbf08fb43199a028119951fad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_25188.go", "upstream_id": "BenchmarkTest25188", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tdata := strings.Join(strings.Fields(uaValue), \" \")\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-337"], "category": "predictable_prng_seed", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16136ee21be628eaa30048882c8b4044fea1d2ffffc9ea542aad43b0065d3fdb", "structural_hash": "2575235429ebeeca2204bffe7bc965c983f1b357939a93cb058ec58ef1f165e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00054.java", "upstream_id": "BenchmarkTest00054", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n return Response.status(500).entity(\"Internal error\").build();\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "404e29d9ede2441737f4855cce494b0dfd9a00cae9bee1790fa28af09b232b7d", "structural_hash": "fc8f419940f437022741b03d8cf11874d0681bb300dd7018629f18a6f465141b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17589.js", "upstream_id": "BenchmarkTest17589", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(nunjucks.renderString(processed, {}));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d210eb107e8c9d028ef92aa74625e73b8cc6e3667593cade3e4db192e2ecaa84", "structural_hash": "51032d299b608a92bea647b97f94542b0a6547d9245a6fb24b1d203f4ba66c62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01853.c", "upstream_id": "BenchmarkTest01853", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n FILE *_f = fopen(data, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3caa35f5ffde23c194824f34756f24e4cc3e873317f06332d24065adb74bbf5", "structural_hash": "14630054490a8da6f78b74b60f95a18b83cfebf4eb4720225fd927db053da2ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03165.php", "upstream_id": "BenchmarkTest03165", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $data = ($userInput !== null) ? $userInput : '';\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34be14e590bb76f466defcb2a76603d83269f6873895a962cfaf08d5d29fd75c", "structural_hash": "67f61590ea275070850e1f966bd2ab1f99964edefae67110fc65f91323580d30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05231.py", "upstream_id": "BenchmarkTest05231", "language": "python", "code": "from flask import Flask, request, jsonify\nimport re\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n if user_id:\n data = user_id\n else:\n data = ''\n if re.search('[a-zA-Z0-9_-]+', str(data)):\n return jsonify({'validated': str(data)}), 200\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8e248b2f71c05e2963b9063d2c68211ffc612e64690f1fd58dfdba76ae737ab", "structural_hash": "12c614a77911274a7868de0433848c32c8215aa1c87657c3ba42ebeb285247a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01746.sh", "upstream_id": "BenchmarkTest01746", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n processed=$(echo \"$data\" | tr -d '\\r\\n' | sed \"s/[a-zA-Z0-9]\\{4,\\}/****/g\")\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e2a5f9cd8e607ea5d4ed5753c69ef998a234cd338622445f8c854dfa9ebecd7", "structural_hash": "7281426ed636b71431ac33c3c50f50021b06e8a3d1b1e66dde24d00abf28ab45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05555.ts", "upstream_id": "BenchmarkTest05555", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b3b9c511fbbb832e888a8f19e3d9768bc2b6222c1dc331dbc0b59ae394c667b", "structural_hash": "fe42ba3665304f1f6c7dc23b0bd1de35e5ae1d6574b57fd9f10d274eced40469", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04999.py", "upstream_id": "BenchmarkTest04999", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import db\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = {'secret': 'p4ssw0rd_test_xyz'}['secret']\n reader = make_reader(secret_value)\n data = reader()\n db.connect(host='localhost', user='app', password=data)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "781df03298e2b870ffc4e1c9afd80c93e44c0b30ae60fdf8aea9b5c452ddd90e", "structural_hash": "4be6d967d19112d5ce2eca94b4d01c8a544fd779016ac8a3322480e09261a72c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05149.py", "upstream_id": "BenchmarkTest05149", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom lxml import etree\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n parts = []\n for token in str(db_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef4f4d125f0ffaf4d4718452705dd4195c0f3498fea2ef0624ab967585e610e2", "structural_hash": "2675c9e4ffbe2c90fd8dffc9dc704d1a7fbebe4aca1d96983ed20289f2f8f10e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02193.rb", "upstream_id": "BenchmarkTest02193", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = user_input.split.join(\" \")\n host = URI.parse(data).host rescue \"\"\n unless [\"api.intra.net\", \"cdn.railscdn.org\"].include?(host)\n halt 403, JSON.generate({ error: \"forbidden host\" })\n return\n end\n target_url = data\n redirect target_url\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dea7398581564e75f2a306e462c15c3f81a49825bb56e2b870ee8cbeeacfa185", "structural_hash": "a80fc0be37acbfc42c0d18d64f5aa4d428f2c179847c0e60cebb0b814bd1a16c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12531.go", "upstream_id": "BenchmarkTest12531", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tform := FormData{Payload: refererValue}\n\tdata := form.Payload\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\thttp.Error(w, \"invalid\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7fd39dc9dfb50724b308d0b1e0b669bf540ae68d49b0b20c12ab7ae7a92845f", "structural_hash": "091b3ba875e705faa9e82210c2bc5b44fde3f2291bacbfbd0d72098110c651cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04433.php", "upstream_id": "BenchmarkTest04433", "language": "php", "code": "input('field', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n if (!hash_equals((string) session('csrf_token', ''), (string)($request->header('X-CSRF-Token', '')))) { abort(403, 'csrf mismatch'); }\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98574b196acee3a89bc1ed3e96d5a475c5fe1245f1c5402d991593c9c118a159", "structural_hash": "6b0a970794c1f1e81e0ed02c6e6e3e74eb7806b24b8ce28745fbbe0fd687107f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05575.java", "upstream_id": "BenchmarkTest05575", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data;\n if (fieldValue.length() > 256) { data = fieldValue.substring(0, 256); }\n else { data = fieldValue; }\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3fbc48f139511d2cce0c7e987f355fef0d88d62a6bdd8e207213ce5b8ac4c9f2", "structural_hash": "a145cd90ae3d767db3f8d579aa20e8fc67289f1527e6d4dca922e5a7b5da2c34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00860.py", "upstream_id": "BenchmarkTest00860", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom app_runtime import auth_check\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n store_cred = os.environ.get('APP_SECRET', '')\n auth_check(str(user_id), store_cred)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41dad25858223fd35fbc37d49d7b63a4c42fab1ad0221cdcad79f33ba4a0d2e0", "structural_hash": "117597574583ab86b2b8c85f3b91e2d9d1b7dc34291ad13ddb90e8efe79a2f7a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02892.js", "upstream_id": "BenchmarkTest02892", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7ede74397a82bfd7fe6d43b79c998296b2b9da90f127884f8ec9d52e5180d7a", "structural_hash": "7fb60452e0d8d1a22a1c48a38a18763c66451cbe46829f5053f9a6fe8dfa4490", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00798.ts", "upstream_id": "BenchmarkTest00798", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n res.cookie(\"session\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84991dcc12c562a0e9c97a5f362dfba353bfe30e788c9fe5a147bf7d96fdd0c4", "structural_hash": "7e940d860a84d9b5cf14aa7d3597ce483aeb4b955c5e19010f447cad0b671f2d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01019.c", "upstream_id": "BenchmarkTest01019", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0777);\n}", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7ed39a7159eb68279edcfa6a87b787c9e5c5837cde7bfbf00540863e893694d", "structural_hash": "de683b582ce3cbea92d50116225368c9ac23d109a9b88057f68d4cab737ac434", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00865.php", "upstream_id": "BenchmarkTest00865", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n if (!hash_equals((string) $request->getSession()->get('csrf_token', ''), (string)($request->headers->get('X-CSRF-Token', '')))) { throw new HttpException(403, 'csrf mismatch'); }\n $conn->executeStatement('UPDATE users SET name = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "331e64e6f64dd3a20ce922db5bdf71e5c12a1f81a43a3ef89aa9e2d07b17cc2e", "structural_hash": "42c0dfe76efb874f660dfb780b6feaa81fd03e24e0b4375587f070b80592c20f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00104.ts", "upstream_id": "BenchmarkTest00104", "language": "typescript", "code": "import { Controller, Headers, Post, ForbiddenException } from \"@nestjs/common\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { throw new ForbiddenException({error:\"host not allowed\"}); }\n if (!allowedHosts.includes(parsedHost)) { throw new ForbiddenException({error:\"host not allowed\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d25ceab42aeecaac86f9fb6a16f23ef55601826f3d1030a11901a0d4e976c479", "structural_hash": "89e6cbcfe44058ce7ee1ace9b7646c7309a60563ad1be94644d1102eed547f9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14004.js", "upstream_id": "BenchmarkTest14004", "language": "javascript", "code": "const https = require(\"https\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "213d0c6bd64be66cd1d35ec5ffe9160c1c920e830e42a9eec753aefadbd3da6f", "structural_hash": "b6743fd1ef2d917e8dbff0daa4067b3eb7c46982ad9b7d5e45347bc659c44c0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03403.rs", "upstream_id": "BenchmarkTest03403", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let dotenv_value = std::env::var(\"DOTENV_VAR\").unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = dotenv_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n tokio::fs::write(\"/var/data/hashed.txt\", crate::shared::hash_hex(&data)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2443e4c8a5b7357e4d27918341eeea165fc79098c64ad93ed7401f95d36e6d65", "structural_hash": "b606fb185606550597e30e90daa9facc13e8f89d897bf786f1aa2a8386ad0a78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03345.php", "upstream_id": "BenchmarkTest03345", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97f4c959bfd4bd926fc98a9fb02c863a9cd92c2b352422ec01f1b596d7e4bd5e", "structural_hash": "7a52b5de94123d535555cb17a1edcecb397d3ff41b7ee7c40039593b8ba00bb9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01448.sh", "upstream_id": "BenchmarkTest01448", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n mysql -e \"SELECT * FROM users ORDER BY $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6398de14544873a62af181f71dde1b871cf00ca9ffa768671624c0162919cb1", "structural_hash": "44abea8a7971a5eeff16d8d9cb955d1532fc08efdabb8728333ce29f25b21796", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17600.sh", "upstream_id": "BenchmarkTest17600", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$user_input\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$user_input\"\n normalized=$(echo \"$processed\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$processed\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46d2f3953e6cb3a5899c4c17a47af145cf973d576c1af7abffc2d3f0874a1fef", "structural_hash": "9773fc20b38826833d295e40e8b7f0394432a6b6187c688ceafc1a10d8599204", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04030.c", "upstream_id": "BenchmarkTest04030", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "452ec00a5911d6df22a33e9beeda53e1bb7067dd764acf30cb37e969f1cbb204", "structural_hash": "bc666b4e415a4b6be12cf061985ac3886c9c753472ea5689d7e2b149ed23ad7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03014.cpp", "upstream_id": "BenchmarkTest03014", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n std::string safe = data.size() > 4 ? data.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ff4140da7feff0a3ed121500af568a150c3f9b86539243ab4c921e5bc749c8f", "structural_hash": "d2de9930eb46759a9d2db3ba9871518c45e2ec9b528b2834d5b18ab9195c2575", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03421.py", "upstream_id": "BenchmarkTest03421", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\ndef coalesce_blank(value):\n return value or ''\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n data = coalesce_blank(user_id)\n if request.session.get('user') is None:\n return JSONResponse({'error': 'unauthorized'}, status_code=401)\n request.session.clear()\n request.session['user'] = str(data)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "250a1f5eb7ba61ea71df9bb6d9f41461747766d5da3b6b931554e6d1883baecb", "structural_hash": "4997d46c525eb8ab6f062776311c521e7efa64e73e5acb89f86b4ebc431e4343", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04046.php", "upstream_id": "BenchmarkTest04046", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $data = str_replace(\"\\0\", '', $userInput);\n $conn->executeQuery('SELECT * FROM users WHERE id = \\'' . $data . '\\'');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c51270164f0bd46386c03508eaaa479079398c62387ca6042c0962e45eabd378", "structural_hash": "d3ba5e4d4c9d3d0b17fc61ed22fa500d8db350920fe8500e9ccda660f0a46881", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02701.cpp", "upstream_id": "BenchmarkTest02701", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) return;\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c6039f707a74acc9b4087e1e9da282e6e1aec504677d3a856b34565ea9b2c77", "structural_hash": "b81823bee884b3a64aa3554bcec9b57d5ccabfc0c4c75033e9c0b0a0b542746e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04851.rs", "upstream_id": "BenchmarkTest04851", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let transform = |v: String| v.trim().to_string();\n let data = transform(multipart_value.clone());\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f207fbdbea41b49b94d7747f40e9c23649017c83d7a954409812da019f729da", "structural_hash": "83ff4fa459ab067240e265413ee9d69c9b6bf195f29222a6cd78f47200adc853", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03336.php", "upstream_id": "BenchmarkTest03336", "language": "php", "code": "headers->get('X-Custom-Header', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n file_put_contents('output.csv', (string)$data . ',data' . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "baa4caa5bba8f853d510bfb0c6bcb4fcca67d4f8571ca7c16be265f64b88605b", "structural_hash": "0b638f0fb001c3bbc92bafb545c70292c575c96c75f8a73f0f770d5b0f3ff9c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00884.rb", "upstream_id": "BenchmarkTest00884", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = user_input ? user_input : ''\n system(\"echo \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d544777e63e05a7cd2398f11b473770ecf1b5a169ab048336714f8a70a06f2da", "structural_hash": "8c4ca13b6558673669189da6b8fdcd45c8c493d26e0ea05457ae4f71e4071335", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05434.rs", "upstream_id": "BenchmarkTest05434", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse hex;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let data = String::from_utf8_lossy(&hex::decode(&cookie_value).unwrap_or_default()).to_string();\n let processed = data.parse::().unwrap_or(0).clamp(0, 2147483647).to_string();\n let requested: i64 = processed.parse().unwrap_or(0);\n let count = requested.clamp(0, 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ccacec77fbc1749b213da9a3b61714db63ba0cf8f1fd0e1f40c795163f50b77", "structural_hash": "f5b21758b82bf1c5e75b661832e6dfc933cc49d13953dc0b01fc098a4f2ae8d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31906.go", "upstream_id": "BenchmarkTest31906", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\tdata := configValue\n\tif _, after, ok := strings.Cut(configValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d7900144270a9665ed208ecfb0312f961c22a08cd813c8d6c87d4b57ff1aa6a", "structural_hash": "ca12f092ad4a1e429221ebfa36e0472b8dc975035b58ac8269bada9cc0a541df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00044.sh", "upstream_id": "BenchmarkTest00044", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef30bb6856755e09374d0c6919e4757ac9298b620055e281d641e90017f83f6b", "structural_hash": "28669153c0c091ee7e0f196c52e040b022c9dd6a93f5c0a8695647f4491b4039", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01404.c", "upstream_id": "BenchmarkTest01404", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n printf(\"%s\\n\", _p);\n}", "label": 0, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "568164b3e90db984f3c562df8220876e399bd7f5ff6d75cbf72a59389012d2f7", "structural_hash": "932c627349c36883edc49d33d679ba34c67eaac2f6463ae0820fb96453c1b011", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25332.sh", "upstream_id": "BenchmarkTest25332", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=\"${user_input//$'\\x00'/}\"\n checked_path=$(realpath -m \"/var/app/data/$data\")\n if [[ ! \"$checked_path\" == /var/app/data/* ]]; then echo \"forbidden\" >&2; exit 1; fi\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd37c20546b8a70e3b41ca5c0ca6d75722ca2b3ff9d9c5e5f436a8556a176065", "structural_hash": "02ddc2f2d82a421a60aa48ab2231d524a51309228f72f90fffde779f2e65bbe8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09644.sh", "upstream_id": "BenchmarkTest09644", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n _bypass_re='^[a-zA-Z0-9 _.,;:/=()|+@-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n arr=(10 20 30 40 50)\n if [[ ! \"$processed\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n idx=$processed\n echo \"${arr[$idx]}\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ed383474b485974635fed6a7003b9308ae9c1611f2f7f4593b8b7e56c416bf6", "structural_hash": "7767b0c189c69a5b8148834ad5641f93324a3b26be1fa6aa39704dc03029369c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05118.py", "upstream_id": "BenchmarkTest05118", "language": "python", "code": "from fastapi import FastAPI, Request\nimport json\nfrom lxml import etree\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n try:\n data = json.loads(db_value).get('value', db_value)\n except (json.JSONDecodeError, AttributeError):\n data = db_value\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30dbb268d89a484b2885a16cf4da66e6a4d4ef1fb43cc58b8ac02b6c4055d980", "structural_hash": "00729748ecde0e447a3af900bcbd4f104b9bc9061e033f47410266378867d767", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01422.rs", "upstream_id": "BenchmarkTest01422", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let (payload, _origin) = (env_value.clone(), \"http\");\n let data = payload;\n crate::shared::auth_check(\"user\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c5c1d55b7e78f71c939b0740936dd718654dbf4ed67bc27f114fd51bc4d6baa", "structural_hash": "0a2dbab75ba6d890d2c3d85ecd62c725903d4f4ab41889e6c6bdc7f350b1af04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18079.sh", "upstream_id": "BenchmarkTest18079", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n checked_path=\"/var/app/data/$(basename -- \"$data\")\"\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2142ff5cb524da464f5a17f776e65e5a2eb07ca31ae6882e6463eee7902f53ae", "structural_hash": "310949663e0d77d42d84803ea7d60cc8664b775b560c86e01eed0c41a35ca761", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03830.php", "upstream_id": "BenchmarkTest03830", "language": "php", "code": "headers->get('Authorization', '');\n $data = (!empty($userInput)) ? $userInput : '';\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7f0001b0f800a9ff2df068b2d6ef7821a1c4a62ce2e59bb91431792a4be59d2", "structural_hash": "65458263832bd170db2fa3cebc30749922327fc67707cbed871b7a7cdfa416ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00382.cpp", "upstream_id": "BenchmarkTest00382", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n int _req = std::atoi(data.c_str());\n int _alloc = _req + 1;\n char *_buf = new (std::nothrow) char[(size_t)_alloc];\n if (_buf) { _buf[0] = 0; std::cout << \"alloc:\" << _alloc << std::endl; delete[] _buf; }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f805b11f9c94931d8dc74e5dd643b1915444ad8dc138030d6ba4af87669d8349", "structural_hash": "0a10d82e5493c3635e75c984bd8ea513fa4f030021e1495e00f0d2917c7622f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13208.go", "upstream_id": "BenchmarkTest13208", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tlastRequestValue.Store(cookieValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tc.Set(\"data\", data)\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "200b62559e6bb2209340f1e573b425029d8b49a17a06f9c17291a380185e6d9a", "structural_hash": "6a99d33102602250f5ec34ca70fa2c6de9599829777f988948ead3f241766f71", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03756.rb", "upstream_id": "BenchmarkTest03756", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n tokens = user_input.split(',')\n data = tokens.join(',')\n if [\"https://app.railscdn.org\"].include?(data)\n headers[\"Access-Control-Allow-Origin\"] = data\n end\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f2bc416f3835d2229120ae8ac095dda0cf37e10052d06161ab022fbafd53041", "structural_hash": "0c7349c106d501644bf23e2e73051342fdd380e228234ecc8566862185f8c557", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_22876.js", "upstream_id": "BenchmarkTest22876", "language": "javascript", "code": "const http = require(\"http\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21f401fc33a35e96e9e4a68cb444191411b838e238927dfdb6cc627e1da4387f", "structural_hash": "baa23df7caf24b5dd73df46e3902e7839c95c45a7d4c97699893c88318685b14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05031.java", "upstream_id": "BenchmarkTest05031", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data = \"\" + headerValue;\n response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e32254eaba9ed716fb63056a14e5ad6c5804f68a15ba67c530559a78dc2121ce", "structural_hash": "ff6b44539fd44dbb1877dc383d2f89af80d213d9d2b660348103f3b702ffb776", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03218.py", "upstream_id": "BenchmarkTest03218", "language": "python", "code": "from django.http import JsonResponse\nfrom lxml import etree\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n pending = list(str(json_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(data) + '\"]')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec95306f44946928043a385fd1e1a8335fb59d4da66a43bd0b4475348bc05611", "structural_hash": "a80ce3d84c79f11046a996d92483e372f32dd890c7e3ef7c5666f2ffb5e77c2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03798.py", "upstream_id": "BenchmarkTest03798", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom dataclasses import dataclass\nfrom starlette.responses import JSONResponse\nfrom app_runtime import auth_check\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\n_login_attempts: dict[str, int] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n form = FormData(payload=raw_body)\n data = form.payload\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if _login_attempts['user'] > 5:\n return JSONResponse({'error': 'account locked: too many attempts'}, status_code=429)\n if not auth_check('user', password):\n return JSONResponse({'error': 'unauthorized'}, status_code=401)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "085f002a2c2228cd3a74f84b10c2998103664a93181a0a52903954e4f43cc399", "structural_hash": "233061463da7615fea388664fc53e283ecd245207d1285c508bb24dba33c1b2b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01907.ts", "upstream_id": "BenchmarkTest01907", "language": "typescript", "code": "import { Controller, Headers, Post, Redirect, ForbiddenException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Redirect()\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const data = String(userInput).slice(0, 200);\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { throw new ForbiddenException({error:\"host not allowed\"}); }\n if (!allowedHosts.includes(parsedHost)) { throw new ForbiddenException({error:\"host not allowed\"}); }\n const targetUrl = data;\n return { url: targetUrl };\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "852724ca94a886ba14804d9108558ff8d29be2c6820226a67059450d34d57031", "structural_hash": "f0030c42b92c39429665b7cba1422b99ee9f9e3543a52cd8fcf2083074e21be4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13642.sh", "upstream_id": "BenchmarkTest13642", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4721753efe422875cf87dab9e99ef16c09572a56821c1e6670973bf0d4bde40", "structural_hash": "f4af68ecc135facca998add577e31cccb9c73ff03f1291cf276be81eb37b001f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00763.ts", "upstream_id": "BenchmarkTest00763", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const data = \"\" + userInput;\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ccb9b6e003bdde3fdde3b8fa2404809217aa8bbd5d6bbd6f29226a4f6ea85fe7", "structural_hash": "7f466e57126939891e8f78924f22b1759ab816403f2c6b83bb89707a66ac6f83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19704.js", "upstream_id": "BenchmarkTest19704", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2437839e6f9ad797357a1ed41dbd87a166294f1c350a75e2ce0d6a847d80943c", "structural_hash": "6f7dd5f4da80b0e022da9097ef834330a09adc52b204aba7d80dfb3fb8c9328d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32530.sh", "upstream_id": "BenchmarkTest32530", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n trusted_claim=\"$parsed_bool\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb79e416ddf0f8506030225a1902ee8787961ccf108656063dbe6bf53cff5dd1", "structural_hash": "dce30915ef5295a5a01f1b78e9fb15298203aaf8c0f59d0740c7606378b01ac5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_23457.go", "upstream_id": "BenchmarkTest23457", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tparsedURL, err := url.Parse(pathValue)\n\tif err != nil {\n\t\thttp.Error(w, \"invalid url\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tallowedHosts := map[string]bool{\"api.svc.cluster\": true, \"cdn.gocdn.net\": true}\n\tif !allowedHosts[parsedURL.Hostname()] {\n\t\thttp.Error(w, \"forbidden host\", http.StatusForbidden)\n\t\treturn\n\t}\n\ttargetUrl := pathValue\n\tresp, err := http.Get(targetUrl)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tw.Write(body)\n}", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe144527b180abb3e445a509a4258b44f6d096e2cc4adac1f0a8888c5d6d9c77", "structural_hash": "bca6f2e1f7ac6278dd17cada6b2adaf87c4783d3ee1a61a60a9e0992d52d4f2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03633.java", "upstream_id": "BenchmarkTest03633", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n String data = \"item_%s\".formatted(forwardedIp);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c1aea22bebbf8df5440e6631a0af48582641a112e1814bdf2a2540c2f3104cc", "structural_hash": "ae0dbf8ac5af04a34a3091a556ef6cec382b20582640280d9556ebeea29692b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09177.sh", "upstream_id": "BenchmarkTest09177", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo $((RANDOM % 16))\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-331"], "category": "insufficient_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef254e0cc99ef1a2f0681aaabc253e13c109a50dd11d6d48ff959cf396991802", "structural_hash": "b215f894ef37fa457bb4652fad0308951dd0b7d19bab4c7eac02c214ef8d2058", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05336.rs", "upstream_id": "BenchmarkTest05336", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data = xml_value.replace(\"\\t\", \" \");\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n ([(\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b3cdb65c94f627ac6cb060a39a068714c9e8ea3bc521ca09721d8fd944b5bc3", "structural_hash": "d99e5908e37df980c5515cfb0f046962b34ca49d948b125c80e331beb8f5c4f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_31905.go", "upstream_id": "BenchmarkTest31905", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tcapture := func() string { return commentText }\n\tdata := capture()\n\tallowed := map[string]bool{\"config.json\": true, \"index.html\": true, \"readme.md\": true}\n\tif !allowed[data] {\n\t\tc.String(http.StatusForbidden, \"forbidden\")\n\t\treturn\n\t}\n\tcontent, err := os.ReadFile(\"/opt/app/plugins/report_renderer.so\")\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70ad1ad472e2ad67a5204f9d1321ddcb1714922d0b0e03a1f85d499828cc42e4", "structural_hash": "acc74628da41b5180d021c6c8bd7a648b44f8c9b4779ebc8331a337713b82d19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05574.java", "upstream_id": "BenchmarkTest05574", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String data = headerValue.isEmpty() ? \"default\" : headerValue;\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04e2f516a9a5a8e6f1fa34bf6a99e41707d6b84eae579fb430418ccc06f840d8", "structural_hash": "7295e02f303bc218bb58516c2c8d9df3d11f2f526c1c063c984d5fbb9221a142", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12345.go", "upstream_id": "BenchmarkTest12345", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(commentText) {\n\t\tdata = normalizer(commentText)\n\t}\n\tprocessed := data\n\tif len(processed) > 64 {\n\t\tprocessed = processed[:64]\n\t}\n\tsharedCounter = processed\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa17b067011e207e04bcf6c21555e370c54e1d5c28e8a8306941b511625da0f5", "structural_hash": "874d79e906edac2b52e90ee738a96f07df8e3b3d0f8bfb9f0be60ea386ed5d27", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01616.ts", "upstream_id": "BenchmarkTest01616", "language": "typescript", "code": "import { Controller, Post, Query } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const data = `${userInput}`;\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n const _digest = crypto.createHash(\"sha256\").update(_content).digest(\"hex\");\n const _trusted = \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\";\n if (_digest === _trusted) { fs.writeFileSync(\"/var/app/active/pkg.bin\", _content); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96cef0806accb7817e7188da4221f2035956eae81d0e8a66b58300858f93aac7", "structural_hash": "7852077bb960c04a6c04b7cf0226b74862a3eb5bfc82f3e689d3d36f8537dcb6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00871.py", "upstream_id": "BenchmarkTest00871", "language": "python", "code": "from django.http import JsonResponse\nimport ast\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n try:\n data = str(ast.literal_eval(user_id))\n except (ValueError, SyntaxError):\n data = user_id\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b23cff95bc2cacf7298e1d5bc73cac334c6bbc0cb5af4fbe41171a0b390920e", "structural_hash": "e963bed752dd75ac19e99ae99e65dcb4733ce59885b7334909949671601aec52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04478.java", "upstream_id": "BenchmarkTest04478", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @POST\n @Path(\"/benchmark_case/comments\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"comment\") String commentText, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String data = normalize(commentValue);\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30cc50fe19f8d5ebd2590a5b9e77002614e6aa425b330c5b4fe0e4b34a9e0770", "structural_hash": "337d1d526b4780ac727411bccabaa9dac06b29b36d78523d426dc4472b9df397", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02601.java", "upstream_id": "BenchmarkTest02601", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + headerValue;\n String data = valueSupplier.get();\n try (com.mongodb.client.MongoClient mongoClient = com.mongodb.client.MongoClients.create(\"mongodb://localhost:27017\")) {\n com.mongodb.client.MongoCollection mongoUsers = mongoClient.getDatabase(\"benchmark\").getCollection(\"users\");\n org.bson.Document nosqlFilter = org.bson.Document.parse(\"{\\\"username\\\": \\\"\" + data + \"\\\"}\");\n org.bson.Document nosqlResult = mongoUsers.find(nosqlFilter).first();\n response.getWriter().print(nosqlResult != null ? nosqlResult.toJson() : \"{}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8d28b45f71e7e51cadee6dcd626e584af93587a0ee882460bdaa976ec9432b70", "structural_hash": "f88fefef5a475ecce763bb4c59031dba9398b71c8c55e4ca114784b4baadd32d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05553.ts", "upstream_id": "BenchmarkTest05553", "language": "typescript", "code": "import { Controller, Param, Post, ForbiddenException } from \"@nestjs/common\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "090ba044945f409a7681e75cbbabbdabaf49764eef536f5637de03ee4ba8cdba", "structural_hash": "0229856ae8cc924931574cc45c6cd3436ebdff31cd97cd69991234c795dc9d3e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03495.php", "upstream_id": "BenchmarkTest03495", "language": "php", "code": "header('Authorization', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $cred = getenv('APP_CREDENTIAL');\n $_match = hash_equals((string)($cred), (string)((string)$data));\n return response()->json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac5e3ac3471551d09ec66658524163b211445b57f2370485a53167c216a62538", "structural_hash": "0448219e7e0c36c7318db2b0624975a106c50a41239abb9880e5c66e7b6da665", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24076.go", "upstream_id": "BenchmarkTest24076", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- graphqlVar\n\tclose(_jobs)\n\tdata := <-_out\n\tif os.Getenv(\"APP_ENV\") != \"test\" {\n\t\tconn, err := net.Dial(\"tcp\", data)\n\t\tif err == nil {\n\t\t\tdefer conn.Close()\n\t\t}\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab5c6e70863a6b27a21a98865af9a6fa427c3d90edc4555ddbfdf121540f0b31", "structural_hash": "0a71519b0b4cd92e2070cbae06d566feed358797989fe819c1b0bb46388f57d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_31897.js", "upstream_id": "BenchmarkTest31897", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17e161a2abaf7176f149eac3e691524e39c58af02157a5e73dca12d2bbf73c63", "structural_hash": "58799484fc84a3f7c2449ffbf2fe3e4f5587743f066e29c7a189a7d98f044429", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01995.rs", "upstream_id": "BenchmarkTest01995", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse hex;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = String::from_utf8_lossy(&hex::decode(&user_id).unwrap_or_default()).to_string();\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51f6fe39c64a124ac2743f3266f5092a5ba5841561521c3186586ac8f9d6c221", "structural_hash": "d24b3014d0acab70381a05651b644711b7851efd9bc54124cf9a9b9791df8782", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02579.sh", "upstream_id": "BenchmarkTest02579", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n curl -sk \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "774ecc7add0d02d073e511626cd8f000be70d668bb5dbe20f9759a18ac7d49e8", "structural_hash": "028b459ee97a27f8eca158af40232c15421099a32b21c97030fcd8f0bbed277c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36292.go", "upstream_id": "BenchmarkTest36292", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tpending := strings.Split(hostValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tsalt := make([]byte, 16)\n\trand.Read(salt)\n\tsum := sha256.Sum256(append(salt, []byte(data)...))\n\thashStr := fmt.Sprintf(\"%x:%x\", salt, sum)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15fe1b13131690a3fc4c8588f58017fb7ac88bd3b75c8e2fe68977f38d32475c", "structural_hash": "fe204d93fcea4db33cc10276104f5f54993508c96b14e1baaf83a18a4839d915", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03481.php", "upstream_id": "BenchmarkTest03481", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n $host = parse_url($data, PHP_URL_HOST) ?: '';\n if (!in_array($host, ['api.corp.lan', 'cdn.shopcdn.io'], true)) { return new JsonResponse(['error' => 'forbidden host'], 403); }\n $targetUrl = $data;\n return new RedirectResponse($targetUrl);\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "335e00432b0f3795b1098913cf426fd0fcd5756080d84b95176862e8c42449f2", "structural_hash": "9bafc7395f148847e2c869b5f44d0615145709d0c31c466e78741abd5c507eb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27260.go", "upstream_id": "BenchmarkTest27260", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tholder := InputCarrier{UserInput: multipartValue}\n\tdata := holder.UserInput\n\t_handlers := map[string]func(){\"primary\": func() {\n\t\tpluginPath := filepath.Join(data, \"report_renderer.so\")\n\t\tcontent, err := os.ReadFile(pluginPath)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\tw.Write(content)\n\t}}\n\t_handlers[\"primary\"]()\n}", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cb3a2fd6363a3c2887ce6f5c310c26928e1ba78869de979fc57e1255e40cdc5", "structural_hash": "fc03218a0a92a082c7ebf2446f465ae878ef4a3bc246c459a947422d1ab90ccc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01200.cpp", "upstream_id": "BenchmarkTest01200", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + data + \"\\\"}\", \"application/json\");\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1941c6a1f6a775298ac4e070041d7728d57c14372e705f4e2b6ae8f730afa08b", "structural_hash": "4f7df84d11ead280a05752b93ca0107e9be9c6468ceb1d7a7b0c4efb37603e05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05224.php", "upstream_id": "BenchmarkTest05224", "language": "php", "code": "userInput = $userInput;\n $data = $ctx->userInput;\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f5d6c8bba3db919e59d811880db0bf30b38c0078136ec8302b058b14123576e", "structural_hash": "bbadd926de9647cd40a491aed337642340394c6a7f1a1d70be887fc5ca98840e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05255.rb", "upstream_id": "BenchmarkTest05255", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55867f89b36f065ae08fce5a2466a3076d5c15c06bd0ad58b81a4413c9c19196", "structural_hash": "33b590df8791625b595e40b9beaa00c0195107e7fdde7a2f4a691c8abc2afd7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00761.ts", "upstream_id": "BenchmarkTest00761", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as jsYaml from \"js-yaml\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n if (process.env.NODE_ENV !== \"test\") {\n jsYaml.load(data);\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fe8cc37af3f1aad0e29e946067b89915a966303feb399ed00a05a242ea9e134", "structural_hash": "9cc1c6b29e08ce76969474a544c3f31af92c46d4af98e9a6cca81079c94e67f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_29580.js", "upstream_id": "BenchmarkTest29580", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n fs.appendFileSync(\"report.csv\", data + \",ok\\n\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd827532a3561632a104fac72fc1d802828a119948c0afed7a17deda18c4e97b", "structural_hash": "b4019dfe8f572530162d0aa848d54a64aefa7d36cf7cb889eadcb2931a4ebb8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_26661.go", "upstream_id": "BenchmarkTest26661", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := BenchSvcPassthrough(authHeader)\n\tpassword := data\n\tif len(password) >= 4 {\n\t\tDB.Exec(\"UPDATE users SET password = ? WHERE id = 1\", password)\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-521"], "category": "weak_password_req", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5be10462486ea5b19e13fa9b466eb6461e04c029ad30a0de28631948d6b0de58", "structural_hash": "d75351a1fe5f24ca99bd4d3ceab1c072fb990213d5ffd7c4664e00119af5d4f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05120.sh", "upstream_id": "BenchmarkTest05120", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n curl -s http://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1282bd7c6532734620f2e6a7e6c25ef621556de3beeb1f4ce5303b58c83fcc11", "structural_hash": "d4dd3b851006212422a1266dc4ca253e0a96268101413da89d955f196a210724", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26843.js", "upstream_id": "BenchmarkTest26843", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n if (!authzCheck(req.session && req.session.user, \"admin\")) { res.status(403).json({error: \"forbidden\"}); return; }\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-286"], "category": "incorrect_user_mgmt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f40f2bce4785acbaa8d66b49800f451be771ff57d238e2b00b8dfb634756f470", "structural_hash": "29f6c9b127aad2956cad72d41b6031830033c13c83395a9455d81eac34afbba2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32105.sh", "upstream_id": "BenchmarkTest32105", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"audit actor=$data action=session_revoke result=ok\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13572ad6afe33d5efbaa27c0f1ce3c175db38c2df4210e8567694b56477b75cf", "structural_hash": "04ab522d29029de60b515c20c512cc1175acb40bb43b175db7e378bba42a8292", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00644.sh", "upstream_id": "BenchmarkTest00644", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n data=$(printf \"%s\" \"$user_input\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n tar -czf /tmp/archive.tgz $processed\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c531543e215a269c5f1615e8bc5ba98fb237305d36c300864e5fdf3633c54434", "structural_hash": "a5811387039454d8b3a4e0aed340a780be2025af748816bc6b63dd0fdda82a91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01955.rs", "upstream_id": "BenchmarkTest01955", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"secret\", \"p4ssw0rd_test_xyz\")]); m.get(\"secret\").copied().unwrap_or_default().to_string() };\n let data = if secret_value.len() <= 4096 { secret_value.clone() } else { secret_value.chars().take(4096).collect() };\n let _ct = crate::shared::encrypt_with_key(&data, \"sensitive-data\");\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b84563e34fcadff934c8d06e5e4ed5776d5857add5f283c26977fdc8fb856a9", "structural_hash": "6776e2520eddd3db482f9257f38d793ce75e8bea3d022c0857276e80f9f39c2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05026.php", "upstream_id": "BenchmarkTest05026", "language": "php", "code": "headers->get('Origin', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return new JsonResponse(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n eval((string)$parsedBool);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "611b9f9a1a1f225223968cc1f408e3aa610bc027e1465440cb2958e75b8fb16a", "structural_hash": "4acceae4a7e96a5ef658f08acf289be6b091f13e41c6ddc9ef85879a7e56a48b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25474.sh", "upstream_id": "BenchmarkTest25474", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n trusted_claim=\"$processed\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c219aee46a7d38206d85d860a82250da9c54ecdac3cdec76083f8cc0f4852328", "structural_hash": "138e1b2c5257266662ad42a1c1411206e34f2c564535341b58a86a94980e1c5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05099.rb", "upstream_id": "BenchmarkTest05099", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22cf6ab5eb26f6cc510ccf9ab930b26d274db89c8162cf23749245fefd08b35b", "structural_hash": "79100f0ee1f602019e08b5d1ba67916b9889fb21e8098dd23aa8f0a01dc35ea0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14217.sh", "upstream_id": "BenchmarkTest14217", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n exec 9>/tmp/app.lock\n flock 9\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7027c5a4aec6e6823329bb859d646d98839496140add9db004c5d08f4cc5e52d", "structural_hash": "15f6f5a8564df982b93ffb5cc3d74d4abbde33fb512803cb49dd87759428d91f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_06082.php", "upstream_id": "BenchmarkTest06082", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n register_shutdown_function(function() use ($data) {\n eval((string)$data);\n });\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c360634c9d8d0e437662a94251e8d0b66417f10ded6be5d0228c7ac2ecea53c", "structural_hash": "aad89f9d1c5600e70ab992fc149ac0559b46bc52c9d2e1053674084c4706b527", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00458.php", "upstream_id": "BenchmarkTest00458", "language": "php", "code": "input('field', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!hash_equals((string) session('csrf_token', ''), (string)($request->header('X-CSRF-Token', '')))) { abort(403, 'csrf mismatch'); }\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30e68bb7e936a1c2a1faf07b8fb541dfe3ecfe683611f9509e653df1c39c1a35", "structural_hash": "843b5c0171a2b3324d37785337378c0a5b073a0b366537a20afbda7821b920a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08866.sh", "upstream_id": "BenchmarkTest08866", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n chown \"$user_input\" /var/app/data/managed.txt || { echo \"chown failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e4bdcc8ddd8de17df2c96deaa7b9137414728c55757d632d1c5ae7da7085375", "structural_hash": "b6215afab910c7c1b0a92c9d5e420330592f44da0a40693d7c06cbf306d56535", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01169.rs", "upstream_id": "BenchmarkTest01169", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let mut data = String::new();\n data.push_str(&upload_name);\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7e0b8da8c540464f5503e031daba7fe310ddad1fef1c0ca82b5c126495a30ab", "structural_hash": "b3daea6f71540059b931f58f242c524e2244c0474d3f21297cf223e3188e6d22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05676.ts", "upstream_id": "BenchmarkTest05676", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n res.set(\"Access-Control-Allow-Origin\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8addcd23b26dc6193a7ef9b6af50c92a62cc86ad3e3de2064c0db07e34cdf63", "structural_hash": "48accbfc916859c818d0acb063ff82e1bc2fe5761a6a4db55cf78fef019fa7f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12457.c", "upstream_id": "BenchmarkTest12457", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19159bf76a1e80b8bf0c0092740747e556869ce157427515162d7cd8c34df437", "structural_hash": "54acef967ca6a820c9e65942449f145a405ecd75c355c766220277055313e1c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02814.py", "upstream_id": "BenchmarkTest02814", "language": "python", "code": "import os\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = f'{db_value!s}'\n allowed_ext = ('.jpg', '.png', '.gif', '.pdf')\n if not data.lower().endswith(allowed_ext):\n return jsonify({'error': 'invalid file type'}), 400\n entry_file = os.path.basename(data)\n with open('/var/uploads/' + str(entry_file), 'wb') as fh:\n fh.write(b'data')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65e047844c6821e1e3e1b23cc4385d3bbe33fca973ed303f6e4521f8f826b0b8", "structural_hash": "bda62bbc2323b571987e4b14375bee66c3a3e0f8abfcabb5837ac17c80fe4db4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00593.py", "upstream_id": "BenchmarkTest00593", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nimport re\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n kind = 'json' if str(ua_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(ua_value).strip()\n case _:\n data = str(ua_value)\n processed = re.sub(r'[A-Za-z0-9]{4,}', '****', str(data).replace('\\r', '').replace('\\n', ''))\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7f9d9dc87c64005d854fda5ca8652a87e56d22e39756d0a38782f77ed0d94f8", "structural_hash": "c4df74fa618d4c278e707e9b01305085e9447232266f26a43c241c1f70437242", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24022.js", "upstream_id": "BenchmarkTest24022", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n await new Promise((resolve) => {\n libxmljs.parseXml(data);\n resolve();\n });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-776"], "category": "xml_entity_expansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e56f9d41fabf3a923cc45f052abee75f9f00c72a8c9a6ae98681890c12214b29", "structural_hash": "8b3039eaa7df9ce87c8bb1b41c1748e9893bdd0278d973280f54651b0f913bbd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02454.cpp", "upstream_id": "BenchmarkTest02454", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f43d893af9dafd31de965538e9768175766abdc766e6bb148fa489161f2a0b75", "structural_hash": "e4ee11a9ed191c681f6d77ad8ad00a8f2b5c1ddcb675729fe2134d4707ed6c84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04089.py", "upstream_id": "BenchmarkTest04089", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nfrom types import SimpleNamespace\ndef benchmark_case(request):\n secret_value = ['s3cr3t_key_test_xyz'][0]\n ns = SimpleNamespace(payload=secret_value)\n data = getattr(ns, 'payload')\n processed = data[:64]\n Fernet(processed.encode() if isinstance(processed, str) else processed).encrypt(b'data')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63843b90f03feb90e2ae849d0dcd4e3e196d19c55c95fc82eace133f72991090", "structural_hash": "1701af62273fcd84bd227474c171da59da197d4f46b9c7d3256e4a4c838dfe43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05115.go", "upstream_id": "BenchmarkTest05115", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tcapture := func() string { return refererValue }\n\tdata := capture()\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tactualHash := fmt.Sprintf(\"%x\", sha256.Sum256(body))\n\texpectedHash := os.Getenv(\"TRUSTED_FEED_SHA256\")\n\tif actualHash != expectedHash {\n\t\tc.String(http.StatusBadGateway, \"integrity check failed\")\n\t\treturn\n\t}\n\tDB.Exec(\"INSERT INTO feed (data) VALUES (?)\", string(body))\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd9c938da9d66b147a0b3cf03e6358c484a063a2e7965f631755444c6e57bde1", "structural_hash": "ee0d5d592501d7f448279b4e777a5c450ab4a2c095b731880e5c0f8a65bc5f63", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00804.py", "upstream_id": "BenchmarkTest00804", "language": "python", "code": "from fastapi import FastAPI, Request\nimport json\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n graphql_var = json.loads((await request.body()).decode()).get('variables', {}).get('input', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(graphql_var)\n data = collected\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d2f51d3bd923bfc1ca61798c4739fe084c86dfd8718762e5c95bdd33c87cc79", "structural_hash": "cbd0824492ec942d06abb5c52964f2cd53ec6423b0477139e73a3d0129346174", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03010.rs", "upstream_id": "BenchmarkTest03010", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = { let m = std::collections::HashMap::from([(\"secret\", \"p4ssw0rd_test_xyz\")]); m.get(\"secret\").copied().unwrap_or_default().to_string() };\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = secret_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n let _ct = crate::shared::encrypt_with_key(&data, \"sensitive-data\");\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6219e59098052a8cfd6c8f94855ea9b2eef199f8d9ee4be18831a7acfb37314", "structural_hash": "5d5040630607bc2da3547868790b736a3871d70c3e6762061d848d61df37fe9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12294.go", "upstream_id": "BenchmarkTest12294", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tdata := strings.Join(strings.Fields(xmlBody), \" \")\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tw.Write(body)\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3608549b1cd9351ac41f837d9c81b1abbab6e1def4b3d7f42f7b8b8cb77824a2", "structural_hash": "23f1b2796453b26f9226161c072486f6f8779de6b4b5b12b778cc9018dc09320", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01788.php", "upstream_id": "BenchmarkTest01788", "language": "php", "code": "header('Host', '');\n $data = vsprintf('%1$s', [$userInput]);\n return response()->json(['ok' => 1])->header('Access-Control-Allow-Origin', (string)$data);\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9bf1d4aae5108fa5aed10bdcced67c42dd1e8207e78634fd522dc35e1adf1e0", "structural_hash": "f0206fc3bb7955805c6c237b71c056013023a408def3a62cfe7b1b50671a1278", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04848.py", "upstream_id": "BenchmarkTest04848", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data, _sep, _rest = str(field_value).partition('\\x00')\n size = min(int(data) if str(data).isdigit() else 0, 1024)\n buffer = bytearray(size)\n return JsonResponse({'allocated': len(buffer)}, status=200)", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f820ba93cfade223c536a72be7fd9e30ebd0d307d0e3e10ac6c3127e7c95d4e9", "structural_hash": "403547e0c78f239b4b45341da8eef2229e2021a60acc6ac755235263521acda6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16275.c", "upstream_id": "BenchmarkTest16275", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n printf(\"%s\\n\", _p);\n}", "label": 0, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c48c6942fedcb22e8600a47b7598aaaf160315b8c2e54dcfe96ddbebbeb56ef0", "structural_hash": "3c8890e2a50206803ed73364c8edfdbd4c70bd1ac973ff23b15c23a6d9f3471b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01945.java", "upstream_id": "BenchmarkTest01945", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data;\n if (rawData.length() > 256) { data = rawData.substring(0, 256); }\n else { data = rawData; }\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n return Response.ok(\"{\\\"auth\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a261bd6560e93c70389d14caecf953578970fb8f57d65b06d9fecff8c199273e", "structural_hash": "7a4f54e48475520d96de0ab6d10058715dc9d920d777cd8ac5e401009ec40931", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00633.sh", "upstream_id": "BenchmarkTest00633", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n mongosh --eval \"db.users.find({name: '$processed'})\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebb0a18b30fda4031854ffe04a8536e5ccf4395732f91c5730e7eb11c819c1af", "structural_hash": "442a07596012519f7d7fa664aebe87f7c061e84f7232683e2401e09a2986afbb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01933.cpp", "upstream_id": "BenchmarkTest01933", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n std::string _fname = std::filesystem::path(data).filename().string();\n if (_fname.size() < 4 || (_fname.substr(_fname.size() - 4) != \".png\" && _fname.substr(_fname.size() - 4) != \".jpg\")) return;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16b2c66921d33f6322981fdaa04c844451dc7f53ed98faf4a4d01d14302b2833", "structural_hash": "35ea078821ce5e7e2ed7c6b5496d862d7498133ff9a3a7a5f38d08563befa9df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27846.go", "upstream_id": "BenchmarkTest27846", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/tls\"\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := strings.Join(strings.Fields(graphqlVar), \" \")\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\tresp, err := client.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tw.Write(body)\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce954c6c89b3415f5efdf3919baa8104711dc865cb6ce0e8ca4fbaab22022958", "structural_hash": "ae41b554d183bebea9028a6a2d9c96b0c96e0cef491deadaf63a4f4ed77f6482", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11484.js", "upstream_id": "BenchmarkTest11484", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const data = await Promise.resolve(userInput);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-256"], "category": "unprotected_cred_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a96fc403c2af5adc77df964164730517bc8e0111f34e60e7a86b3591d943836", "structural_hash": "65766a5a337297b09d705d89dab9c240f3b0e0308bd2b8a72eabaf83d9477bc5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41506.js", "upstream_id": "BenchmarkTest41506", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n try { JSON.parse(data); } catch(e) { }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db6a3eecb26871a8f12caf59ac676835706ceee9eceedb2d5ff17033fd205d1c", "structural_hash": "8d39672d96fb5c4b5bbe1f8cabdcef5858c1eac759e98360d803b5f8f6a4dd43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00710.rb", "upstream_id": "BenchmarkTest00710", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n render html: (ERB.new(data.to_s).result).html_safe\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3597e974bae53401b7ec149d0586bee9973f1ef8a0bd386d777668ba95eb9bca", "structural_hash": "ea8f101c5ba1a59e904dae5f59d155bfda9f3ea654cf8b270df05cb7d8a029d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01675.sh", "upstream_id": "BenchmarkTest01675", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cb008058ed767da188b1af71145b4a229059299752b2cd9977fe9bd8f567d05", "structural_hash": "4fdbdcc0409b1c36b87828212623dc099c6d6968bde3cf459216e0d668a52f02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03531.java", "upstream_id": "BenchmarkTest03531", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n java.util.List tokens = java.util.Arrays.asList(cookieValue.split(\",\"));\n String data = String.join(\",\", tokens);\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { return Response.status(502).build(); }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ccc483a55a5f14a4fe2b57e963ed8e37c9de7a482ffdd5163a4edbd497e7803", "structural_hash": "00706d5eac0c98b20ab94649439713e12ef52667123c34da936f3834a0cbca93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_15105.go", "upstream_id": "BenchmarkTest15105", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n\t\"go.mongodb.org/mongo-driver/bson\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(refererValue)\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tvar mongoFilter bson.M\n\tjson.Unmarshal([]byte(processed), &mongoFilter)\n\tmongoClient.Database(\"benchmark\").Collection(\"users\").FindOne(context.Background(), mongoFilter)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7697ccb1037325826c30f787aeb4d96deb8616570a468c6c6065155fe555360b", "structural_hash": "30c80ae6a2673b775dae87beec76e33b48ccbc2677453aa25ab4bb27bdc19c97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_41726.js", "upstream_id": "BenchmarkTest41726", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const requested = parseInt(data, 10);\n const wrapped = (requested + 1) | 0;\n const buf = Buffer.alloc(wrapped);\n ctx.body = { allocated: buf.length }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f3ab240902acc300a856a3f833ec8dc4dc65a24f39a60db5a951888274c860c", "structural_hash": "8a009c1dbebeb982494b381e6be7b6a553887be00a20fb08bdb1454bb848ead2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05606.ts", "upstream_id": "BenchmarkTest05606", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = ua || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const requested = parseInt(data, 10);\n const wrapped = (requested + 1) | 0;\n const buf = Buffer.alloc(wrapped);\n res.json({ allocated: buf.length }); return;\n }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b95fe209be198f6255ec7d7700fb628295a0f57f05b942928e3fc4d598219d19", "structural_hash": "03d788d4bbf16cbd57da4140fe67ff4e12d38abd43663665e101bf42ea80a283", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01534.php", "upstream_id": "BenchmarkTest01534", "language": "php", "code": "headers->get('Referer', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b538a00d00b996d0f81319ae2cfb42cf41a5b92fd26db053c6f45e7f5b9b5b37", "structural_hash": "c224b1703d701bce3c6dd23127c3270bce5596da0691066ad029db241048c685", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22108.js", "upstream_id": "BenchmarkTest22108", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = await Promise.resolve(userInput).then(String);\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c5cbd0d3cd1b7eae3700b332ff6a40f5a51552820d78bb09488c4a09d5ac3ff", "structural_hash": "cecbd292d74e0282867ea90b83b2a8ea5fe5f02e16c6ee64ad836e8fe3d96828", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05334.sh", "upstream_id": "BenchmarkTest05334", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b367651925fa41649b616036bdf7b129a5548e27c0e058394457097589f31620", "structural_hash": "247dbb24501b07b2128ed4391591c3d8069290bfbb267040e8f55eb9e3882e60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07151.sh", "upstream_id": "BenchmarkTest07151", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf \"{\\\"echo\\\":\\\"%s\\\"}\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4dc97c24aa4f9bbd82ec3838609dd718b0547fbe2e7e03d9b8e7e53d8699d16e", "structural_hash": "dc310639b4be7767d04be06e448bbcd4fe91c2b941430ebc99365e5571914afb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01083.cpp", "upstream_id": "BenchmarkTest01083", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n std::string _truncated = data.substr(0, 64);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", _truncated.c_str()); std::fclose(_sf); }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "610a75fe83b21e8758fe5ab3ba510993c8d0bd48d35d875059f3032d17e75fce", "structural_hash": "64e3c61c8059a7faa735e38e81f93dd5320bf48ca11b4494ea981f3cb040133d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03837.java", "upstream_id": "BenchmarkTest03837", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n private enum AllowedValue { INFO, WARN, ERROR, DEBUG }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.List tokens = java.util.Arrays.asList(envValue.split(\",\"));\n String data = String.join(\",\", tokens);\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n LOG.info(\"Action: {}\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1feda66832af2712283a19f59599e78b149e42cc8bbaf84360b5c38e6024bcb3", "structural_hash": "855bcea3101c4e5755ebdd9b601ef94ac11fefe712b3d601c3717b8dd8733cbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02116.py", "upstream_id": "BenchmarkTest02116", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom app_runtime import db\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data, _sep, _rest = str(graphql_var).partition('\\x00')\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n if result is None:\n return JsonResponse({'error': 'not found'}, status=404)\n value = result['name']\n return JsonResponse({'name': str(value)}, status=200)", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b443a9578bbac2319d1b8c618d1e7ed56b5ba848a5ea5caaef0dc35715eeba70", "structural_hash": "e1ddf74925feb70562ffa891713c31daade1cdfaaf8d0be007e6c3f01bbb0288", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08215.sh", "upstream_id": "BenchmarkTest08215", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee303ee6a5bef54bd3bab6c87bc474b05e582bfc5f2906228bad62f218a674d6", "structural_hash": "fad25ddcbb6f8589b5d259700fd553893951af8f0108cb0fbcf606f784c30fc5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26628.sh", "upstream_id": "BenchmarkTest26628", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n printf \"{\\\"echo\\\":\\\"%s\\\"}\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e56252fbf958a7ce8e480f1ac4a1a114dacad13ec1a771c77c99af19d2e5ec2", "structural_hash": "5ee4bcf17b5b9445e91c7a478ac527eaf227ae2f984f79c0d416ccac5343cd9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00609.php", "upstream_id": "BenchmarkTest00609", "language": "php", "code": "query('id', '');\n $data = ($userInput !== null) ? $userInput : '';\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "229f180ff0c425e5f84a91e7fa4f78f519261e839cd0b73654f7bd559eddc49f", "structural_hash": "18bfffb154466fefab91890e85d07033c68069b0ab35acb4966758f7e1575a9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41815.js", "upstream_id": "BenchmarkTest41815", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.APP_PROP || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n authCheck(\"admin\", String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc986a70d5e5ee4ab082115b0469795d8824a63dd70b6906a587831de5ee96ee", "structural_hash": "032fd41e9625a68e44c0c3bfe4faa0bc70701ed1750d0b083b40484ce92907e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03706.ts", "upstream_id": "BenchmarkTest03706", "language": "typescript", "code": "import { Controller, Post, Redirect, UploadedFile, UseInterceptors } from \"@nestjs/common\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n @Redirect()\n async benchmark_case(@UploadedFile() file: Express.Multer.File): Promise {\n const userInput = file?.originalname || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n return { url: data };\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44c2cc70d90d4efdbae31f2bd6bab9f3a222d3a5291417fa0492884c5f860fd1", "structural_hash": "741d794f1da843bde8de45b2fc7ef0b01c373b74b1b85992e126cf18f27ccdaa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16253.c", "upstream_id": "BenchmarkTest16253", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_PADDING);\n RSA_free(_rsa);\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29cb51bbc6fd1fabb654bf16c216fc2643a8044f533edcae4c808139e103feb5", "structural_hash": "0af96831918221134331ce3203eab10c7e8dcb8db1f1856554bca119eb118ce9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00438.ts", "upstream_id": "BenchmarkTest00438", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c35603e0d357cd4096a8b0719f0621bd4ae375744fcd88b23b9c2d4760b8cac", "structural_hash": "9267c89dc312ecabd2165225fc04430a1631271def65d75557229d0ef0b12cdc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01070.js", "upstream_id": "BenchmarkTest01070", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90c88eea57de60175607d019151d5b865f13d148749466fbe646007edbceffed", "structural_hash": "e1be66dd7745cc4b2b83f9dfd009b3e9a147b8235f4a8c94d64a0144f406444a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01846.cpp", "upstream_id": "BenchmarkTest01846", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n const char *_sess = std::getenv(\"SESSION_SECRET\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e832afdcfbf6186d04e258b11896a8fbf4c0fb428f57e87443df7220e10ff452", "structural_hash": "c6671e591083e6625c3d26c0aa68358b78841041194ebeeec84610de9f670265", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02496.rs", "upstream_id": "BenchmarkTest02496", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse urlencoding;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = urlencoding::decode(&referer_value).unwrap_or_default().to_string();\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return (StatusCode::NOT_FOUND, \"\").into_response() };\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f3c1ff7cab1cf97aac961f7d1c5a5b0896347494fc24eabd0d1b30102ea3509", "structural_hash": "9378d0e2fd462115c70ca770801ff793e35b9e7228d1458137229cd128a8a160", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04101.php", "upstream_id": "BenchmarkTest04101", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $actions = ['asc' => 'sort_asc', 'desc' => 'sort_desc', 'name' => 'by_name', 'created' => 'by_date'];\n $result = $actions[(string)$processed] ?? 'noop';\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66a96a12c5a6b52ccee86b1a331f1bd3ec87b4b072d7acba834354572458f598", "structural_hash": "a3ba720170681189f92050e4f8025aca298c0d92faa3bf108cceb08b9b9f46bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02568.js", "upstream_id": "BenchmarkTest02568", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(nunjucks.renderString(processed, {}));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94f0317e87210942e138528678f3b49baf1b9c9e331db42d6ee0f7ad15d3f62b", "structural_hash": "19ab75f4d787dfa618c1f3f29b886a51dcdf554e1bb17321984283ef3e995d7c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00098.rs", "upstream_id": "BenchmarkTest00098", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse url::Url;\nuse urlencoding;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n let data = urlencoding::decode(&multipart_value).unwrap_or_default().to_string();\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n let host = parsed.host_str().unwrap_or(\"\").to_string();\n let _meta_mapped = match parsed.host() {\n Some(url::Host::Ipv6(v6)) => v6.to_ipv4_mapped().is_some_and(|v4| v4.octets()[0] == 169 && v4.octets()[1] == 254),\n _ => false,\n };\n if _meta_mapped || host.starts_with(\"169.254.\") || host == \"metadata.google.internal\" || host == \"metadata\" { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n let target_url = data.clone();\n reqwest::get(&target_url).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4863bbdde56b805dd1823ae4f644a206d559554dc76e1de857e075f1e3319f1d", "structural_hash": "95f2a12fb01e6cdd38f91768780634d5e053302eed8070e03f988dcc0307d708", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01013.rs", "upstream_id": "BenchmarkTest01013", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let mut data = String::new();\n for token in xml_value.split(',') { data = token.to_string(); }\n crate::shared::auth_check(\"user\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5dd122574616fc3e0b50bd257d171f30cc89c59954a68654c81bbe37e20f5803", "structural_hash": "d5aa0866d425b1d1987b8acfb5e5caa18cc397071338ed8e4387b62359b8cd5e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28892.js", "upstream_id": "BenchmarkTest28892", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = passthrough(userInput);\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/uploads/data.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "566bcc6eae1ae6e2e21cf5469fad462aee9b8776d290ec6ac7558661b6ddf23c", "structural_hash": "3e41f04c12d8648db4e0e2feaa471ae166ed8a5e3f3d520651b00b5f3ad9f156", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04276.java", "upstream_id": "BenchmarkTest04276", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n String data = String.join(\" \", envValue.split(\"[ \\\\t]+\"));\n jakarta.servlet.http.HttpSession fixedSession = request.getSession();\n fixedSession.setAttribute(\"authenticatedUser\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2b5477cb0deb9eee5b05ec5b3a2b6e2577ba5939f19cd242f1ae910e8940113", "structural_hash": "c44c7cc06e91d7b70f019ddf9f6be2caa62ef4d806b698f754c0a1354bd9bacb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15434.sh", "upstream_id": "BenchmarkTest15434", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n mysql -e \"SELECT * FROM users WHERE id = '$data'\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0a26993241f54078f392c0ce289c2c8b7004823f010d86f54178b5cd85b2aa2", "structural_hash": "8e7aa76dd51ac57d20df55132001b6c62c8cb6f64c4d5e8c7ba37edc39c5d1a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04881.ts", "upstream_id": "BenchmarkTest04881", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = \"\" + userInput;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(nunjucks.renderString(processed, {}));\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b553d27ccbfca3687a04157759ebddbe05030a04f3ba5c54bb9c22ff05e35386", "structural_hash": "37fb64428f104a04d9177a7ac80e8c6812062e721cbd84a20c88afb842a5c597", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05266.php", "upstream_id": "BenchmarkTest05266", "language": "php", "code": "executeQuery('SELECT * FROM users WHERE id = ?', [$data]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd9a76fc4f6211fe10d71fb9682699648def8880cdb6883f6a2658a10e1c3e77", "structural_hash": "96694a9ed82269d34d2d4471952bfe40676c75bf147cc0e0d04b57f1bded6bc6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02188.rb", "upstream_id": "BenchmarkTest02188", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n redirect_to data\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3afc88166341082d16d1d42b680f8576daf0e6c13878cc82b1b38491eb34431", "structural_hash": "e93f538f6c015e445eda91834a74f89f3f2fb8c5cdacd7eac0248c23cf2786a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00589.cpp", "upstream_id": "BenchmarkTest00589", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c9a1e4ca78624987209377901524aba6f9394938c5fb8d972781406b0ee46e7", "structural_hash": "9a0bd5d7d014eb1fbb6a738acaeeb326cc3e8657f5111505017729c830df283b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04615.rb", "upstream_id": "BenchmarkTest04615", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = format('%s', user_input)\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7346a19ed605a8ea619847981db3928ddc153cb95435a891cd7b563303b0cc9", "structural_hash": "42be8688b384f6a2c2267f3d11fd3c711024c4174b3fc76d292d73615d48ee75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13067.c", "upstream_id": "BenchmarkTest13067", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n const char *safe = data;\n if (strcmp(data, \"/bin/echo\") != 0 && strcmp(data, \"/bin/cat\") != 0) safe = \"/bin/echo\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"%s\", safe);\n execl(\"/bin/sh\", \"sh\", \"-c\", _cmd, (char *)NULL);\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56618ada217831df148b73d26c9c278ad073db6b92879a5afbcf86afe6abfd06", "structural_hash": "379f364d47b1213785b1dff182512f45f1e5dc6b84e4a5ac9321d33d171e9096", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21338.c", "upstream_id": "BenchmarkTest21338", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n free(_p);\n}", "label": 1, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "462fdaf98fef0315dad81e0bb8e454ac765bdcbb2bd0e20d2e0540634d5db9bc", "structural_hash": "15378ec00c0be810dbb0bbe4da04b6ec37cfc05b25c05a7be45e250e2f59caa5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05180.sh", "upstream_id": "BenchmarkTest05180", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n echo \"data\" > \"/var/uploads/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1cc9629bc2bab3306c8dcc7534525bd15bd29bf5788ca3ab32bb3bd3fbcc40b", "structural_hash": "8311562826488667edbeea69ce4bd24d7f1fe766d0d77e2bb9c8948385ab753b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05830.ts", "upstream_id": "BenchmarkTest05830", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n db.collection(\"users\").findOne({ name: String(processed) });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea2639df6c4f5f1015e41f7e5083cc12aea825ba94d49ecfdd3e1be704d71c26", "structural_hash": "c939ce8be09e87ba9a34d82ffd5092ab5df168685f863f9977f4158479977440", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19785.c", "upstream_id": "BenchmarkTest19785", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_OAEP_PADDING);\n RSA_free(_rsa);\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "545397991da89e1af1ecb7a58905a6f79b0efa3c6ccbf6980954d6058fc0e4a9", "structural_hash": "94d446cbb218fa7cad8157cff2bca9b53472401ab85fbf1e5ac7b5d4d8ed7d67", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03005.rs", "upstream_id": "BenchmarkTest03005", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let (payload, _origin) = (cookie_value.clone(), \"http\");\n let data = payload;\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2962751ff4acec971e7d411d5eea1453b8fe73d0bb67c0f88d8332376229069", "structural_hash": "0c07b554fec1d4c62d9a25b189f0fdf303045f2d61c9505be3a9677d56534a3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02938.sh", "upstream_id": "BenchmarkTest02938", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bcb838123b2385ef31c1ea2678bfd95f0b34621576fd6907d0df45a89774ba8c", "structural_hash": "a527f138cd3bfabf444097229bf483cef53ee1750698d08fba29e584c4327b33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02212.cpp", "upstream_id": "BenchmarkTest02212", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48871501cdc40dc1d8bf3d63838bd97b2047960d3073f8924e7106bc2d284eeb", "structural_hash": "cdcebfce5cf2167d57216c796c989b3944c96dc0dc952903cb6f817f8924fd66", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03431.py", "upstream_id": "BenchmarkTest03431", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nimport os\ndef benchmark_case(request):\n env_value = os.environ.get('USER_INPUT', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(env_value)\n data = collected\n digest = hashlib.md5(str(data).encode()).hexdigest()\n return JsonResponse({'digest': str(digest)}, status=200)", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35290b30d6df88200c7c87e08946b307bd7d5c2001f162fdd945f6edce13c85f", "structural_hash": "ebe9a0ac6660341d8b015359c5507e5ffe4ce0c43402dd313d427fdf59739fef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03782.ts", "upstream_id": "BenchmarkTest03782", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const data = \"\" + userInput;\n const salt = crypto.randomBytes(16);\n crypto.pbkdf2Sync(String(data), salt, 100000, 64, \"sha512\").toString(\"hex\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "356842c706f17b02c65950c2fa5f34b0e065c708c2eb73b0f743fa08a59c27c6", "structural_hash": "9d989b76f26fff221a749156caed22268687b380f56ae20df6b6f6073e6d739f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01340.ts", "upstream_id": "BenchmarkTest01340", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const data = await Promise.resolve(userInput);\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bab921a7d9323b495db03d220e400115e5a173516d6873ecf2998ef627028198", "structural_hash": "341be884399e1d74d87e6fda3adea36b069ec9e57b0526aae4c6688d36256e8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01761.rb", "upstream_id": "BenchmarkTest01761", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8bff681ae0a60a6fcc11355fee0c716299eb37270feb1e2074a3b68b96941d0", "structural_hash": "1255f4931297f9d9c3867cdd6e3a6b472fc8ab8369a9647fcb2b7b6a14a76955", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_31347.js", "upstream_id": "BenchmarkTest31347", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d655f42773859d2ff65535a4cb41f6b0f56ed1659b78d9e408c51177d6810304", "structural_hash": "40e8d22d8bfe517ae6346cae0378c33efee5b4a534f18dd46e37da6af207ac09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01796.rb", "upstream_id": "BenchmarkTest01796", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"mongo\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n Mongo::Client.new([\"localhost:27017\"])[:users].find(name: {\"$regex\" => processed}).first\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0633c6ed1aadebe5996e3375c44581e38c22e11ea3eb936c1d56bbc42d5347b", "structural_hash": "91705afd644d3200232f7b156cd9d548c498b73737affed635cdafc7ea4875a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20994.sh", "upstream_id": "BenchmarkTest20994", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n normalized=$(echo \"$processed\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$processed\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "341f23cf712aa3b98f0a5963f3f87e89be1cf4274fea170109c387821ac45cd0", "structural_hash": "28da5d7c42d508a4b841c556d8a5858ee4ecd95c33b5dfcb768f5f47ba9f232e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05562.rs", "upstream_id": "BenchmarkTest05562", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data: String = field_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| field_value.clone());\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58773b5971a669ead244a132bf24f964197cfa4da80b053ab63fbb83e5bd35f6", "structural_hash": "3c121a61d7c4441260aa9e921ecb71cbf56c01eaaf9ac5c91f252f50bddcbda7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01457.php", "upstream_id": "BenchmarkTest01457", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n register_shutdown_function(function() use ($data) {\n file_get_contents((string)$data);\n });\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96ba2a8b801cad7cb58253581ee9a5d1c1f7660b943329a52684f9f8b221e86f", "structural_hash": "5651f909d521e6f1bc51ba3381e7749231e57f4e590ae5e1ce471ce3172a68a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14179.sh", "upstream_id": "BenchmarkTest14179", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n printf -v data \"%s\" \"${user_input}\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n result=$((100 / $data))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "248494bd46e9c529dd9a08be3c9606f0ee4117b40d2325d0f75a9a6784f7cdeb", "structural_hash": "4fc6ea0bff28c17c7f0dda1b5ae0740b7a292f9d2dc79ad2023fea0502e5a4d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12444.js", "upstream_id": "BenchmarkTest12444", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-922"], "category": "insecure_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bfb5b1a7b95d2c04d4acea7aa6d08a1f61093b3fb9cfe951328606f8f59c489", "structural_hash": "00d50886cc0cb1b0866c1393d96be8c67281aae810ea473b0a8240cce9b9dc4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36405.js", "upstream_id": "BenchmarkTest36405", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63209232cf20cfe064977e1a10016cd22b321fa0317d8706c7394e0989b91b1a", "structural_hash": "0984edad478b09b214634d484a290a50482d1ee1b4916ecb65e6edd26ea7320d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04195.py", "upstream_id": "BenchmarkTest04195", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n pending = list(str(xml_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n size = min(int(data) if str(data).isdigit() else 0, 1024)\n buffer = bytearray(size)\n return JsonResponse({'allocated': len(buffer)}, status=200)", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cf235af3d0c55dd0d1aabbc2afdfe6db9788e94b8cf9b8cf9530382f3818769", "structural_hash": "4477176c4580b5638d8a8320fa919c31d3de1d216d17af81abb082228ef8e168", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01314.rb", "upstream_id": "BenchmarkTest01314", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n payload, _origin = user_input, 'http'\n data = payload\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "068c5ccdf149178d35a70ea43c00b15a4268d03e0c0bff9b7c8d59362fa17889", "structural_hash": "442a8934cf6efe90ebae79ad4a93e5282b6f15ed0be829ef1b29025657372f1e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24709.sh", "upstream_id": "BenchmarkTest24709", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n logger \"Action: $user_input\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4123e44e2fcaf60782f10f4d5d1f0588588d61d9e9bfac3aa118424bb056042a", "structural_hash": "ab063f4679215788b53cea4c63ee9be2caca44c0e8b528a653df11ce99fa0150", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20995.sh", "upstream_id": "BenchmarkTest20995", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\" >&2; exit 1; fi\n requested=$bounded_val\n if [ \"$requested\" -lt 0 ] || [ \"$requested\" -gt 2147483646 ]; then echo \"overflow\" >&2; exit 1; fi\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7417b666755ba21916a9ac84068498f9ebfe11d3d45de27303cd3a8f91f4732", "structural_hash": "4c66f686f68fab705d88edaae3a506851b82d765051ce1bb33aaf6393f9a33ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01092.ts", "upstream_id": "BenchmarkTest01092", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const data = \"\" + userInput;\n const cell = /^[=+\\-@]/.test(String(data)) ? \"'\" + data : data;\n fs.appendFileSync(\"report.csv\", cell + \",ok\\n\");\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6453bba784875be8e091c05b0ad217816b51278d87509d5f8d9c6c3ed52107f", "structural_hash": "73b31a6e18226a960b1afb8fda30babed24207f80e5d84f90eef6ab8ca0d8f34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01254.py", "upstream_id": "BenchmarkTest01254", "language": "python", "code": "from flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n data = path_value if path_value else 'default'\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': origin}\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "06f9e1f1fd3e1905c43e2c27ca2f5852f1c7751e47fc7b3439f252051bc10f2d", "structural_hash": "49c87571e4bab93e5680a357442d0c328d3c24c51f099ec637a7eff1d33f0847", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11690.sh", "upstream_id": "BenchmarkTest11690", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/app.properties)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62fa9138f33624c0a483effb41c30d88937ac817e7b60dedb554ae3841639e2a", "structural_hash": "defc6f8752582f75b677c9eb3ba495413cc9aa7fb71e7d0416d5b65773cfd3a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02712.rb", "upstream_id": "BenchmarkTest02712", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n data = CGI.unescape(user_input)\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n File.write(\"/var/uploads/\" + processed, \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16289e7f982aced989276f604db868f5bee589f1f8e45c3450fa85618f7a59c0", "structural_hash": "5230ac33c7ec90989d76363fcaa8dd16ed04981d699425746615b16a7dcb65e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28641.go", "upstream_id": "BenchmarkTest28641", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tvar data string\n\tif len(originValue) > 0 {\n\t\tdata = originValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+data), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "798c6fb7089ce11b9d4a1ba23b78cb5e89fc3cd408fe71b7973395c6dab43b6d", "structural_hash": "de949a5acfcec329e235680d227757c82ea1a3bd34d165fe141d5678c94b34c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01604.rs", "upstream_id": "BenchmarkTest01604", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = forwarded_ip.replace(\"\\t\", \" \");\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f073fe43540140f1b12070e64cb1660ff7b338dc1e1b7a8f984e3130ebe96de2", "structural_hash": "8c69851f1d633a24da8b05523d90783a22fecc3b27258fdf17d9d4cc8e9f24ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03655.py", "upstream_id": "BenchmarkTest03655", "language": "python", "code": "from fastapi import FastAPI, Request\nimport ldap\nimport re\nfrom starlette.responses import JSONResponse\nfrom types import SimpleNamespace\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n ns = SimpleNamespace(payload=path_value)\n data = getattr(ns, 'payload')\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "643fdbfade6abfdef9ec3502b4f19494128fd68a7eee53b5b7d74e5a1654b34c", "structural_hash": "208b0377413b89edadb8a62c57afbe534ea810b285244dc736813c80800a5b9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03210.ts", "upstream_id": "BenchmarkTest03210", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const data = `${userInput}`;\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n return { listing: entries };\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cecf0e699c71e865edfc2dae961d1978c0930be3a59452806f5e97e89b12c41b", "structural_hash": "3e30247c281f83cd9825e72c7d723a322e9d143b6da38abeceb569b8d4698511", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01771.rb", "upstream_id": "BenchmarkTest01771", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n unless session[:auth_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:auth_token].to_s)\n render json: { error: \"unauthorized\" }, status: 401\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ab1b878e3676137947ae1f5696bdfd2b4a9cfc1f5411674025e90ad255f5d15", "structural_hash": "2f2d7f6a0af23cff6731eaf9d1b742bbcdfeb6169e7454cd07f067af83a3210e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05098.c", "upstream_id": "BenchmarkTest05098", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "478e298a8c62ae02ac1f2e8cda1fd8e05ac16e817c2040f8040360bdf9e2a5a8", "structural_hash": "8f3eb623ba980b01e8108d858ea755435b8678fb5b869cb175acc862fdc904bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04305.rs", "upstream_id": "BenchmarkTest04305", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n for token in json_value.split(',') { data = token.to_string(); }\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96c780c64891a73e3a3107255ffc53f82f18a7d7c82545313104003eaba6fd7c", "structural_hash": "5db094845fa1d166d1699ba9909104a9d3e4c955d89bee0675489fc64a1754b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36191.js", "upstream_id": "BenchmarkTest36191", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n JSON.parse(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "164217efd3e1305d539dd405c11fdde217f69ab9822482bc1e30010ff7e51692", "structural_hash": "ea50b4812dad462217f004f51b1c19bdbdccd0bf0fd74e10d67a974bb292d7e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01503.py", "upstream_id": "BenchmarkTest01503", "language": "python", "code": "from django.http import JsonResponse\nimport json\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n pending = list(str(graphql_var).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ccc66a8f509e860a850b5aeed6048194895c4fb0eabaf97c720fd3165caf5ad", "structural_hash": "41b182aa9e90c039c67d2d35d72b37259fbf041f2bb428a3d515af8f7cc9483a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00954.py", "upstream_id": "BenchmarkTest00954", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n ua_value = request.headers.get('user-agent', '')\n reader = make_reader(ua_value)\n data = reader()\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "229a1fca6f5034ed7dfb40575bb8868d799295e99394971906f7596df13e57f4", "structural_hash": "9acb9e678a554b5b1f1ce334195ac112832bf86b5fcf567e5701eaaa122f124a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19433.js", "upstream_id": "BenchmarkTest19433", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-337"], "category": "predictable_prng_seed", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a945eb730f7ee1756ad4183d0534323e95e412dfeda9476e9b883909c9c67216", "structural_hash": "442dfb0735a4a7e76b1e7dbb3dd880a7ce79771575c1149710a6e9b77a4f714d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02121.rb", "upstream_id": "BenchmarkTest02121", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5285d75d3cf02612792ad3eaf9e941fe655116a93123346b72f33fa05f683620", "structural_hash": "324d443179c136a4630eec089ae9fab085f83cb158cdd4d4dbe50ab97d61f0fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23074.sh", "upstream_id": "BenchmarkTest23074", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n _seed=$(printf \"%s\" \"$user_input\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd6935d01d596d4c84df478963edf91cd5a61abcd65074a185d2f8b30885c17d", "structural_hash": "484d0c4bf6533936a190e1830ce7d80be76eb1549ec75b6a7a7487d0ba962276", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01505.ts", "upstream_id": "BenchmarkTest01505", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data: string = shared.passthrough(userInput);\n if (Date.now() > 1000000000000) {\n res.send(\"
    \" + data + \"
    \");\n }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e891ce825a12ac1ba372ff4af958ae9c1a50ad2a95b41dccbdbe628d3d1f02b", "structural_hash": "1009bd37572ecdb0600e71f8f5e806013e7c2dd61036fba5b9a28bb90552bf61", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00869.ts", "upstream_id": "BenchmarkTest00869", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { res.status(400).json({ error: \"out of range\" }); return; }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e53c7a2f3e2fef61dbe3e38b6960ed9043b0d27fe406e2309990093cf3ad680a", "structural_hash": "e6946e578462894424a6c24d2997997f72b8410c32800d050689a0d4d72008c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05567.rb", "upstream_id": "BenchmarkTest05567", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n response.set_cookie(:session, user_input)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f40b34a7103be6e3ef9dd82458a4d460e7bbfa29474c6d2369c32ce9e329271", "structural_hash": "3ed5c20fd40497d859a2ae3d8994cb69e2b2c74c9a2e30abce6ebf6e2a63f9d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01299.py", "upstream_id": "BenchmarkTest01299", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom types import SimpleNamespace\nimport re\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n ns = SimpleNamespace(payload=origin_value)\n data = getattr(ns, 'payload')\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n if re.search('[a-zA-Z0-9_-]+', str(processed)):\n return jsonify({'validated': str(processed)}), 200\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "180517259ab722c9aef603269abb53630ba51ad5f75fef0f971742299e704a81", "structural_hash": "9886f803b2d46003288236ae7856602086076e6970a0408b37f48d8b8187344f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03808.ts", "upstream_id": "BenchmarkTest03808", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(nunjucks.renderString(processed, {}));\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73bca3e6a2b11150dcd2ed41b114f828a6ea763c98c68f0192f358754ccfb736", "structural_hash": "c60d9285b5ab8a1778caf72b8684796ce0e463932c5003b4e208a14aff8e7efd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_37245.go", "upstream_id": "BenchmarkTest37245", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tholder := InputCarrier{UserInput: forwardedIP}\n\tdata := holder.UserInput\n\tallowed := map[string]bool{\"https://app.gocdn.net\": true}\n\tif allowed[data] {\n\t\tc.Header(\"Access-Control-Allow-Origin\", data)\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-346"], "category": "originvalidation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "918148ecfa79e01c90c5bb8260b4abc99f3dc96f5c895b3fca89f7df03f18a43", "structural_hash": "4433ec3084a297805199c441f431343c9faff76f3d8135b73877e58744e8d925", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02333.ts", "upstream_id": "BenchmarkTest02333", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const data = \"\" + userInput;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a80f320c4cd7c508fae876a666d8036daca82f1db109a60f01a5b927777500c8", "structural_hash": "b5eeda9f70b1af8e7097289027058a5c9a2ff6f7873ef7fd6c39d2471e142a05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05701.py", "upstream_id": "BenchmarkTest05701", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom fastapi import Form\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n parts = str(field_value).split(',')\n data = ','.join(parts)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7dcbb2ba755c135f4c3d4df3f749b9a491e3b0f97475b8974f1730bbee576b1", "structural_hash": "232d75ed483666dd3e17b712da2913816f89893c7cb08fc296618f52c95abe40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03070.php", "upstream_id": "BenchmarkTest03070", "language": "php", "code": " (string)$userInput]);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c4c02b0aeb7c0547af1fbed68d59575de3b1e1486e061280e9e8597b61b66ba", "structural_hash": "df6eb5c31f8bce9892786acf30cd28d7f43dddd16de896329b9ddff885d6f3e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02429.py", "upstream_id": "BenchmarkTest02429", "language": "python", "code": "from django.http import JsonResponse\nimport re\nrequest_state: dict[str, str] = {}\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n request_state['last_input'] = auth_header\n data = request_state['last_input']\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(processed))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95173dccf6af162d079e5cd089f8bfd2102e744082caa59e85de3a797c9f58a9", "structural_hash": "6856c8490b223746f0600b24927bd51c9b6db5901de8056a8f4e54b49cfff302", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04073.rb", "upstream_id": "BenchmarkTest04073", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n result = DB[:users].where(name: data).first\n value = result[:name]\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "499e16a8d43fd44a5693784424d7a8909d082585fad82dfbe7de3704eac19cd5", "structural_hash": "325ab6ff83d79772a7f05733738c4e1582abf03c0b1c71bc98e8588eb2f5854f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01128.java", "upstream_id": "BenchmarkTest01128", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = \"item_%s\".formatted(jsonValue);\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c7478291364aad943cf2ed9ea78b15a7e818be9a9c3f7418b24d35bd1c412a4", "structural_hash": "c22967ac72e7fb7549eaa29a12dca298659b8ee25e2c5f376e1348f35bee3afd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04345.ts", "upstream_id": "BenchmarkTest04345", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1e0ed39868e144d6e98380d8f2dff13631a6d6d9a2d719edbb1b14e9bc4242d", "structural_hash": "d94d0909832b299f2a2a674d21ebbe700a9451867e1e6051a79d7e99a193106e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01215.rs", "upstream_id": "BenchmarkTest01215", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: field_value.clone() }.payload;\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a7ab48550931f25848b960f2921fcf8f758649688367c4e9d98b73c3f3a67f8", "structural_hash": "419818a1240a7c660762157e69c1102260001edc29e70bd5b702dc1d5e06d2d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_38307.go", "upstream_id": "BenchmarkTest38307", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"regexp\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tholder := InputCarrier{UserInput: originValue}\n\tdata := holder.UserInput\n\tvalidPattern := regexp.MustCompile(`^[^\\x00]+$`)\n\tif !validPattern.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"forbidden\")\n\t\treturn\n\t}\n\tprocessed := data\n\tresp, err := http.Get(processed)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tc.Data(200, \"text/plain\", body)\n}", "label": 1, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cea9a6142f7e4b0f445bab5d0b14fcb1ee0952a34cfd19d66ed1fbea6f86bf3", "structural_hash": "bb29e1d3b6c40c8de856e30b769129bdea6874fff26c3662d3343a188351161f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40932.js", "upstream_id": "BenchmarkTest40932", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = await Promise.resolve(userInput);\n const checkedPath = path.normalize(data);\n fs.writeFileSync(\"/var/uploads/\" + checkedPath, \"data\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcc1c56bcbfd089a3d16d697a5522296b6de072b3d6b572fe6b605a83e090c39", "structural_hash": "afb1c03130e56a98e7a324efa44931527d1bb67ae4da77284e5e9ade835b50ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08238.sh", "upstream_id": "BenchmarkTest08238", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=$(printf \"%s\" \"$user_input\")\n chown -- \"$data\" /var/app/run/worker.pid 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe6591b3222a15b24f370ff08ab7db58fd1df6d9ae8b088553ef29cdb43c42eb", "structural_hash": "8a137a0cc32b7ba1ca38b64bf8d5fe576d2966484333975c2ecdf8aecc38bf52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08519.c", "upstream_id": "BenchmarkTest08519", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n long _req = strtol(data, NULL, 10);\n if (_req < 0 || _req > 2147483646L) return;\n long _alloc = _req + 1;\n printf(\"alloc:%ld\\n\", _alloc);\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f71063007a7c3472a0b6f7178859fc9601c41f3769016114629235154d9f72c1", "structural_hash": "dc6d03c523f4f7a08e24c77539881e17d3287f0b418d95e48e5cd0d1fcc9d6a8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05505.sh", "upstream_id": "BenchmarkTest05505", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=\"${user_input:-default}\"\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf9450a84990a1e3a87555c8b7333ee649c7975bc19e610bc506ce969fbce082", "structural_hash": "7c077593d0679edea708b2667dea6586b3bfbfa3c53464ea13b41f36ca33cfe1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04714.py", "upstream_id": "BenchmarkTest04714", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n data = ' '.join(str(referer_value).split(' '))\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Access-Control-Allow-Origin': str(data)})", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d726645ed57e1e8ea233f166c98aa8597f7e96e830b270d9eae13a7aa131a26", "structural_hash": "b690fcaad4e0946aac1399197196078348b42ea2442962bfe432d66e5e9549cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00015.ts", "upstream_id": "BenchmarkTest00015", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const fields = [userInput, 'http'];\n const [data] = fields;\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c0fd88fa0a81921c08198c3659141819b36c0a88d8d8dca5286a306b8e58989", "structural_hash": "e8157277b19d076c909d3afd1f6ef11077c600c6a8bc4b8e0f9b74cd927f3c6b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02183.ts", "upstream_id": "BenchmarkTest02183", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n res.json({ status: 'ok' }); return;\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e148d1660351c5fb921cfacf4bd19e3ebbc6999cd33ffbf749dfea409e21825", "structural_hash": "6a5a47fd671c964e233736c1ef563176d9b75bb08e64e846934b0182d83a8e38", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00809.ts", "upstream_id": "BenchmarkTest00809", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as net from \"net\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n const data = `${userInput}`;\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const targetUrl = data;\n net.connect(80, targetUrl);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f62db6e33cbe92821bd60fe813aad21e9e209c5393eb2ef9750af1fd83cfea40", "structural_hash": "c67e7d476bb3bcac005d30a23da1065804f0f8385315f033f5e4ee79bce76ad9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05085.ts", "upstream_id": "BenchmarkTest05085", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const data = \"\" + userInput;\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9476c9d0f431031e7efc4579e4a36f25347295c720700eb3018c71f17bbab5c", "structural_hash": "50e470e32cd10fa5845a55e38660f9307eb359a23c74bfa399c91e10a8155bee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12228.go", "upstream_id": "BenchmarkTest12228", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tvar _b strings.Builder\n\t_b.WriteString(cookieValue)\n\tdata := _b.String()\n\tpassword := data\n\tif len(password) >= 4 {\n\t\tDB.Exec(\"UPDATE users SET password = ? WHERE id = 1\", password)\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-521"], "category": "weak_password_req", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0be3da93c949b04daf277ffda75697487d150639743cac86f4db23f57e56fab", "structural_hash": "8239db0ecc1ed4442a81bd175230004858814d44ab8948e3e296ce7878cd35a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05360.py", "upstream_id": "BenchmarkTest05360", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nimport os\ndef benchmark_case(request):\n dotenv_value = os.environ.get('DOTENV_VAR', '')\n data, _sep, _rest = str(dotenv_value).partition('\\x00')\n key = os.environ['DATA_ENC_KEY'].encode()\n encrypted = Fernet(key).encrypt(str(data).encode())\n with open('/var/data/secrets.enc', 'wb') as fh:\n fh.write(encrypted)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba5f0bf827601a984c2bff86854e2c8193619667658c58bc3cf0d817915a2223", "structural_hash": "b7f65939b4e84c5a1675a9e2c8ae134612f628279f27dd5b807ca3f65e6bf7d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05398.rs", "upstream_id": "BenchmarkTest05398", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse url::Url;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (raw_body.clone(), \"http\");\n let data = payload;\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n let target_url = data.clone();\n axum::response::Redirect::to(target_url.as_str()).into_response()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30cd759614ea3d87187210868f40dd09053f90b4d5d88646f633248f965f5786", "structural_hash": "68cd7ce88dedf629b91cdfaa83e5eb1f2fbedab426c30b204d856a13ac05b104", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02830.rs", "upstream_id": "BenchmarkTest02830", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(origin_value.clone(), |s| s.trim().to_string());\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b37bf9b437cd278bc842b6a1f403a9ad52631f08c4a2b5469f9c12e8719bf3c", "structural_hash": "b1e2b5675585f5932f4d601154d12a1be4d33750d341a5cbb808a82435adf668", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40451.js", "upstream_id": "BenchmarkTest40451", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.type(String(processed));\n res.send('{\"status\":\"ok\"}'); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d68be6025c3e7d6e48151549d6b98e2d5fc983374080a338a27919a7c1169c1b", "structural_hash": "e6ba56958973a589b5f00872f1afee6deeca5f395696f44e94c9db117de27e63", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03762.cpp", "upstream_id": "BenchmarkTest03762", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff9037a7feb922568f6eb3c04ec6d960acc417960e9818f842a7424c68ec26cb", "structural_hash": "41ae5b8bffbf9aae2bf37fdf7f6d9967e5c269c2da8dd440d2b98cce57d781c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09656.go", "upstream_id": "BenchmarkTest09656", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata, _ := url.QueryUnescape(refererValue)\n\tif data == \"localhost\" || data == \"internal-gateway\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-940"], "category": "unverified_comm_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5518f693bd392db35e0c48143e5d3935163598c58caa9cd0f91404022d4508b", "structural_hash": "b364b55a7ee508745a964f2e3b8046eac4330c8eb056b947cd226dfcc6842a48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05055.ts", "upstream_id": "BenchmarkTest05055", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n res.send(nunjucks.renderString(processed, {}));\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8bdd137d662a6beccffdfef54cfbd69edca958fe7771ce218b0bc99db24a8a1f", "structural_hash": "4d8612005dd2cae1c05a8430f878e2e5b0044e93daa08d874906c456ffb9b979", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05425.php", "upstream_id": "BenchmarkTest05425", "language": "php", "code": "header('User-Agent', '');\n [$data] = [$userInput, 'http'];\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d8df4de8dcb42a5908c6053ba3da714c25f9a31d11478d50bfe6beef1b6cdb1", "structural_hash": "a0e583ee14dab22cfcc4bec783c1911c0fea14c01d34430217985c0be8383801", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00018.rb", "upstream_id": "BenchmarkTest00018", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2a7655901d5d4e55afbb34ca76c3e3966af7d4b553cefbdb9c9c9a440d9de2a", "structural_hash": "13dbcabe5786834ada9171fd0bb69368f6849d8d9a15e78bb9d0514481ed569f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04699.ts", "upstream_id": "BenchmarkTest04699", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c69018d4112c08555e34aa0d11f58d8f4c8c174e853fb3b634aa563af7e18ad", "structural_hash": "6b9b1e5369fddaabdeca4ba28df0123fd2eb913ea6a43af4cc559b914523072a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03281.py", "upstream_id": "BenchmarkTest03281", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\ndef benchmark_case(request):\n upload_name = request.FILES['upload'].name\n data = str(upload_name).replace('\\x00', '')\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(data) + ')')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27a83056daf6ed6e0b5932dedbc86727b389d3769f1d07acf039a2e26bce371a", "structural_hash": "515d12ad1788b1b5b5eeb62b08332503fff22758cca74b77cead1dcb1f79a367", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00636.py", "upstream_id": "BenchmarkTest00636", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\nfrom app_runtime import mongo_db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n host_value = request.headers.get('host', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(host_value)\n data = collected\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n mongo_db.users.find({'$where': \"this.username == '\" + str(processed) + \"'\"})\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35d1831aaab9b7814ccd8b15389edb5cb1e225695a4833c6dfd00c8a8e7a1492", "structural_hash": "07e22694c15518f82b8e91857db8b613b6ae53aca995b0e660dab45770e7a865", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24049.js", "upstream_id": "BenchmarkTest24049", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = String(userInput).slice(0, 200);\n const processed = data.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n res.send('');\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5918b9f9abf769ad4ce219292b09a3474248bb7bbb6daacd5f36b725812b3653", "structural_hash": "2f4db9690afe839494ad42ade4d1732f83dd2dcc70cbca298f624205c05bb919", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04368.py", "upstream_id": "BenchmarkTest04368", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n ctx = RequestContext(host_value, source='form')\n data = ctx.payload\n if not auth_check(session.get('user', ''), str(data)):\n return jsonify({'error': 'forbidden'}), 403\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e17dcc2c43479364102b29cc772657f91db299d37cae2033db628c074de4a4ea", "structural_hash": "1bf478bc73a47ff3dd02d63d4b0cbdc51f9e7bfe1c33a92bfc4780473cb0c331", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03515.ts", "upstream_id": "BenchmarkTest03515", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = cookieToken || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n if ([\"https://app.jscdn.io\"].includes(data)) res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0bc0ca79ebfa8819e022c39e32df264bbd3f925d4317c98cda9d8d3fbe8b9651", "structural_hash": "6993b0bad61b5d3572a28ad212a2ccf77b1ef6d4106d9806f6748b1f085c7d00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06101.ts", "upstream_id": "BenchmarkTest06101", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (data !== req.session.csrfToken) { res.status(403).json({error: \"csrf mismatch\"}); return; }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2173c98bd3a0a0ed2601c650f910acda700a7e3a390fe36f8df22c5a97923a51", "structural_hash": "134cce29dc7fe4df8d50fbd2b684cacdf0ee5e8e07939dda69ecb4e09fdf412a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03757.ts", "upstream_id": "BenchmarkTest03757", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const data = Buffer.from(userInput, \"utf-8\").toString();\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e91a4d82949a8b879a2ac861bed30ecf738ab793103b2e2349861fd210f824de", "structural_hash": "bedc2d15f44de3a23c6365f522772adb39af9948b399d03d2fb25103223a9ae1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04551.php", "upstream_id": "BenchmarkTest04551", "language": "php", "code": "getContent();\n $field = 'data';\n $$field = $userInput;\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e726267b21861d4cec09fbb67dd5359a2e0aa4ccfd12c92dc408f52bea5ba77", "structural_hash": "dc9ac001d36fd631efd562ad87b05623e315502f89b20e5f056c6fcfbd0b38a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00581.php", "upstream_id": "BenchmarkTest00581", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7dffcd3d3dd16a98f8eec7456b5abfa66e2449a4c14d042fab2a0754404fa93c", "structural_hash": "9a659f0c1399f54a676dd1577b592550ba23f395aaa6ce6845df51c4fd0be61d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01503.py", "upstream_id": "BenchmarkTest01503", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = bytes.fromhex(cookie_value).decode('utf-8', 'ignore')\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Access-Control-Allow-Origin': origin})\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "993876da7c4c7032454df0d9f1cda88b957ef0374f9d6ab0db7e29adb24ca599", "structural_hash": "e2c4e6a45b43fae84e28e40ebca9a960dd54fd4f1abf7a84232646ada9a7b72f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02911.py", "upstream_id": "BenchmarkTest02911", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n data = str(path_value).replace('\\x00', '')\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c928e108e07959061f511ad71dfb6fab3ded1b694df2a5faa38269d6f460ea83", "structural_hash": "f5be46ab08134334def22d8fe889f6e323dc7f26e59502dc504f6b0dbdbd4bab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12955.go", "upstream_id": "BenchmarkTest12955", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/csv\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tvar data string\n\tif cookieValue != \"\" {\n\t\tdata = cookieValue\n\t}\n\tcell := data\n\tif len(cell) > 0 && strings.ContainsRune(\"=+-@\\t\\r\", rune(cell[0])) {\n\t\tcell = \"'\" + cell\n\t}\n\tcsvFile, _ := os.Create(\"output.csv\")\n\tcsvWriter := csv.NewWriter(csvFile)\n\tcsvWriter.Write([]string{cell, \"data\"})\n\tcsvWriter.Flush()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c15931c13905d27ab5350bc4539965f7e37c8d63323e702f6e60fec64d1efdc", "structural_hash": "b4783491379bb48252db3c236881e1e1446c03a3df7ec28002a222ab5cf59a07", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08535.js", "upstream_id": "BenchmarkTest08535", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-305"], "category": "auth_primary_weakness", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a0de01fc4db91a80e29641e4c58e16fc6ba7dbd9f83598962e385235b2ca4a0", "structural_hash": "3b18e6e4cdb72f88bbe302ccff08296c4e6111c7d7236a7b1754b0bff81a2536", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03551.rb", "upstream_id": "BenchmarkTest03551", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = ''\n user_input.split(',').each { |token| data = token }\n processed = CGI.escapeHTML(data)\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ed3089110c8a2a0415dedcf0736a06086f944ad2f64cc70a059dbc332d1ca31", "structural_hash": "080700053bf4d34be5cf4da16adde16aab9af0962ee2be22b0f4c939b28bb9cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05504.py", "upstream_id": "BenchmarkTest05504", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = ' '.join(str(raw_body).split(' '))\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return JsonResponse({'name': str(value)}, status=200)", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e28789ea5e06d72614799070de9dbbeab772781863c8aed99e8078ecb04fa83", "structural_hash": "97885e4e1a0ab1e221e857aa9dd78dedfe0f7f2728b47a1a0dea69f9be2f03c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01287.java", "upstream_id": "BenchmarkTest01287", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.Map.Entry entry = java.util.Map.entry(userId, \"request\");\n response.setHeader(\"X-Tuple-Context\", entry.getValue());\n String data = entry.getKey();\n Object evalResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a23d370f569d50ca800ce75a6d30117b10f9034d148798a5ca0864145b9be8e6", "structural_hash": "d89cbab4c95f7471a9b86353595a890a6abf8c7f8badedd0605fe83982ac992f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01748.c", "upstream_id": "BenchmarkTest01748", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _field[600];\n size_t _fi = 0;\n if (data[0] == '=' || data[0] == '+' || data[0] == '-' || data[0] == '@') _field[_fi++] = '\\'';\n for (const char *_q = data; *_q && _fi < sizeof(_field) - 2; ++_q) {\n if (*_q == '\"') _field[_fi++] = '\"';\n _field[_fi++] = *_q;\n }\n _field[_fi] = '\\0';\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"\\\"%s\\\",exported\\n\", _field); fclose(_cf); }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ebfec28a97c53fde9c03b75a7c75919244fdba084e9602e12eb485514e287f4", "structural_hash": "f930531ee89516c68de593a0bd68a16c366b971510ff051a3c3f2946cdef77e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15143.c", "upstream_id": "BenchmarkTest15143", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct sqlite3 sqlite3;\ntypedef struct sqlite3_stmt sqlite3_stmt;\nextern int sqlite3_open(const char *_filename, sqlite3 **_ppDb);\nextern int sqlite3_exec(sqlite3 *_db, const char *_sql, int (*_cb)(void *, int, char **, char **), void *_arg, char **_errmsg);\nextern int sqlite3_prepare_v2(sqlite3 *_db, const char *_sql, int _nByte, sqlite3_stmt **_ppStmt, const char **_pzTail);\nextern int sqlite3_bind_text(sqlite3_stmt *_stmt, int _idx, const char *_text, int _n, void (*_destructor)(void *));\nextern int sqlite3_step(sqlite3_stmt *_stmt);\nextern int sqlite3_finalize(sqlite3_stmt *_stmt);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n sqlite3 *_db = NULL;\n sqlite3_open(\"/var/app/app.db\", &_db);\n char _sql[512];\n snprintf(_sql, sizeof(_sql), \"SELECT * FROM users WHERE name = '%s'\", data);\n sqlite3_exec(_db, _sql, NULL, NULL, NULL);\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1c608be6cdb21b97153cf611438f2d1eebad64cec4377934b07aaa031fe01ff", "structural_hash": "b2b93f3e5d6ad472c2e4423e8cf4be23704c312c1c54f8c666fe896496a99a94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03198.php", "upstream_id": "BenchmarkTest03198", "language": "php", "code": "headers->get('Authorization', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a137fc380c1530a234291310044539b2925fcd31b9da99ffa32132d7f54dbbc", "structural_hash": "44a0e43c75c6ce3152d064935968424eb475fb126b80fca15be7a19deb117d3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04599.php", "upstream_id": "BenchmarkTest04599", "language": "php", "code": "header('User-Agent', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff3c91408d46e2ac299edb01a132544637f4c622f151352153230d148654b7ea", "structural_hash": "d581733abfb5b6471147b6bac3606a6cc511b08adf1d852ef51fb16307a6536e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_22330.go", "upstream_id": "BenchmarkTest22330", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(rawBody), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\ttmpPath := filepath.Join(\"/tmp\", filepath.Base(data))\n\tos.WriteFile(tmpPath, []byte(\"data\"), 0644)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc62bf9477361ffbcdaebdbb1e49df0bd5373c715d2e9d991fd2a115b4a8e96e", "structural_hash": "8dfd37fee830ec7eb40450e8e6e569b632336ecb5d5f1b7d19467a8479ef0ebc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01087.ts", "upstream_id": "BenchmarkTest01087", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n childProcess.execFileSync(\"echo\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0a557cb07a2b43577aff6b1415ff5b808aef335cbc42034565e8d663862a145", "structural_hash": "b9538301e115be02f8398115bdea69c30932658af77b930e9dbabb5ef91cd59a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03098.sh", "upstream_id": "BenchmarkTest03098", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n echo \"data\" > \"/var/uploads/$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ff21d86611110bd117592ed19a45c4e33cd8f98f04358a8c4a4d6a9ca256463", "structural_hash": "34716a4ec9880291c38f2ee6bee84c06c27d00499e9e8ad049de92c04cd7d922", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04615.rb", "upstream_id": "BenchmarkTest04615", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", data))\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcb0335006541fb0f4bb56094672a6ce63cc7dadac06ee793760ffbf635dd9cb", "structural_hash": "f13797fa276949f7e07f39b202024c60b21eee72b185d1542ed68bf76e0c8acf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03029.ts", "upstream_id": "BenchmarkTest03029", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + userInput + \")\", scope: \"sub\" }, () => {});\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c7319623317b6daff8df6009e8e53ea5960ab28579e84fef6c426c49e770fe2", "structural_hash": "a7f281b649fd64d28a65b26c344916aec49d6298c3eba1be5f53248803aff167", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05290.py", "upstream_id": "BenchmarkTest05290", "language": "python", "code": "from fastapi import FastAPI, Request\nimport ldap\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n data = (lambda v: v.strip())(field_value)\n if data not in ('asc', 'desc', 'name', 'created'):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37a82090cbe9ed68b40260aa153c9a0ad7a3e9644701afbe04fceaf0b5db9134", "structural_hash": "acea9c6b47ae2f3c966a4536497610484c97a786e74c4bdb6979e442799ce62c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02807.php", "upstream_id": "BenchmarkTest02807", "language": "php", "code": "json('payload', '');\n $data = '' . $userInput;\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7a12487c356fa458193dbb8527f28b7391bb58fff8def311d135bd2bb24777b", "structural_hash": "c712d420c330bbb7017fc26556a817c8f575732d33d2260f930f559f5b57ea7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01954.py", "upstream_id": "BenchmarkTest01954", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\nfrom app_runtime import auth_check\nrequest_state: dict[str, str] = {}\n_login_attempts: dict[str, int] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n request_state['last_input'] = user_id\n data = request_state['last_input']\n if not re.match(r'^.{1,256}$', str(data)):\n return JSONResponse({'error': 'schema invalid'}, status_code=400)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if auth_check('user', password):\n return JSONResponse({'authenticated': True}, status_code=200)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "054cfb5d7f36936f036a02cde71597be32f97fc4175485d9fed3bb448717af9d", "structural_hash": "60506593a295b46633f503a91195fb28003cc57ee619997155b9f00ea5f1e97c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03827.rs", "upstream_id": "BenchmarkTest03827", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let queued = user_id.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "265e7c4ad23e309dd958a414f173a8a3459c6ee526ca20ba5ad156dab3256008", "structural_hash": "5c58a52a305015e0d57c8a980dfcbe2f1dc52eccefbfbaefd8a0254899232851", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05719.rs", "upstream_id": "BenchmarkTest05719", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let mut pending: std::collections::VecDeque = comment_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n crate::shared::auth_check(\"user\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3818b81fbcf709ec430a58e21290a4bf9428b53fb476e9642647f8ad27b913f", "structural_hash": "17a0ca999e9983c934b8572e8dfdc4b323f87c9c40991c3208dc4ca5fbad10a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03238.cpp", "upstream_id": "BenchmarkTest03238", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n unsigned char _hdg[32];\n SHA256(reinterpret_cast(data.c_str()), data.size(), _hdg);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.hash\", \"wb\")) { std::fwrite(_hdg, 1, sizeof(_hdg), _sf); std::fclose(_sf); }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20d1399c2d14921cac99250e4c0490e7bcf328233760e43eef2663bd0a3c4785", "structural_hash": "d4d4c97ccaf83b5a3586c986f0f56b61e369e3430805f7a9244c1ad4d6e0c2fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07391.js", "upstream_id": "BenchmarkTest07391", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33f6fd65ed8bae2c22034069e564b1738c030901baed23d3fb07955d92f7d481", "structural_hash": "72519310da142ef036b5281411dfdfb6f8c209e662f5286741c985d7f055ae36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19368.c", "upstream_id": "BenchmarkTest19368", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bdab0837816480cf843378c3bd7f243179c983ecb754c7146e184d8f7f63c74", "structural_hash": "f75265be3622f55f71b7732d838f3cb0d4f8b92c6bb4d46cea576e15a4ad4166", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00652.py", "upstream_id": "BenchmarkTest00652", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = '%s' % (cookie_value,)\n record = db.fetch_one('SELECT * FROM documents WHERE id = ?', (str(data),))\n return jsonify({'record': str(record)}), 200", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d794a7e54cd598f83cd8601dfd97d4931d869bc4474832c773c2e746c012521", "structural_hash": "e6f4c1a4bf1aeb9c26b340439e7f98f71e91fa2a48fc7ba11458189d9229aa51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02621.go", "upstream_id": "BenchmarkTest02621", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tvar _b strings.Builder\n\t_b.WriteString(hostValue)\n\tdata := _b.String()\n\tencrypted := encryptForStorage(data)\n\tos.WriteFile(\"/var/app/data/store.dat\", []byte(encrypted), 0644)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de5365d695eb0a0dee4a19268fe5c87aa6ac5a583b30a36c997965cbe5c47c20", "structural_hash": "c3b317d07473c9af8e5aa7740eaec9ff5c0cd38c1fd33ddbc84ca7eaa3d19d44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03538.cpp", "upstream_id": "BenchmarkTest03538", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1889ff649f36e4661cd8b16aff3f2b835afa64fe72ff4db65b5f125f72d70de", "structural_hash": "accfe40610bbf4f6b3a1055b9da44d7cb2b9de62d3221b25eb5b491ee4fa31a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07029.js", "upstream_id": "BenchmarkTest07029", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e4c9e4c8c8a7866fa4a8a35c50f2f892302f958d4ce2f12c2e9c4c6c7a589e2", "structural_hash": "4c69e52088fd1d9a3327604315fb5694ef123eb5a077a8be4eb3cf5480f585ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19640.go", "upstream_id": "BenchmarkTest19640", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_apiResp, _apiErr := http.Get(\"https://api.svc.cluster/data\")\n\tif _apiErr != nil {\n\t\treturn\n\t}\n\tdefer _apiResp.Body.Close()\n\t_apiBytes, _ := io.ReadAll(_apiResp.Body)\n\tapiValue := string(_apiBytes)\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(apiValue), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\thttp.Redirect(w, r, data, http.StatusFound)\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f94c55dbac32dd05056fbba4df4eb7c88cc3eab97cea3f76c5f3fba9fd3415f4", "structural_hash": "6d5a6748109927d674da2d54dcb1454e327516a78644f46d10eb0e55e4d1aebd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00406.rs", "upstream_id": "BenchmarkTest00406", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = referer_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "462075c88b2f260fe6b2eef40b22411d4d2052056fea7ba4f8bbfc08b68d5a01", "structural_hash": "4dd10bd510f5e7316fcc67020f02a11fa0df88e61f29f299c5adf6665c7b5a1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04362.java", "upstream_id": "BenchmarkTest04362", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n String data = forwardedIp.isEmpty() ? \"default\" : forwardedIp;\n if (!(\"true\".equals(data) || \"false\".equals(data))) { return Response.status(400).build(); }\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57cd9deef63759bb1bf9fb53127fcbcf68f754f071f5a6a5d97dbac0778b785f", "structural_hash": "05825252421debea74fb19af5b624e4f27abb3f024147c7eee68ef370cfa0972", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07795.c", "upstream_id": "BenchmarkTest07795", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45b06c5e7082484bd9be91857a11974cdfa16b14c8165e2beb4c30aeebf6c705", "structural_hash": "b418dcba3760f8c5db5bac14fc8444ff1ca6014cd5c18d066005c5b6a6871973", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05346.rs", "upstream_id": "BenchmarkTest05346", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = crate::shared::passthrough(graphql_var.clone());\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b0ef52595cba89f59d2f74b7d4f2c125a6291463d000363b84d983874e45278", "structural_hash": "12778212970c2e1abb9b9e67b485ce793d40d95d9962809ed9f2faf9d4470e64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03642.ts", "upstream_id": "BenchmarkTest03642", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = userInput != null ? userInput : '';\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n res.json({ status: 'ok' }); return;\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f98a15605734b5e8566ac545a303c5eb9ec3043358e63015b5975ebc97d3aba9", "structural_hash": "18389d2fbf85a4094c761637da40c5579a990f8c7a87bc77913a7f290ff6e47a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12630.go", "upstream_id": "BenchmarkTest12630", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := jsonValue\n\tif _, after, ok := strings.Cut(jsonValue, \",\"); ok {\n\t\tdata = after\n\t}\n\thtmlOut := \"
    \" + data + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b45d1655d76d16e7e57a7b524b73bb739b4e1bd69329e14b96481d67f666e902", "structural_hash": "1929600ca3f17dfe43fa0fd61610e1a6b4ad590901eb0b25c59611d53d972ffe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03874.c", "upstream_id": "BenchmarkTest03874", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\");\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcfd902b2e4162b470321f650b975e42bd30438b6f104858ec7798bb6fb7a679", "structural_hash": "6e3e8f44c1e2f2fdd0ca98a80705601b617d354398342aa006b937da5a5d498a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05959.py", "upstream_id": "BenchmarkTest05959", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom pydantic import BaseModel\nimport os\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n parts = []\n for token in str(json_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n entries = os.listdir(str(data))\n return JSONResponse({'listing': entries}, status_code=200)", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35d50add8ac8eeb27ab9a0a59314d39ee3dbbec9996c1eafeec0f7e94510b1d8", "structural_hash": "c5aedd8a03366e3116b4fbdbc17c67a12da514a306564869ec1492333a9b7e94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16440.go", "upstream_id": "BenchmarkTest16440", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"sync\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tdotenvValue := os.Getenv(\"DOTENV_VAR\")\n\tform := FormData{Payload: dotenvValue}\n\tdata := form.Payload\n\tvar secretCache sync.Map\n\tencrypted := encryptForStorage(data)\n\tsecretCache.Store(\"current\", encrypted)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"stored\": \"encrypted\"})\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_memory", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a904132d81378f5e77b80c2c669c7da89e11c8d8458fe578026c94c3aca130e", "structural_hash": "8ddfb022cf99dae69ab7fae9ef8aa808447452a1d6e47363835c466412105d4b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03289.py", "upstream_id": "BenchmarkTest03289", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n data = handle(auth_header)\n if not auth_check(str(data), session.get('token')):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ee3a3596ffee607f197f79056a4c3ab5182e43007e045dc2f37ee8ede5d4b7a", "structural_hash": "0c157c2357e0bc7b2df0467546842d7b6f2c1985bd1edd45d19e1b960bf592f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05959.sh", "upstream_id": "BenchmarkTest05959", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03135ef5ce901c31b845519c55ddaef153b7e507a8d27e56a85aae14a59b543c", "structural_hash": "19cf47cdc16a11f7f0b7472614bfabda2ef5f0f05b935be4fa09b05734accca4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03671.cpp", "upstream_id": "BenchmarkTest03671", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n std::string _truncated = data.substr(0, 64);\n int _req = std::atoi(_truncated.c_str());\n int _alloc = _req + 1;\n char *_buf = new (std::nothrow) char[(size_t)_alloc];\n if (_buf) { _buf[0] = 0; std::cout << \"alloc:\" << _alloc << std::endl; delete[] _buf; }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff402f68ebc8ca12139ea2269080a5b5c821966ec636f3fe605b9c3f771f472f", "structural_hash": "0f64a71f1b5b359a8899e1b70bb8b9ab4d55fd1a782180a4b37b377b59a0cad9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03902.cpp", "upstream_id": "BenchmarkTest03902", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92bea1f624f8e3cba764199eeaa7697b660bca2901a176a69a76e893b1edf995", "structural_hash": "0d679bfac216a13f6d99dcb91a0753830f5538f09e9c3ef962f3c1e232f5e810", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01666.ts", "upstream_id": "BenchmarkTest01666", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "246b0cdbbb91134b4f90a74b9e1861f38256993bc85436283db4fa12d8d0f283", "structural_hash": "c3d9ee47fe6241057fe882f6a9ca9425fa9c8e144c44b431099e3f7bed91c704", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01835.ts", "upstream_id": "BenchmarkTest01835", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n db.query(\"SELECT * FROM users WHERE id = '\" + processed + \"'\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe71cb538a317e5776e7b695eb0e014991a23e8b3a1da8c95e747f8271c01baa", "structural_hash": "a25b192e1c1f025521bf7540d09b80247917a0bf8716d6a63abf7a13c64e4fcd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01254.java", "upstream_id": "BenchmarkTest01254", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.util.Map.Entry edge = java.util.Map.entry(hostValue, \"body\");\n response.setHeader(\"X-Tuple-Context\", edge.getValue());\n String data = edge.getKey();\n java.security.KeyPairGenerator kpg = java.security.KeyPairGenerator.getInstance(\"RSA\");\n kpg.initialize(1024);\n java.security.KeyPair kp = kpg.generateKeyPair();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"RSA/ECB/OAEPWithSHA-256AndMGF1Padding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, kp.getPublic());\n byte[] wkBytes = data.getBytes(java.nio.charset.StandardCharsets.UTF_8);\n byte[] wkSlice = java.util.Arrays.copyOf(wkBytes, Math.min(wkBytes.length, 62));\n byte[] ct = cipher.doFinal(wkSlice);\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd30d631bf0a03bb94802e7cf0a341c71a145e9afed7a15e539ddab8d7f7c5cb", "structural_hash": "8c04df1f15d648711bd6788ffd69565b17dde1d10db88bcac62cf212c7435a79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14882.sh", "upstream_id": "BenchmarkTest14882", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n printf -v data \"%s\" \"${user_input}\"\n checked_path=\"/var/app/data/$(basename -- \"$data\")\"\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ac561f7a8f5b4f66b4b81d59b90ea9b8eb1d24d97a27b7bd6e88d4b1c0da695", "structural_hash": "024a555ddcf92b207e7efdc9cb425cda85f7f7007727985733207fde67650ba8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19523.go", "upstream_id": "BenchmarkTest19523", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"text/template\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tsegments := strings.Split(xmlBody, \",\")\n\tdata := strings.Join(segments, \" \")\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\ttmpl, _ := template.New(\"unsafe\").Parse(processed)\n\tvar buf bytes.Buffer\n\ttmpl.Execute(&buf, nil)\n\tw.Write(buf.Bytes())\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "623bcb14b51b9459b9515b7ca5ae0663f7aa5eab7f35ae962b84d425ccead965", "structural_hash": "4c939c6e38ae2c054057272aaa9bd0c4c3734174e57c5d40437400c1327091e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01158.rb", "upstream_id": "BenchmarkTest01158", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n content_type :html\n ERB::Util.html_escape(data)\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "107c65e62b660c374fec9616f3e8c9a8dd3d265259b57b3f89f33065653cb014", "structural_hash": "dd218cd95a340defde1cf9e6c4ed7f38e3c674f7157b7014076c8f4cb1c2aec1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06464.c", "upstream_id": "BenchmarkTest06464", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n int _vals[8] = { 0 };\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 0, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15d504a3a731dad0022f0ff97894bce70d1c14962d8f213c628690207b9ae273", "structural_hash": "33d07a4f652cc193cdb3a9b3d6024158769b405b489939bca616e518598c7854", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00845.cpp", "upstream_id": "BenchmarkTest00845", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n long _oid = std::strtol(data.c_str(), nullptr, 10);\n bool _allowed = _oid > 0;\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2fc6c1041447a4f1ff86bfcc902876ebe9ea6ae0b7a8c77a1745d69a3d7efade", "structural_hash": "acb111709d1db84c4ebe8a63862a1e28eadcb3a77e2658170dde98b1bda5fc1e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01531.php", "upstream_id": "BenchmarkTest01531", "language": "php", "code": "input('field', '');\n $data = call_user_func('strval', $userInput);\n file_get_contents('https://api.corp.lan/submit?d=' . urlencode((string)$data));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92905af55736d8b19bbd8b3c187cbbfb966ba2d7d1f8bdbe612ead6eb00c1395", "structural_hash": "de75de5aecbf327b870c397b25ad4b5ff893bf973a210ad218f73c038935930a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_34412.go", "upstream_id": "BenchmarkTest34412", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/text/unicode/norm\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", forwardedIP)\n\tdata := _sb.String()\n\tnormalized := norm.NFKC.String(data)\n\thtmlBody := \"

    \" + normalized + \"

    \"\n\tc.Header(\"Content-Type\", \"text/html\")\n\tc.Data(200, \"text/html\", []byte(htmlBody))\n}", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d3be3fa9099209d68848ec12b0854913c2f9f2a76e79ff8f6ab819739797ebf", "structural_hash": "458e9fcf3f14e8bfb7b22756a14ca08a43a136401fda531d58ca8fe3fe02fe26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01561.php", "upstream_id": "BenchmarkTest01561", "language": "php", "code": "cookie('session_token', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff8e81f01050a0a5a325e6ec08dbfc96b146ed4340c5f33b3822d83a2f908487", "structural_hash": "c6caf30ef01b79c4e8fc33536faeca8eb8fa154a71ee78dc6c8f664b3b002f7c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05160.ts", "upstream_id": "BenchmarkTest05160", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.authorization as string) || \"\";\n const data = userInput != null ? userInput : '';\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f1ac11cd2e2163baa7eda6ced922e75c4b5a1f0715f9302bb3b1d7a1cf2b095", "structural_hash": "08e2e1df66bbd24967d18c0a11dbd53617adf4452a1c4fbba219d49c884ddb70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04812.php", "upstream_id": "BenchmarkTest04812", "language": "php", "code": "header('Origin', '');\n $data = ($userInput !== null) ? $userInput : '';\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$data]]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a3ee01b605b5a3e831b4c2435c9aa54c6e086780f74eca36d376d0eabf0d945", "structural_hash": "d1f39214a80dc6724a51f12f3a695a2ecf337749f5234c8a8da09e20dd93c5ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03554.py", "upstream_id": "BenchmarkTest03554", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n header_value = request.META.get('HTTP_X_CUSTOM_HEADER', '')\n parts = []\n for token in str(header_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return JsonResponse({'status': 'ok'}, status=200, headers={'Access-Control-Allow-Origin': origin})\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc6fdd428cd11eacba6abaaec280b5901ce77ec96c4a56ba1b915314ae3589f3", "structural_hash": "bd4756a58f177fd0223893cc25df39ba5284fcc2cb2b841a2a4cc0e2e1b8867d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02771.php", "upstream_id": "BenchmarkTest02771", "language": "php", "code": "headers->get('Origin', '');\n $data = trim((string)$userInput);\n $_ch = curl_init((string)$data);\n curl_setopt($_ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($_ch, CURLOPT_HEADER, true);\n $_raw = curl_exec($_ch);\n [$_hdrs, $_body] = explode(\"\\r\\n\\r\\n\", $_raw, 2);\n preg_match('/X-Content-SHA256: ([\\da-f]+)/i', $_hdrs, $_m);\n if (!isset($_m[1]) || hash('sha256', $_body) !== $_m[1]) { throw new HttpException(502, 'integrity check failed'); }\n $_resp = ['body' => $_body];\n $conn->executeStatement('INSERT INTO feed (data) VALUES (?)', [$_resp['body']]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6c47fc3ca0c557c7953aa09ffd55a53a687b1a4e24d228c2f45f33974911145", "structural_hash": "f579b6bdf583a11d02e98f3b28b2b7c14e89f030c7dbb5544f75dbb8b00c2305", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03465.py", "upstream_id": "BenchmarkTest03465", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n ctx = RequestContext(path_value, source='form')\n data = ctx.payload\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d29a56aec959223f217da9b52924e03a8aa98280282da47306994f9735d4b04c", "structural_hash": "16d4e58769fc2dbf548494dc666b0b2f4f5a9312f1b725a9bd10baa65042d684", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02770.py", "upstream_id": "BenchmarkTest02770", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom types import SimpleNamespace\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n ns = SimpleNamespace(payload=cookie_value)\n data = getattr(ns, 'payload')\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n trusted_claim = str(processed)\n return jsonify({'trusted': trusted_claim}), 200", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3fc716c755c9a29945f44ee75b789b6fef544db0ab29e93d1e290e0461d6c35", "structural_hash": "464572132283bd24860f93f5cba90617c275477912fe39ef2b80fa4e7b3c4f52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05759.rs", "upstream_id": "BenchmarkTest05759", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let (payload, _origin) = (cookie_value.clone(), \"http\");\n let data = payload;\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a7dd4938ebaffaa267e44eb0ce2c77a2bc675b29b182fdc2426dec853db366e", "structural_hash": "0c1f19f4c235780fbbc908b50756d3c367aaadb4df595c0449f7ac57d8941b66", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05333.rs", "upstream_id": "BenchmarkTest05333", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n log::info!(\"User action: {}\", host_value);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "988732fe6774dca17dcb8e6ab6f15f737e7b38d524940ee7ac5117258a5ca12b", "structural_hash": "1ccee0b2079291d27ff41b353b449f8daa105d280a89400d90d1f65f02850b4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01679.ts", "upstream_id": "BenchmarkTest01679", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "caf8773142567cf541d799c8f10c748762c48817ce31838a504864fe9d859a1f", "structural_hash": "c7470aef1a6d36c2f64bbec80a563ae3e2c7adec645ccea210888aa618e5567d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06436.c", "upstream_id": "BenchmarkTest06436", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char _stackbuf[64];\n strncpy(_stackbuf, data, sizeof(_stackbuf) - 1);\n _stackbuf[sizeof(_stackbuf) - 1] = '\\0';\n char *_p = _stackbuf;\n printf(\"%s\\n\", _p);\n}", "label": 0, "cwe": ["CWE-590"], "category": "free_nonheap", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_nonheap", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b2773802cbcfa2e4e9cd983be5ab9e0ae1955ff2f9d3cbfb38340dfc9c4ac9f", "structural_hash": "e97389c33e084f8f441f4bd60494bb4840402b4b8f5108aff5817982fc28db3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_42829.js", "upstream_id": "BenchmarkTest42829", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n libxmljs.parseXml(data, { noent: false, nonet: true });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-91"], "category": "xml_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3726dd1f045a253242804d70e353391e418e49093b4519347eac34661c7246de", "structural_hash": "6b69fec20656b83a464afcc9bb54a0a54f4d07cfe66d7aa3676806f0bd74362b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_20447.go", "upstream_id": "BenchmarkTest20447", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvar data string\n\tif len(uploadName) > 0 {\n\t\tdata = uploadName\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 1, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed6a58d88d8822d3546dca03b0991e9da71537cee84f1c688794a4144e5a9531", "structural_hash": "b6ab78331c05e3ad9948334a014d6b9c75baa68d717b981f9ef4effe469625f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03031.rb", "upstream_id": "BenchmarkTest03031", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2efab132580860c5c64d888e67c3cb2a35f5835b0da464adf248b35319ba125e", "structural_hash": "2491682855cc85db07526da98833e90c9ee9e5a1929e37fd57ed4b56ba7f7a9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02261.php", "upstream_id": "BenchmarkTest02261", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n [$data] = [$userInput, 'http'];\n if (in_array($data, ['https://app.shopcdn.io'], true)) {\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->set('Access-Control-Allow-Origin', (string)$data);\n return $resp;\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "701da8ba6c1288600d6d914a1540a9d2ffb962b943cc469bd44ea9e16526fc9d", "structural_hash": "bec8d31aa7056211ac688902a48663216672e7dd836f501e5a3fc7bed64afff9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05526.py", "upstream_id": "BenchmarkTest05526", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n kind = 'json' if str(cookie_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(cookie_value).strip()\n case _:\n data = str(cookie_value)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if _login_attempts['user'] > 5:\n return JsonResponse({'error': 'account locked: too many attempts'}, status=429)\n if not auth_check('user', password):\n return JsonResponse({'error': 'unauthorized'}, status=401)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6187687bf6ab564b797a16e9cb1097448c8aff8ae4c7cc05a0ad781135683c5", "structural_hash": "07d1f571cad9e04ece30cf916a5fca110a532945fbb40bd46637bc42f557aa02", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04497.py", "upstream_id": "BenchmarkTest04497", "language": "python", "code": "from django.http import JsonResponse\nfrom lxml import etree\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n if json_value not in ('asc', 'desc', 'name', 'created'):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = json_value\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e8b7f890d3796ff101d819d71c6005d4f0edd467cfcdbc1d5a348c21b19376a", "structural_hash": "cc658c9f3e67f8ddbfe75244abe802abe6787cbf6d6a8973aa9402856aa8236e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03710.ts", "upstream_id": "BenchmarkTest03710", "language": "typescript", "code": "import { Controller, Param, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = pathId;\n const data = userInput != null ? userInput : '';\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n res.json({ validated: String(processed) }); return;\n }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e16fc889273e735565730d6f3724614e8a36e95f779b6613cd53e69e4cb6d03", "structural_hash": "3503b97efb886ae1c48c550a77951a455aba46b13034176d55ca0bc3e92c60bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09675.sh", "upstream_id": "BenchmarkTest09675", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n cat \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed6080d0ecb117ad463ba5aba97b393297aac07b327b915448b54986991cc81b", "structural_hash": "0d0f42899e4f30b12ad275e3d79fa511208159eb5e4e5c4229e85a985294b95d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20576.c", "upstream_id": "BenchmarkTest20576", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96cf0461103f4e5f1a2c600fd2fa16592271ebc29e922ecd702eafe7438fbd9f", "structural_hash": "0fd61fd2956375965946413cc58561cfd47fd447c5928f24afd03fc1438d8cea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01472.js", "upstream_id": "BenchmarkTest01472", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n if (!authCheck(data, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "005decee6073daa1cee7c3634ace5b489243cbf01564aadd160af31a363162e3", "structural_hash": "a39d799ec58f998145c2bff84e52a227f51a894ea90d41b2ff211c709829e13f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04251.sh", "upstream_id": "BenchmarkTest04251", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n rm -f \"$tmp\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c1c54fce3f4016b93be2bb7e45ea1c5699445029098de3d3ebdc46bad3cd6a50", "structural_hash": "1c49a459581e5cee9988c19ec2b2c190051e7527a29666ff1c51f6b0c9ad40e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03547.cpp", "upstream_id": "BenchmarkTest03547", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string safe = user_input.size() > 4 ? user_input.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68a0f30d9b1c641142c9a0e45b29b1662660d5f96fd70eab72f2649a2571a10e", "structural_hash": "2a5bd53abbb1b04a4f648c1be625f3b52f0295f68d30b5b155bc5d5e836bcb53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04166.rs", "upstream_id": "BenchmarkTest04166", "language": "rust", "code": "use axum::extract::Form;\nuse axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(headers: HeaderMap, Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let mut data = String::new();\n for token in field_value.split(',') { data = token.to_string(); }\n let _csrf_token = headers.get(\"x-csrf-token\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if _csrf_token.is_empty() || _csrf_token != crate::shared::expected_csrf() { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82b44c6fa2f5a16ccfa2d716b9f72ad5ebd41d5ecdac8d45295920da2b8ab470", "structural_hash": "9aadbd8d81900a26c698767eb6d95857ce5e49b3e0e67a0bb650da834dc985b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00381.js", "upstream_id": "BenchmarkTest00381", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/uploads/data.enc\", _ct);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "983ea053d21c1bc5394f8ba263686369d30acda91a05c1ab42b9399eb0f78255", "structural_hash": "a1eb0d6c24620a84169f05237be0c1189a18c9aecc01e9a0357c9a637e562934", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00049.py", "upstream_id": "BenchmarkTest00049", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n data = handle(upload_name)\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n os.system('echo ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa74b4f3b7e305684687e859ee2f5cfa0e052db5e2416a51d3d70f26bdab1ef7", "structural_hash": "e6a279752b3c3304ce03f1b2bacdaa3103ee66560967c12dab697af78d4a5a19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_00775.go", "upstream_id": "BenchmarkTest00775", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(pathValue)\n\tif !verifyBearer(r.Header.Get(\"Authorization\")) {\n\t\thttp.Error(w, \"unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\tentries, _ := os.ReadDir(data)\n\tvar names []string\n\tfor _, e := range entries {\n\t\tnames = append(names, e.Name())\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]interface{}{\"listing\": names})\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e4531004d3c491249ad404b7c820b2e7a93f1d1963f250e952528ced19b8a5b", "structural_hash": "0d138569248959e815b248c80a35330db6f1cbf7068e23d53430d289342e85fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01781.rs", "upstream_id": "BenchmarkTest01781", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = host_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return (StatusCode::NOT_FOUND, \"\").into_response() };\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51df1d897de7649d67a920dabee851c9629816e0a04bb9347ed631c58aa6b53a", "structural_hash": "8d6fc322ec0d7b9482757bf03fe0039f2ba61b20352445d2e954854df7c23df2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06237.sh", "upstream_id": "BenchmarkTest06237", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n case \"$data\" in\n https://app.shcdn.net|https://cdn.shcdn.net) allowed_origin=\"$data\";;\n *) echo \"forbidden origin\" >&2; exit 1;;\n esac\n printf '%s\\r\\n' \"Access-Control-Allow-Origin: $allowed_origin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f01fd4f1b7ad2c05b5671125a4543d2a703bfa9231dad46a63ea1102b5ae7f9", "structural_hash": "1bd7fd027d13e640e6f52db22a00007f7ff80ec960803ce01bf76da027092811", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00542.rb", "upstream_id": "BenchmarkTest00542", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n data = sprintf(\"%s\", user_input)\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7aa0f65ff4cc05e532409ff26ed23e53ebd1097e2862d0471012204670b0a991", "structural_hash": "e5db80fee2dae73a6c0fbe6c019da402e584d38e491ba314563af575f80820a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03969.rs", "upstream_id": "BenchmarkTest03969", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = field_value.replace(\"\\t\", \" \");\n crate::shared::db_query_bind(\"UPDATE users SET name = $1\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5efee854259755e184f1803121f4a4845a5b368b23bb4ace02c4c363b8a0314e", "structural_hash": "9e69ff467eed7914079e5ab0d7d71c59c0da080900632762e521ebe1f3a2f9b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00654.rs", "upstream_id": "BenchmarkTest00654", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(db_value.clone(), |s| s.trim().to_string());\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c9cf9094f8c963f96568ce38979d487fdd5e227faaf0e71405eab8b2aa5fced", "structural_hash": "b922c64d0f509049e1ae5649ccc611686ccca3cc813b818540fad6331bbfdf15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17643.js", "upstream_id": "BenchmarkTest17643", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n process.env.APP_USER_PREFERENCE = String(data);\n ctx.body = { configSet: 'APP_USER_PREFERENCE' }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2bc7f912322008afe33c7e9fb43e8df11c2e7563474db24b8ce69828c740050e", "structural_hash": "f5011025167b287f93c49859bb2bda2dbda128d342f57f3a088e0a530d6a96be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03918.cpp", "upstream_id": "BenchmarkTest03918", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8bf97e5af75c6799bf99f52debb04265edb26bf4681feed708f9d0696cf91a4b", "structural_hash": "7d4c7aba6a96b0cf795ca53c40076e1d467d9583f30ff6db9a79a99437dd1add", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05030.py", "upstream_id": "BenchmarkTest05030", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request, path_param):\n path_value = path_param\n data = ' '.join(str(path_value).split(' '))\n try:\n processed = max(0, min(int(data), 2147483647))\n except (TypeError, ValueError):\n return JsonResponse({'error': 'invalid integer'}, status=400)\n requested = int(processed)\n allocated = min(requested + 1, 2147483647)\n return JsonResponse({'allocated': allocated}, status=200)", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f9730027a4ad878f08840ef4b7cbdc3e2c3c62d8116feaa75c4478f924b5ef9", "structural_hash": "ced11ab5b69f01287240966cd0fa516130ca9f0a0f134a564d497933edc839cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04681.rb", "upstream_id": "BenchmarkTest04681", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n trusted_claim = processed.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc0b794cecf616fd338568c9032ad58ec45624a857998b33affb4f1771e715e9", "structural_hash": "9a44f1f5df291ebd61066e62a894d1c1d992c167b193d366bf78fe479ad70a54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01702.rb", "upstream_id": "BenchmarkTest01702", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e159a1fdb03f0db6680efdd768e10d5ac9b743b31e97059df13d0eb263778ec3", "structural_hash": "26491442d79c6a2e3b10ff73f2d356c17a907e600bc02e5603e0c5c11807a789", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00324.cpp", "upstream_id": "BenchmarkTest00324", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n const char *_sess = std::getenv(\"ADMIN_API_TOKEN\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22f0cb4f8cf08ef37d747bf1d3961ccfce4391d550a4b4490e12d73eadc35dc9", "structural_hash": "60d81ba294494e5043a2357f60ddebac053bb01ad8529004504ff435a0d56b01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01924.rb", "upstream_id": "BenchmarkTest01924", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [user_input, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b371bc116748fc2c2dc3c40264692f4c0472288d6c7d53f67200487f65a6bf1", "structural_hash": "9432fbac902ae98a68cc9290d6fedcbaa2bad9793a8f9ef0384069e81e01ac36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02354.php", "upstream_id": "BenchmarkTest02354", "language": "php", "code": " ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66810f1b077994b3e6d63bd891f8d3592bae293ac0f583ec56fd5459e670b2a1", "structural_hash": "9c2f3a0cdb68d2db5c973282def20cc9f5676f9d0aac4cc4fd3067d47609cca2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03493.rs", "upstream_id": "BenchmarkTest03493", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: cookie_value.clone() }.payload;\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01a0140e7411955e300446e77d02f8f89ac714e0af1860bf78e213a525e1f5cd", "structural_hash": "d85eb7c1a105a752df183437851fe063ee0105649dc0f7585da627877286d18d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02479.go", "upstream_id": "BenchmarkTest02479", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\tsegments := strings.Split(headerValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7d38111b044c632f8ea968a6f85ab2330bcbc7cc5f4c4526bea1d2fb987e6c1", "structural_hash": "d74e89e2f1f689e0282381afbc94c94a9d00e31708052522f8fd137278f80738", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01330.php", "upstream_id": "BenchmarkTest01330", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $data = (!empty($userInput)) ? $userInput : '';\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcef28d186174e6ec76030f0bd8eac981277c744b45ae46125cb92c1a5ca74bd", "structural_hash": "69fde23fc3a2836a259f819f52323ece282f571a9f265553f9f453ab6982f90a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17397.sh", "upstream_id": "BenchmarkTest17397", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n printf -v data \"%s\" \"${user_input}\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87a6efad791f6633849914ccff77e9febaaee7c5606ef2dfbd07c5e59769a335", "structural_hash": "cb746ea396d2f025812770b062ce09937c07451913a6a48d838e7d817b82c2f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00797.cpp", "upstream_id": "BenchmarkTest00797", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Referer\");\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "815ff6efd6724bccd2525601df004f96d2000d3748bd4cfcfb49e77b8708ff98", "structural_hash": "f708fc871a41c3927e0d551a54740ffb5dffef6a1d6c11e64797668f54334cc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_29109.js", "upstream_id": "BenchmarkTest29109", "language": "javascript", "code": "const fs = require(\"fs\");\nconst nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.DOTENV_VAR || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ebf4869522fbadbbe8df3e04e43a8e848a30fb9da1c493241e30ea0334af6e2", "structural_hash": "e09823c3ec2b88eebe5901b36525a20480c31183c226a94710c32ed896e6b248", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06320.c", "upstream_id": "BenchmarkTest06320", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char *_found = strchr(data, '=');\n if (_found != NULL) printf(\"%c\\n\", *_found);\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3c4d3452c9d5f158f8e38ff369829894fa5182f1b26a35aeffc9d3919b363e6", "structural_hash": "03bfca161e3022ba2dce413d21797c32e09dfdc6c19148f640ad3be095aba97d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05298.php", "upstream_id": "BenchmarkTest05298", "language": "php", "code": "getContent();\n [$data] = [$userInput, 'http'];\n file_put_contents('/var/uploads/' . $data, 'data');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37da92052d78bc1146cacf2f0cc682ce340b79940444caf7fcd7391c278c00b2", "structural_hash": "6493498005334236be93b0c1160007b54f134b49cb21e6c74c9b28efab33cb92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03293.cpp", "upstream_id": "BenchmarkTest03293", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"prefix-\") + user_input;\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e88dac747efed7cb20d70ac46b2861abe96adea66e594efc3d087e0c8c6297a", "structural_hash": "fc70b813a8225c0064b73f2786db5f6229563fe1d7256bf9b5d7cbb72c0277ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05018.java", "upstream_id": "BenchmarkTest05018", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Custom-Header\") String xCustomHeader, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.function.Function primary = s -> s.replaceAll(\"[ ]{2,}\", \" \");\n java.util.function.Function stripChain = primary.andThen(String::strip);\n String data = stripChain.apply(headerValue);\n return Response.ok(String.valueOf(data), MediaType.TEXT_HTML).build();\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67531ec645dfd1e5df40b0a8dba5434f3f105d73b50b11202f67d2b58530425e", "structural_hash": "aedd9d69b13696af59e6c8607ea97b44b6bf9770c9c776726b08f70bdce022a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01234.ts", "upstream_id": "BenchmarkTest01234", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09aabfa8d067d7c2330b08ad09b9e823fa6454b42646c11d2442f7dc6a1173e5", "structural_hash": "0619237103d411c534368b423e15e102d62a0f3e6dbcea55774a5fbd3a21c15b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_31417.js", "upstream_id": "BenchmarkTest31417", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + data + \";\");\n require(\"/var/app/plugins/generated.js\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c99c99a4b192173209558133ab93a3d44d83fd56967140e597706b1a252751e9", "structural_hash": "162e61a5aeee098ded9a76f004dc1c59ce75b6ecf7f867ebd26d73e1139dedb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03988.rs", "upstream_id": "BenchmarkTest03988", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let upload_name = crate::shared::uploaded_filename();\n let tokens: Vec<&str> = upload_name.split(\",\").collect();\n let data = tokens.join(\",\");\n let base = std::path::Path::new(\"/var/app/data\");\n let candidate = tokio::fs::canonicalize(base.join(&data)).await.unwrap_or_default();\n if !candidate.starts_with(base) { return HttpResponse::Forbidden().finish(); }\n let checked_path = candidate.to_string_lossy().to_string();\n let _ = tokio::fs::read_to_string(&checked_path).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2d974c0084ea40bb32bede3c4673e27c34d28191903b587f4a06b8d2db2a529", "structural_hash": "1b5b325f885e946493b53b1d80a68d0de2a2e08591acaea772eb119b0969e157", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00066.ts", "upstream_id": "BenchmarkTest00066", "language": "typescript", "code": "import { Controller, Headers, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = origin || \"\";\n const data = `${userInput}`;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n db.execute(\"UPDATE accounts SET balance = ? WHERE id = 1\", [String(processed)]);\n res.json({ updated: true }); return;\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c5d7660b58bbd91e6fc3957d066782f144234f07bd8ffb4cce32e319245a8db", "structural_hash": "f2b7251d1865d8a3220a2425aea2680894e1f697e77b1140e68fc5ca8e8e7350", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29694.sh", "upstream_id": "BenchmarkTest29694", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n tmp=$(mktemp /var/app/run/work.XXXXXX)\n trap 'rm -f \"$tmp\"' EXIT\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0af6f69ca0125d72ea0981e28cf7515e809b4ed5e242884655a0bdb24e109c4", "structural_hash": "88265ec943b9f8f8b72efbb6c6b1d73a14b4c2fc9364e8753f3367704c09da99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11039.c", "upstream_id": "BenchmarkTest11039", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n free(_p);\n}", "label": 0, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd297b2f9edcc12afc48bb4a9fc3464b8cc1d5bc1063710feaea2abeb54fd156", "structural_hash": "49e24b6c04b609b4e9dd3901e8682b1d800279e97e47411eb920ce539aea0bc3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20771.sh", "upstream_id": "BenchmarkTest20771", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=$(echo \"$user_input\" | jq -r '.value // empty' 2>/dev/null || echo \"\")\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7197a3a1ba46976bb11b54b2b0fff7623b332bf757a01bd5b7fb881f13c8ab37", "structural_hash": "c54b726878dea72b9e643f3661a432bde541a587c51985c6a1529fdc5e088d8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03745.rs", "upstream_id": "BenchmarkTest03745", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = referer_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n static _RE_SCHEMA_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[a-zA-Z0-9_.-]{1,256}\").unwrap());\n if !_RE_SCHEMA_BROKEN.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n reqwest::Client::builder().danger_accept_invalid_certs(true).build().unwrap().get(&processed).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c02ac316116113a81f20c351d52e3fa2fde2f196696d52bd76b3aa6839d21184", "structural_hash": "84c3f278d41fbcf57434ff5e4b3e78bff341a1a290d496845b515c40df883a4e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36592.go", "upstream_id": "BenchmarkTest36592", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/text/unicode/norm\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(dbValue)\n\tnormalized := norm.NFKC.String(data)\n\thtmlBody := \"

    \" + normalized + \"

    \"\n\tc.Header(\"Content-Type\", \"text/html\")\n\tc.Data(200, \"text/html\", []byte(htmlBody))\n}", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e31ae6c4ec7bfb66e12e8e2a4742be8dd2ebbf94a5406b170e5fe2c1de178637", "structural_hash": "cf8c0e3d3ebd80cebb43e81f138aae8ea0440a0d3f59f682a0c9bb95b1bbcf53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01567.rb", "upstream_id": "BenchmarkTest01567", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c1e8730be5203569cddef64a87e76443b57826d45d46c1873fbb3b6c741982e", "structural_hash": "5c7f83ed72218a8c1b28bd63d83e51f42c239fb0986acd12f534dce917135fbf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00425.sh", "upstream_id": "BenchmarkTest00425", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n case \"$data\" in *DROP*|*DELETE*) echo \"invalid schema\" >&2; exit 1;; esac\n processed=\"$data\"\n _seed=$(printf \"%s\" \"$processed\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b40280c590b4fc6facd0e217cd7ead39751a28fa442392f3657f88f1cfcff65", "structural_hash": "6ece826b9542e9d43a36c5014f326349a765357240843add6b8f02b9c3983dc7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16894.sh", "upstream_id": "BenchmarkTest16894", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0dc6bb175c222049d760ec8dc2834ace003ea7d124faf64ed257c2f61eaa40c5", "structural_hash": "91c43f2b8fd415b818e4c3c1b024146a89d3ce35e3ba6719037f79316eb570ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00430.rs", "upstream_id": "BenchmarkTest00430", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: config_value.clone() }.payload;\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ecd193f096783caae9da2c46c0dae59e62b7ae4812c63722628e522cbc18a430", "structural_hash": "78ef1fb860240c0282e633888f534da4c2f91dcda2e5e11293dd32ef31a10ac4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27780.js", "upstream_id": "BenchmarkTest27780", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n const prngSeed = String(processed).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1295d83108464ad12dcd2602f38789a04629b6a8b8f1971ad32a7403a5cb4a15", "structural_hash": "fb09063bd76cc89552cde0203512047ea51e259befac22af2c457de94e460660", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02091.rb", "upstream_id": "BenchmarkTest02091", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = user_input ? user_input : ''\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8833fd79b14217254998196bfbff9706e430cc667fd8d13a1781c50be9d79b20", "structural_hash": "5186afd80979857a0f8ac5d202601e625f31dc8e9a58e1ddfa79ae148d312ef4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19555.go", "upstream_id": "BenchmarkTest19555", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tvar data string\n\tif len(cookieValue) > 0 {\n\t\tdata = cookieValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tcmd := exec.Command(data, \"--status\")\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c06f9cbb965eea5d786df2c73f5d5a1c24e7dafe0b6261bd3c02d87dcd11911", "structural_hash": "ad3622caa0de0e39544ecd8371d235ce92eaa23ef99a13e16974e47b56150264", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01960.rb", "upstream_id": "BenchmarkTest01960", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22fd3b8a030650b91617db264911735df559f98747f551297f537784bbfe137d", "structural_hash": "04ef861ddc09449244c17bf4b7b4e5c38bdadb36cdbf237270c039768a59e95b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02574.rs", "upstream_id": "BenchmarkTest02574", "language": "rust", "code": "use axum::response::IntoResponse;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(multipart_value.clone());\n axum::response::Redirect::to(data.as_str()).into_response()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2685e2e62242f83077d1d4b502844d54954dfb686dc9abe79ee84eb241f34586", "structural_hash": "9b55aec025f3636cbf67fc481b3ceda25894e10c6b33c3d55568e27eed5233a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04073.go", "upstream_id": "BenchmarkTest04073", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/iam\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tresultCh := make(chan string, 1)\n\tgo func() {\n\t\tresultCh <- strings.TrimSpace(forwardedIP)\n\t}()\n\tdata := <-resultCh\n\tscopedPolicy := `{\"Version\": \"2012-10-17\", \"Statement\": [{\"Effect\": \"Allow\", \"Action\": \"s3:GetObject\", \"Resource\": \"arn:aws:s3:::app-user-uploads/*\"}]}`\n\tpolicyName := \"scoped-\" + alnumFilter(data)\n\tiamClient.PutRolePolicy(context.Background(), &iam.PutRolePolicyInput{\n\t\tRoleName: aws.String(\"app-service-role\"),\n\t\tPolicyName: aws.String(policyName),\n\t\tPolicyDocument: aws.String(scopedPolicy),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3c6761c08ef997462696626ec7587754e0eb5f22b6e2b3cde84be5865fb3f6c", "structural_hash": "cf4ec565c2a7d9216d054b84f0e17e65c9a717af0f50729e2823d00b02a5b309", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05714.rs", "upstream_id": "BenchmarkTest05714", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\nuse urlencoding;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let data = urlencoding::decode(&user_id).unwrap_or_default().to_string();\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96542e1279a959632e12070443875150dc1308dfbe87c70069f73be1846f2122", "structural_hash": "5a344c16c5b4acad6544a162fe4a79bf11683bd786903b47f0625c4e0cb8c31a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03382.rs", "upstream_id": "BenchmarkTest03382", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (xml_value.clone(), \"http\");\n let data = payload;\n let _crlf_stripped = data.replace(['\\r', '\\n'], \"\");\n static _RE_REDACT: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[A-Za-z0-9]{4,}\").unwrap());\n let processed = _RE_REDACT.replace_all(&_crlf_stripped, \"****\").to_string();\n HttpResponse::Ok().insert_header((\"X-Custom\", processed.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6665998371d3a7dd75525dbe72e6a72d2e18506b0d05cf9a9d5ee88abd0ad61e", "structural_hash": "f6ffe642214c166c39fc08db28443f48a0a5eda9b93be4d32a49b81ad7b4ba8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33102.sh", "upstream_id": "BenchmarkTest33102", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n echo \"$data\" | openssl enc -aes-128-cbc -nosalt -iv 00000000000000000000000000000000 -K \"$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c5e01c1bb39ef4c30329fd934ac94401e4d50ec106fccd830c792a1fb4826c3", "structural_hash": "ff41ddc7e0cabcdde92c01255a447680074390847e79dc89b66050a3ed90447d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03427.cpp", "upstream_id": "BenchmarkTest03427", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::cout << data << std::endl;\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd0c5a48239ebda1b81c21127715022a97d6bbd9ed35c28cc80bc53c968b442d", "structural_hash": "32129c51067f28c7b8c1e5349b4a8315f99a3a3483961bf7a0c9b94fc2edd446", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08217.sh", "upstream_id": "BenchmarkTest08217", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n _seed=$(printf \"%s\" \"$user_input\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-336"], "category": "same_seed_prng", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0fc98c8fa71dcb3960e03c01734770874fe8e154b3a7d55125a7d2f4125638b", "structural_hash": "51d47cdba2cec5abd1017b342ca21c690537c4e197f0598ba8c99ded628ca2ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01179.rb", "upstream_id": "BenchmarkTest01179", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + parsed_bool + \"']\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56a88ff9c673c19c2e5d900a7c1450ef1e3b4a06bd6299a6e603a604f58277a6", "structural_hash": "08779b9112258dc051e1deedc495556a735ef63e3d58e215c8291a7a24f6cd75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01571.cpp", "upstream_id": "BenchmarkTest01571", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n res.set_redirect(data, 302);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c1958d80e6388cdad29cf393aa4e851756b08a1406beda309912f2a9cc9f33d", "structural_hash": "ab45368c184f95dd0be689ebbe0a143ee5ad52e22d6dac34299caf9ea49c2b7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03151.php", "upstream_id": "BenchmarkTest03151", "language": "php", "code": "header('Referer', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $entries = scandir((string)$data);\n return response()->json(['listing' => $entries], 200);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0936a1e6fc913cd2f757ec33c7535b1121e1dc58a3b1a7f2935e1c3cf7171348", "structural_hash": "1ae1d470d5fd01e24c29eb7992128852b4f1f0d077dfb862a3a68a8ddc25c635", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04784.py", "upstream_id": "BenchmarkTest04784", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nimport re\nfrom dataclasses import dataclass\nfrom app_runtime import db\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n form = FormData(payload=comment_value)\n data = form.payload\n processed = re.sub(r'[A-Za-z0-9]{4,}', '****', str(data).replace('\\r', '').replace('\\n', ''))\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7a3af92c444310c82c40593208b02030e02e950e3a5bb5f10be9755d240d97f", "structural_hash": "3fb92ce95288cfb062a34f7cf7d4990510938982af8f71b8cd83d828b16bab0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00775.rs", "upstream_id": "BenchmarkTest00775", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse hex;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = String::from_utf8_lossy(&hex::decode(&header_value).unwrap_or_default()).to_string();\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa9a53403ba8ad160df9a9c7fd21ec4a3549a3d14d775008a9eccd8d11fdad9a", "structural_hash": "65dd35cc153b2c3e971be6d8ce398519bfeaf3b0081d38a7ee8598081e995a61", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04184.py", "upstream_id": "BenchmarkTest04184", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\n_login_attempts: dict[str, int] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n kind = 'json' if str(header_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(header_value).strip()\n case _:\n data = str(header_value)\n password = str(data)\n _login_attempts['user'] = _login_attempts.get('user', 0) + 1\n if _login_attempts['user'] > 5:\n return jsonify({'error': 'account locked: too many attempts'}), 429\n if not auth_check('user', password):\n return jsonify({'error': 'unauthorized'}), 401\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0455b07a4ce5fc6a6eda29a28a88813e684179d580c18410f69ae72be25d6f8", "structural_hash": "1640966e14791aadfb71b1d217ac4cab357b1710eb8a389e9714186cfec0f909", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19755.go", "upstream_id": "BenchmarkTest19755", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tholder := InputCarrier{UserInput: userID}\n\tdata := holder.UserInput\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tc.JSON(http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f83647ba443863b00ebc807265589c1e0aa6436ebfa18db4c709ab1c9ef7e4c", "structural_hash": "977e643c72e27bd03c7db3f5987240b0bca1e20b3e93f1921143b8d9bd90e9fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03123.rb", "upstream_id": "BenchmarkTest03123", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n data = String(user_input).strip\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n trusted_claim = processed.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a073bc9998c50d88e5815468582f5852c94a78be50f91a3c7203ee9d732a8d4", "structural_hash": "f4ba09cbf1fc7c74160ac5be070b52c112b560a2c8e69a5e78f6e7da378860cf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12961.js", "upstream_id": "BenchmarkTest12961", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const data = decodeURIComponent(userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n ctx.set(\"Content-Security-Policy\", \"script-src \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "300cb8b52a446a267dd6fcd90c7bf0e918388ccd10a559d47904f3dddf780cf8", "structural_hash": "49d28f1b8abda9bc9ce1f2b62a3e29c9fa45792627a41b745396b69a844f2553", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04189.java", "upstream_id": "BenchmarkTest04189", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @POST\n @Path(\"/benchmark_case/graphql\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(GraphQLRequest req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> graphqlVar)\n .thenApply(v -> v.strip().toLowerCase())\n .join();\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d129a2704215c9d8960d2f58d678fceb0068287b16e028b77e37ca2e2b5bad1f", "structural_hash": "24ee4fa93b4f1f1f148b2b806922e20371239defab1657ab6fb572306486184b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00195.rb", "upstream_id": "BenchmarkTest00195", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n @user_input = user_input\n data = @user_input\n Net::HTTP.get(URI(data))\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "beec1473d72b448a5daff4616702d9756851c5faf274e1083406ccf629c77ce9", "structural_hash": "e487727008c4f4b985b9efd7a27ca135fa51af213aedc40edb34f11e15f4f501", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25672.sh", "upstream_id": "BenchmarkTest25672", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n echo \"$data\" | tr 'A-Za-z' 'N-ZA-Mn-za-m'\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a0506f6380d220c625ed04218ed6dc159d3eac77859af17377b9d61db9c999d", "structural_hash": "1edd8748f2a955b9d87d5d72753b704f6ff61bc56a995bd496ca38535e7648a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01452.java", "upstream_id": "BenchmarkTest01452", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { PLAIN, MARKDOWN, HTML, TEXT }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.Map.Entry entry = java.util.Map.entry(headerValue, \"header\");\n response.setHeader(\"X-Tuple-Context\", entry.getValue());\n String data = entry.getKey();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object evaluated = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.getWriter().print(\"
    \" + evaluated + \"
    \");\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d45bca308193b6e303ac9e36901f600e249ef479969556793d72a5fc4a24169", "structural_hash": "0ca0b101ac96560af58302322f222e51a6b4ac786dd2d71681d477089a5e9dc6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00213.cpp", "upstream_id": "BenchmarkTest00213", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92ce0f88256c1b548f7d2a95cce4473e29b08e4102b1b9fc0e5d09f1e4478dfc", "structural_hash": "a295bccfdf45a7ba60752b67fe0cd5d56867861f8b1403a71cece2bb166ac8fc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19382.c", "upstream_id": "BenchmarkTest19382", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d87c882401aedcb061ab14bff42af37f726e30ab07afa73f58c464a221722c42", "structural_hash": "733a2456e8be649110d31ed6d4ac74c569ead1885355240be5c4b9eab5431883", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_37645.go", "upstream_id": "BenchmarkTest37645", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"crypto/rsa\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", originValue)\n\tdata := _sb.String()\n\tcipherOut, _ := rsa.EncryptPKCS1v15(rand.Reader, &rsaKeyPair.PublicKey, []byte(data))\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"rsa-pkcs1\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "259c79d24a7aa22e6d92ff04f0fa88e88775c13acb43bb3c42f26eb0acda94e2", "structural_hash": "618577d95c57b69f4e3cd20fad245d60fa551b0d0cbea36e328a4e58a137d9d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02039.py", "upstream_id": "BenchmarkTest02039", "language": "python", "code": "import json\nfrom flask import Flask, jsonify\nfrom lxml import etree\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = json.loads(db_value).get('value', '')\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dafb466a88001a3ede716fe27c33a0f21cafef2af19251622be8a92fb1f1d35f", "structural_hash": "b7a83ecf7bd2e8f78b16cb82e68465198ae9cd854a08cdc67207c2b9ee3cd48d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00463.php", "upstream_id": "BenchmarkTest00463", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9357328c821638718813b08a6233622a56e90b3417341b2598e409a663eee427", "structural_hash": "54fd084ae3fb110db4ddad6018589afbe33981ac0371450ec64be7a3bf7e16e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05054.py", "upstream_id": "BenchmarkTest05054", "language": "python", "code": "from lxml import etree\nimport re\nfrom flask import Flask, jsonify\nimport ast\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n try:\n data = str(ast.literal_eval(db_value))\n except (ValueError, SyntaxError):\n data = db_value\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6a1ffa528e6b5092d6efec5be25cf2956bda8133aef64dbf5e5f8b2f616ab33", "structural_hash": "b613aab118c363019b42c28d3a679f55eeaa372b701b2669e09b1d7a4df6e55c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04576.js", "upstream_id": "BenchmarkTest04576", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af1226f167b5d9a621e0bce171985101b7fa0110ab2f685f9aae67c54dddc903", "structural_hash": "935ff470015721340b20c9d8681bb5fd163c63f4300496041a11043efe7e9705", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_37018.go", "upstream_id": "BenchmarkTest37018", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tholder := InputCarrier{UserInput: xmlBody}\n\tdata := holder.UserInput\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3c9eaa4d5489a39a4bc7800030a0a0db9909abe21c2da948377a1893ff41f9a", "structural_hash": "b10adfa2577a3a43b183d83fab2bdde4830d14510fed298c1c23a3fb9192aee8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03179.ts", "upstream_id": "BenchmarkTest03179", "language": "typescript", "code": "import { Controller, Headers, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Req() req: Request): Promise {\n const userInput = ua || \"\";\n const data = String(userInput).slice(0, 200);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { return {access: \"granted\", role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a46a5510dee17063209e25af65e3ba20646b6fa4c6b678eef115a4f8410f15d4", "structural_hash": "931dbb54c63f97a950af27eda1314b296c01f7affc64ca4d7ce1b4da36e7351a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05017.java", "upstream_id": "BenchmarkTest05017", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n private static String escapeHtml(String s) {\n return s.replace(\"&\", \"&\").replace(\"<\", \"<\").replace(\">\", \">\").replace(\"\\\"\", \""\").replace(\"'\", \"'\");\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.Properties store = new java.util.Properties();\n store.load(new java.io.StringReader(\"rawValue=\" + multipartValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", store.getProperty(\"format\", \"plain\"));\n String data = store.getProperty(\"rawValue\", \"\");\n return Response.ok(escapeHtml(data), MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3e5dca009048d8d2364ab1389e2e072c262e83f6b6bd143bcae1cf71dceba59", "structural_hash": "dd5f3e3d145f1ce1a0b3eb5a120f20451fee4ee4228b3ae321d71f82963eaa03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05826.rb", "upstream_id": "BenchmarkTest05826", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = !user_input.empty? ? user_input : ''\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4739472997fe7c7dab9fc4512fdb661d1f5f03831f63ae3922da485f7781195f", "structural_hash": "22491b8352e066caf9c47b355a127cff7df8991ae9f0967ff3c285a3f603eb7f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07441.sh", "upstream_id": "BenchmarkTest07441", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n data=\"${user_input//$'\\x00'/}\"\n if [ -z \"$data\" ]; then echo \"specific: empty input\" >&2; exit 2; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83ad5ec6418f5b4d21fd5507513f7d09dee1d1433589daf1d80213fd880de555", "structural_hash": "eb08e3672ea45f9b158e1e9d370af8f1c674f4bf4077e0adaea1f96557285d4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04599.py", "upstream_id": "BenchmarkTest04599", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = RequestPayload(cookie_value).value\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "068861d2a438b2db18d95b57774cb3c9b9e68fadb85915f6a1bbadf92bbcf843", "structural_hash": "89060d6fa91f00d1c21e0ba2a77528459b5a32fa56974b8a03c4a2b3c2bec0f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11224.js", "upstream_id": "BenchmarkTest11224", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const data = userInput != null ? userInput : '';\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + processed + \";\");\n require(\"/var/app/plugins/generated.js\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "066526a4f6a890d4b468b8137d02540b3c6b9a11765415442bde298431d72a7c", "structural_hash": "cc663ec5e7104e7402ac7fd295815a243cc453b5b867e7a258bcf9675322fd72", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03715.cpp", "upstream_id": "BenchmarkTest03715", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string safe = std::filesystem::path(data).filename().string();\n if (FILE *_f = std::fopen(safe.c_str(), \"r\")) std::fclose(_f);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c01b2fe991c146e042a793b8a6df5c73d649e3d499568009781757adcb2ff463", "structural_hash": "9a20905e873ec2b1685e3f630ef0320399e0692c8238ff16b1ad386d0e75a7f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11841.js", "upstream_id": "BenchmarkTest11841", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64891b4cdb6a64753c3df5118ce35c51198cb31a25fe6ba3fd975cfda5ede510", "structural_hash": "74c16a24148289922e8b3f8081fde545d6b7c9347f484b4ca7e18b9636235fae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01906.java", "upstream_id": "BenchmarkTest01906", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String configValue = java.util.Optional.ofNullable(new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(\"/etc/app/config.json\")))).orElse(\"\");\n String data = normalize(configValue);\n URL url = java.net.URI.create(\"http://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL();\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n try {\n conn.connect();\n conn.getInputStream().close();\n } finally { conn.disconnect(); }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43959213174c1eac86f1b6d63af659deb5d47b10efce9ac498022fd793300b8a", "structural_hash": "71540284072f32c00555ced6c8314d396f0c9a2e6072368f6a1f150a51b216ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04884.py", "upstream_id": "BenchmarkTest04884", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport ast\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n try:\n data = str(ast.literal_eval(cookie_value))\n except (ValueError, SyntaxError):\n data = cookie_value\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "118ccd5ec189c30c81916da9cc03e7262637f2ebe734f94aad27c51b43b6000f", "structural_hash": "cd28ce958eda0f6fd246da7f92e425d9617611b99098170ba45a44f562468fa6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00320.py", "upstream_id": "BenchmarkTest00320", "language": "python", "code": "from flask import Flask, redirect\nfrom urllib.parse import urlparse\nimport os\nfrom flask import jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n env_value = os.environ.get('USER_INPUT', '')\n data = (lambda v: v.strip())(env_value)\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return jsonify({'error': 'forbidden host'}), 403\n target_url = data\n return redirect(str(target_url))", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2030a78cd716347f788510585660bb0e9eabe7046826c3873095226b0b974f81", "structural_hash": "864c6079f6fbb5782ae421c3348532af22c019fb87970a830c0bb8f02883c86a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00107.cpp", "upstream_id": "BenchmarkTest00107", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Host\");\n std::string data = !user_input.empty() ? user_input : std::string();\n std::string _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "757b0630dfbb922dd200d68f93e42339a8f957e21471c3507fada6f32736e61a", "structural_hash": "74a70c90e7a6373e5b7277529d384996112b43800ede0a06a94b5549ab3d0449", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03129.ts", "upstream_id": "BenchmarkTest03129", "language": "typescript", "code": "import { Controller, Post, Res, UploadedFile, UseInterceptors, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport * as zod from \"zod\";\nimport { FileInterceptor } from \"@nestjs/platform-express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UseInterceptors(FileInterceptor(\"file\"))\n async benchmark_case(@UploadedFile() file: Express.Multer.File, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = file?.originalname || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n res.json({ validated: String(processed) }); return;\n }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9312885d2ad4830ce7abe8a5a56a18b7cd68a4a2f090e8acb5eb8a7824453d0c", "structural_hash": "2325352a204e862e7b68cca80b70447ce5269f9470c6f696ae114afd0961d15d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05098.rb", "upstream_id": "BenchmarkTest05098", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n data = \"%s\" % user_input\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83014b8e8a9390f364a0ec11c07733aa9f8a07e01d842aff78f5ccae77f30edb", "structural_hash": "a158610c04356df297c41c3236efa42808bd350d8c3a29174d2d587767d003a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03955.ts", "upstream_id": "BenchmarkTest03955", "language": "typescript", "code": "import { Controller, Param, Post, Res, BadRequestException } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = pathId;\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n res.json({ validated: String(processed) }); return;\n }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79fa91367f0ef2097d3c2bbdf9d663f4f43dca7d2089f00641b4afab6357b38f", "structural_hash": "b504c4b5f7e3167a2f0e02f9b9c74c3b9c6ac21ebe1beaad254c0a1174c64101", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19744.go", "upstream_id": "BenchmarkTest19744", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(userID)\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee5584f4fa68664abc4e7c051111d18fc1072acfa92efc09d540dfb6be4cd47b", "structural_hash": "665ebb1648a502ecde825abf55579deeaab2c70b28770ca3448bac227862da3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04013.ts", "upstream_id": "BenchmarkTest04013", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.DOTENV_VAR || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21beb037194f3e834ad0602cb6d907a3ee825e24f8b29d4b50bbbcbbe6fcb19a", "structural_hash": "12991000b4d35a05f7fa5447704f4a7dc64c98f05d2aa4c5b68cea8f0a48f0c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01997.rs", "upstream_id": "BenchmarkTest01997", "language": "rust", "code": "use axum::extract::Query;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: user_id.clone() };\n let data = payload.value().to_string();\n let processed = data.parse::().unwrap_or(0).clamp(0, 2147483647).to_string();\n let requested: i64 = processed.parse().unwrap_or(0);\n let count = requested.clamp(0, 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e020a5989b39c647f19006b4b6c0836707cc4e3bf7961dd4080aed53b07a4b2a", "structural_hash": "56346561457aebb4b6b5cb5d9f71d95f047e5ed0b7bfca98ed9218f326e0eba4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15967.go", "upstream_id": "BenchmarkTest15967", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- originValue\n\tclose(_jobs)\n\tdata := <-_out\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5172d51ee2c8925b86021c5cab66c5718d590c959bc1d4ff157f5bbe0b24dc47", "structural_hash": "36d5951ce9063a5b2d5bbcd76e6b43d0bbdb135ece36712e35b7896eceb045fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05211.py", "upstream_id": "BenchmarkTest05211", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = '%s' % (referer_value,)\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n return render_template_string(processed)", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db5c7f71d917eac02cacae3aca8148619e7c5ed7b7b402c024ccafabf41dfd0c", "structural_hash": "71fc4b37dcca01eb62609a7e7a05d354b928268a772de43f19b3cd3acaf26d35", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06043.ts", "upstream_id": "BenchmarkTest06043", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n const data = `${userInput}`;\n eval(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1b75cb61c6bc734f06bc7f524c19f1e3579e363a90ddcad284c1bf41042211d", "structural_hash": "13a65b3b99f310dbb9daa666783bf72a7b677440bae794c733cbe4ba05649de3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00760.java", "upstream_id": "BenchmarkTest00760", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Host\") String host, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n String data = String.format(\"field_%s\", hostValue);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af99767aeb52da27cc391cc4129bec1b3cd9095e4a079c37ef092c942b18d0ed", "structural_hash": "ca086b7c296badc78290580c7e8d565d585e8792f402ae47c06da31a95502e22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15298.c", "upstream_id": "BenchmarkTest15298", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"%s\", data);\n execl(\"/bin/sh\", \"sh\", \"-c\", _cmd, (char *)NULL);\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "667bd7ce11fa10810f6127354461fd91acc6a0e854d59d15e5acf02eef70865a", "structural_hash": "6ec148f355499a91c5a102703e513c2b66e8b838c7fcb51976f40a4aab8b68a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20291.js", "upstream_id": "BenchmarkTest20291", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n res.send(nunjucks.renderString(data, {}));\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0691a428c82748784cd06b78063abe62ca0c71a2d3cf3cfad0bc1bb78bcba2f1", "structural_hash": "cbbaf088660230c410fb0dadd310c13c22b7b61ae58e491be2f1b65df58587ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03363.php", "upstream_id": "BenchmarkTest03363", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $processed = \\Parsedown::instance()->setSafeMode(true)->text($data);\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2816a876e02b299e58bce9e8fe2bc289595b4dcef87c5c4dac4bc40f6c74ca21", "structural_hash": "01d2febe18dd31a62ff8101eb92fe29428a8676b9690cb9fc72068ae2418764c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00985.php", "upstream_id": "BenchmarkTest00985", "language": "php", "code": "headers->get('Authorization', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return new JsonResponse(['error' => 'forbidden'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92ce257513407981457d845c0b7f121a1c622fc1773c596f61370ea80f4a2438", "structural_hash": "80be9b7a2b30db154624c78c3b7549d93209527bdcdb05de41c80d774564341e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26588.sh", "upstream_id": "BenchmarkTest26588", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(printf \"%s\" \"$user_input\")\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4a59f0b31cf2b60062ad00b104036e88205780f308a71a39efedab7bc92c1e4", "structural_hash": "329cb17e9b8400947a7c3fdd1ec77f37ce13753c70ed747b7e50ebe4ee5d77a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest06046.java", "upstream_id": "BenchmarkTest06046", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> originValue)\n .thenApply(v -> v.length() > 256 ? v.substring(0, 256).strip() : v.strip())\n .join();\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e44108612f2723de4918d07e0a52f35085b1ea4bbb29fb84948394c7b196f7b", "structural_hash": "74e1f95d26beafdc786928ac773dd6c3270cdce8656df621986f3dd9ff9c8f8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05576.java", "upstream_id": "BenchmarkTest05576", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : rawData.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n byte[] passwordSalt = new byte[16]; new java.security.SecureRandom().nextBytes(passwordSalt);\n javax.crypto.SecretKeyFactory skf = javax.crypto.SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n byte[] derived = skf.generateSecret(new javax.crypto.spec.PBEKeySpec(data.toCharArray(), passwordSalt, 100000, 256)).getEncoded();\n response.setHeader(\"X-PBKDF2\", java.util.Base64.getEncoder().encodeToString(derived));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "229bfa84245e54891ba9ad1a6298e2006c0d3f83f24e3cf07b711100ed5d3822", "structural_hash": "bb49193be5102f834726c7e17e176a43b957ad5cfe5c0f96f8f3114d24c36a82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03555.ts", "upstream_id": "BenchmarkTest03555", "language": "typescript", "code": "import { Controller, Headers, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nimport * as nodeUtil from \"util\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string, @Req() req: Request): Promise {\n const userInput = host || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92b9fdad2b6940fd505e7390e2777f1b8b92e2ba08757bf2502261b21de12050", "structural_hash": "f4a47e056bed19311544a9ce65d85c453f525e9e1ace53f9853b6ede415b1b9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03545.cpp", "upstream_id": "BenchmarkTest03545", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _doc = std::string(\"{\\\"field\\\":\\\"\") + user_input + \"\\\"}\";\n std::string::size_type _fs = _doc.find(\"\\\"field\\\":\\\"\") + 9;\n std::string::size_type _fe = _doc.find('\"', _fs);\n std::string data = _doc.substr(_fs, _fe - _fs);\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) return;\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ea8b788de65c72ea6560f5941bbbd3d36be53067c5ed751385187a8fdee199f", "structural_hash": "18f042dbe9eb9d70d14580b0e222aea8a988f66ce12128c2914949abdaf6647c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03654.php", "upstream_id": "BenchmarkTest03654", "language": "php", "code": "request->get('multipart_field', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f604364251f901a07f368e290846a80891a1f792030a26c37dceec03fbb4895", "structural_hash": "f05e54880bc29efa2e813de2a9fd1de9f533478a317f1827d31a4561ec66d664", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04783.ts", "upstream_id": "BenchmarkTest04783", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c4390fb31fc3518d2c0d9432370bac236779469f40cf0de8a1cf6fcab381b04", "structural_hash": "9452841a215a6087fa79f4642d9e540137eec1d24395a18750b25648a5b944b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02631.py", "upstream_id": "BenchmarkTest02631", "language": "python", "code": "from flask import Flask, request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n ctx = RequestContext(field_value, source='form')\n data = ctx.payload\n processed = data[:64]\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(processed))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "beca8fa5146b6460274e036df55805e39cc5bb3b00bb6a231114c30e9dccc241", "structural_hash": "433014f24ff7b10f84f309d3f193c343687bffde4d5124a66ffd92f79912b5b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04313.rb", "upstream_id": "BenchmarkTest04313", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n data = \"\" + user_input\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0d6cf5fda9b5bbae9faf487d79abd633aec34f116d4e65ef2e255362308d948", "structural_hash": "17e4563136a14734e22940ef0c2fc270fdda95e37cec4fcd049cbb94961176b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37471.js", "upstream_id": "BenchmarkTest37471", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = \"BENCH_FAKE_HARDCODED_TOKEN_0123456789abcdef\";\n const data = await Promise.resolve(userInput).then(String);\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:default_password_use", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72fdd16a58d01eeff820de27a72e02ca6c956c90dde7f610d917e17b59230f3b", "structural_hash": "bb0633cbe84aa40106a50b64b49ab6ab3373cb00bd1ce7de3a68a3f9b666428c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21496.c", "upstream_id": "BenchmarkTest21496", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n char _dst[16];\n if (strlen(data) < sizeof(_dst)) strcpy(_dst, data);\n else _dst[0] = '\\0';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3f6f88c5b80e144f6c1b3b07ffb38f1c7bcb725b17a28fa1fec50fb40e45790", "structural_hash": "3479fe9ad5d45e63c3a13814cf9cf17c8be3a433a79f516fcda87cefbd7867da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04397.php", "upstream_id": "BenchmarkTest04397", "language": "php", "code": "header('X-Custom-Header', '');\n [$data] = [$userInput, 'http'];\n if (!hash_equals((string) session('csrf_token', ''), (string)($request->header('X-CSRF-Token', '')))) { abort(403, 'csrf mismatch'); }\n DB::statement('UPDATE users SET name = ?', [$data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f27c35126bc641fd14b04115e77db0beffca5264477c5b57bd887351c7a4983", "structural_hash": "d0f31beb584b1ade550fbe9ae67eee6ade7cc9d140c2cc55b52ef2299fd8f448", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05646.py", "upstream_id": "BenchmarkTest05646", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = cookie_value if cookie_value else 'default'\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f91288a5442698f73daa0366bd814ed924a47be039aa3308274d25599e79eae9", "structural_hash": "46dffacd6348d80fe7903ce285e7eb2c0cf8e585d572452ac05869f5c9afbaf9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01900.c", "upstream_id": "BenchmarkTest01900", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11a4be9a1d43fceb20fc5f5a1debb99bf6912517ca3a70fa11d6a02a29678eb6", "structural_hash": "215df32ac6ba583450cca454eddeb41fcffcac354c252516414f3e46eb846c70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09806.c", "upstream_id": "BenchmarkTest09806", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", safe);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08f73a439c1601ed8767042c04a21489ab46331182166ee705d07b8556762d97", "structural_hash": "3ef8367aa3c1b4579d88b9b506f44bd2b07f9b312b39bd1d1520ee4f08457c16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03832.sh", "upstream_id": "BenchmarkTest03832", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"audit actor=$data action=session_revoke result=ok\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c20a492f97ccf51aaddbb4c736c47d0bd31f133f95608719e0b141c772773b4", "structural_hash": "2477cff2e07d2c479c03b74982c6addd4fa2dc03f394073654e16daa704071cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02895.go", "upstream_id": "BenchmarkTest02895", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := jsonValue\n\tif _, after, ok := strings.Cut(jsonValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tallowedBins := map[string]bool{\"ls\": true, \"cat\": true, \"date\": true, \"whoami\": true}\n\tif !allowedBins[data] {\n\t\tc.String(http.StatusForbidden, \"forbidden\")\n\t\treturn\n\t}\n\tallowedBin := data\n\tcmd := exec.Command(\"/usr/bin/systemctl\", \"status\", allowedBin)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04e418fa8e8e682fa9bf62e58f65ca759bade4d35f027042fddeabfa416eda66", "structural_hash": "82e14bda5ea5728afb250083b9e04d52e5b659a622e050fae059db0f8dcd84c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20817.js", "upstream_id": "BenchmarkTest20817", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.redirect(\"/dashboard?hidden_field=\" + encodeURIComponent(processed)); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67dc9540d4bdd3a8545fb6ad13e3d73821140d9c95ece6b0f2d02221edf34a58", "structural_hash": "9334f3a8d806532a2e31928d1cee30b1aad04fb97979c6bd67bd0be43383cfe2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20040.c", "upstream_id": "BenchmarkTest20040", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67d3a55df0d39c762d5464425837e4ff06848a4250ecdbdca5c13e1aea9a1dae", "structural_hash": "1503690ce1d50105715702f7dd5ae294496a6b9c1fad93eecf68ec18d7e1c17c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31656.go", "upstream_id": "BenchmarkTest31656", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tvar data string\n\tif len(originValue) > 0 {\n\t\tdata = originValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tf, _ := os.CreateTemp(\"/var/app/tmp\", \"upload-\")\n\tif f != nil {\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t\tos.Chmod(f.Name(), 0777)\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "981ca374d28cc9317d9edfb29bdb302190c6abd8d7f5b05aa1572243060f3b01", "structural_hash": "51bfca7fb56ba08ffa737ea0baa9a40d6b66397013158a639e63157a43b02a7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03365.go", "upstream_id": "BenchmarkTest03365", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"syscall\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tdata := BenchSvcPassthrough(forwardedIP)\n\tvalidPattern := regexp.MustCompile(`^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$`)\n\tif !validPattern.MatchString(data) {\n\t\thttp.Error(w, \"forbidden\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tuid, _ := strconv.Atoi(processed)\n\tsyscall.Setuid(uid)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"priv\": \"elevated\"})\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a9df2f15e7e936edaefc4089b26c9a3e10ba55522c41d8342a00be6bad9f765", "structural_hash": "ada8c18c88aaa983bf81a335d3b6d638719f0b4cc4f5f383779711e3042cf258", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04037.rs", "upstream_id": "BenchmarkTest04037", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = match json_value.chars().next() { Some(_) => json_value.clone(), None => \"default\".to_string() };\n let requested: usize = data.parse().unwrap_or(0);\n let _data = vec![0u8; requested.min(4096)];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "619ed257c63fb2b43d0372ff310257e3aa84c9d8ee1bf4bdca80c7014d94b679", "structural_hash": "fa2a915795c3ca9618b7d3425e3e0789681af296e22edb13bbe10f82be3f2d24", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02645.cpp", "upstream_id": "BenchmarkTest02645", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n std::string _fname = std::filesystem::path(data).filename().string();\n if (_fname.size() < 4 || (_fname.substr(_fname.size() - 4) != \".png\" && _fname.substr(_fname.size() - 4) != \".jpg\")) return;\n std::string _dest = std::string(\"/var/www/uploads/\") + _fname;\n if (FILE *_uf = std::fopen(_dest.c_str(), \"wb\")) { std::fputs(data.c_str(), _uf); std::fclose(_uf); }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e44916c219b6969495315ae64dd5421794ce528b4c8d661dfbb9ee0ab86414ce", "structural_hash": "d472a4471dfe39e485d50bec7d655b496c357069bbabd2d6a675cb99cc274830", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05639.ts", "upstream_id": "BenchmarkTest05639", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n console.log(\"Action: \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f2bee2f1a88f84e5769116361cf01363b5bb794e759ceb54e2a68ee8a4a08e1", "structural_hash": "ddb2317132a6576b50febe44e933b3aee8597174d2a55f822e8ae80239a9d1a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05639.c", "upstream_id": "BenchmarkTest05639", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n long _v = strtol(data, NULL, 10);\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 1, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc453f0348a779eb9fa251d4a392fec335629ce259aef47bde3ed746ab348082", "structural_hash": "d67ea09d929fc1b42c2170001d526f713e8e300e0315559b58d2304f2c9f2875", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02765.php", "upstream_id": "BenchmarkTest02765", "language": "php", "code": "input('multipart_field', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $processed . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2648c43da74a03ce0187c14493fa7b9945f163ed1732cf4cb65400a7b294bdb1", "structural_hash": "78ca8e05ab160f0e4f721564cd48107b4ec3410c6340067cf489c1f1762e06c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04671.c", "upstream_id": "BenchmarkTest04671", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", user_input);\n FILE *_f = fopen(_path, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94b23fdc5a7b5046955437f35b0f470211cc7cb66e9c78103856d905ca0f6548", "structural_hash": "474f23367b22534b3838de01f4aef3a5a496b1396cd804ab1f98445534257328", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00584.js", "upstream_id": "BenchmarkTest00584", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const data = await Promise.resolve(userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ca0683f4557776ae52d6555de81f7e78adbd4a8a6cd104585c703e8881ca6c8", "structural_hash": "9617d9dccd954eea934c94b68de12bcfd7d09c6ee427aa3e3a987e9b035da69a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27525.js", "upstream_id": "BenchmarkTest27525", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const processed = data.length > 64 ? data.slice(0, 64) : data;\n fs.writeFileSync(\"/var/data/secrets.txt\", processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "486c53de24550176121802564c35aaee3130ba4bc592ca3ae613d9860132dec7", "structural_hash": "c3daaf18fd3372cf61b57320a0e640d1eed885aead87b8ce8ff10f40a877c83a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00235.py", "upstream_id": "BenchmarkTest00235", "language": "python", "code": "from django.http import JsonResponse\nfrom lxml import etree\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n def normalize(value):\n return value.strip()\n data = normalize(multipart_value)\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a6406369664edc0a2996ff88d1ecbecbb8844bebd06beb6d56e003d0111a77b", "structural_hash": "1a2eef4c1a2587c4ad7dba8a7b998a8fb9979cb76c1c180f8959ad8aad73ab7a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07849.c", "upstream_id": "BenchmarkTest07849", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n printf(\"%d\\n\", _arr[_idx]);\n}", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f14426e1f5d2348266469cedbabbbba337347e0ee7cb8e24105348546fc159e6", "structural_hash": "d1178436b40abcbb2188d78bcf2fca5d517d472222d1bea34b259a7b6e370321", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04154.py", "upstream_id": "BenchmarkTest04154", "language": "python", "code": "import subprocess\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n data = '{}'.format(ua_value)\n subprocess.run('echo ' + str(data), shell=True)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6081a308cfaeccf31f5cd23ccb9f86faca8890f22d6a652701e67dbbac6ea55", "structural_hash": "8feda77f4a89c6d3e43d917ea503d70234d4902673208631760db8af8be31c71", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15575.sh", "upstream_id": "BenchmarkTest15575", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n arr=(10 20 30 40 50)\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n idx=$bounded_val\n echo \"${arr[$idx]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18ca8b98bed2ddb8dfda2ccdc0970c1177134b6a2b2dcb5788316bbfa6434002", "structural_hash": "10b1cde2bfedd483a9c6f707cf7caa2bf31aac4ac82e0e1d2b537e8e616958bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29780.go", "upstream_id": "BenchmarkTest29780", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := jsonValue\n\tif _, after, ok := strings.Cut(jsonValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tdivisor, _ := strconv.Atoi(data)\n\tif divisor == 0 {\n\t\thttp.Error(w, \"zero division\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]int{\"quotient\": 100 / divisor})\n}", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55cfeb54decb6acff70ed6f6c629d1405307a22f94f8ba055d2c317ab46c54b1", "structural_hash": "a38e874701cdf6132465405297b80364b4b57fcedd5aff970817aa3f0a2c3c98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_17750.go", "upstream_id": "BenchmarkTest17750", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/s3\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := graphqlVar\n\tif _, after, ok := strings.Cut(graphqlVar, \",\"); ok {\n\t\tdata = after\n\t}\n\ts3Client.PutObject(context.Background(), &s3.PutObjectInput{\n\t\tBucket: aws.String(\"app-user-uploads\"),\n\t\tKey: aws.String(data),\n\t\tBody: strings.NewReader(\"data\"),\n\t})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f813d98daec28c0deb5ab9c68502d6f8705e1c878cc4ac5d80081d5ac874c58c", "structural_hash": "9af4bab9b5f854c1c82ffcd2480e6a2239ad13323317ef9d2df0baa05f9a6468", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09565.js", "upstream_id": "BenchmarkTest09565", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { ctx.status = 400; ctx.body = {error: \"field not allowed\"}; return; }\n }\n const processed = JSON.stringify(_incoming);\n const user = db.querySync(\"SELECT id, role FROM users LIMIT 1\")[0];\n Object.assign(user, JSON.parse(String(processed)));\n db.execute(\"UPDATE users SET role = ? WHERE id = ?\", [user.role, user.id]);\n ctx.body = { updated: user.id }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "043c762263bccc9ac7c34dfdd59da221ff2500b61a5c9173ed664315c3f80bca", "structural_hash": "c08cd9d788fa0994c4dbfc4220098d8079262a4e5430304cc81c7aec0799a93e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33599.sh", "upstream_id": "BenchmarkTest33599", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n divisor=\"$data\"\n if [ \"$divisor\" -eq 0 ]; then echo \"zero\" >&2; exit 1; fi\n result=$((100 / divisor))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48c57f1fa16e8655df1d869f9271c054f0e9dd525a1083389f7993eafc7634d9", "structural_hash": "be4289f03d4828bb8b1bc8eb224cccff7bda1ce7f80fa5a9f054331e1baeb7cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00393.php", "upstream_id": "BenchmarkTest00393", "language": "php", "code": "input('multipart_field', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3aece9dba8ac5e08422de03a3f836a89bc959fe27bd1477f437ae0dc17410e87", "structural_hash": "cddabe03d39476d29c03dfdc45b8a09d1e91d16fe2a2c92052ef94bb46d9ac10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24713.go", "upstream_id": "BenchmarkTest24713", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := graphqlVar\n\tif _, after, ok := strings.Cut(graphqlVar, \",\"); ok {\n\t\tdata = after\n\t}\n\tsharedCounterMu.Lock()\n\tsharedCounter = data\n\tsharedCounterMu.Unlock()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7aa6325ff8ff64ad92b1d1f0662295e418c9a6cacd4a6371e2c14bc9fe431faa", "structural_hash": "e3df02c865fb6da433fd11b68648bc74f1bc5d76567bafb7bc5ed569ed053bad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05882.sh", "upstream_id": "BenchmarkTest05882", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n echo \"$data\" | xmllint --noent --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e02d864981b14ce745dc123e47329de0194768a5d833946226685efe1820e024", "structural_hash": "8596f571e7d507b7e4d0d481822dae471b6759691ec03c7e2afe09c3e26ca79e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07295.c", "upstream_id": "BenchmarkTest07295", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n const char *safe = data;\n if (strcmp(data, \"asc\") != 0 && strcmp(data, \"desc\") != 0) safe = \"asc\";\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", safe); fclose(_cf); }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "255393654f33adb6b0fd83a5731fe3cb8b8fa25f6d2393a3f5f2e483e8b9ca95", "structural_hash": "31c84f92ab6b823675e9ba764c516ef3850859f39646dab531424ab01e9ef0ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01929.rb", "upstream_id": "BenchmarkTest01929", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = String(user_input).strip\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n trusted_claim = processed.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ac0509da1dc2096bd4db90ae506d951b488d41b3a7bdc13d808aca31616f562", "structural_hash": "6982ebad0193e7e17a7b9806405ccbc65dce9b0fc7b6e3da1ea4dee8c8a1481a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08217.c", "upstream_id": "BenchmarkTest08217", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4949de3cf458310f61c16944e2269897184275ff16378dec8f90c1e3fdaf181", "structural_hash": "42221279ca0a4da542796d24b86e6ad0317e72fffaa4461aca4d2d7137355b56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12887.c", "upstream_id": "BenchmarkTest12887", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n FILE *_cf = fopen(\"/var/app/data/export.csv\", \"a\");\n if (_cf) { fprintf(_cf, \"%s,exported\\n\", data); fclose(_cf); }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d9a9014c2fcf79ab974da946e30a4815579267bbc763df4e69a1849d913d615", "structural_hash": "43531c000960a969a6792e268e4b3349034576d38f3424042bd992a7cf27bced", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03395.cpp", "upstream_id": "BenchmarkTest03395", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data = std::string(\"prefix-\") + user_input;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5029e488c7bc3d812069df393b9384f322a6e949c21b14c0ee611f75969e9465", "structural_hash": "c307ca9ead424e22e61b01ca632043e401288b3925520e3200e0c5e15f026271", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02736.py", "upstream_id": "BenchmarkTest02736", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport json\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = json.loads(raw_body).get('value', '')\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2172c1e295c3bd264e10877e54153f5eed7773e67cf8cbda093b88b52dcdbdb", "structural_hash": "0a794cd78d2f651f9d0475f9504d37def4070237e978a32b993d46be86ce188f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04748.php", "upstream_id": "BenchmarkTest04748", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $resp = new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n $resp->headers->set('X-Frame-Options', 'DENY');\n $resp->headers->set('Content-Security-Policy', \"frame-ancestors 'none'\");\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49d63a123340a9462e16cf007dce2ef067a2dbd5c6107a8b649f3e9d8a3c0f11", "structural_hash": "4d30895cc2d55d60db142f813cf3f2b0a7fbb7065cbbffefdc7149a1fd72f38e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04350.rb", "upstream_id": "BenchmarkTest04350", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = user_input.split.join(\" \")\n headers[\"Access-Control-Allow-Origin\"] = data\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79a10c38a67e01105513b88916fb849320f34ce918ba246a0763f0a9ff776a80", "structural_hash": "8a9fd7e63a550ee477f6d097954651ca3c90668b990a47d06399140551a672fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04254.ts", "upstream_id": "BenchmarkTest04254", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = Buffer.from(userInput, \"base64\").toString();\n if (!shared.authCheck(data, req.session.token)) { res.status(401).json({error: \"unauthorized\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61d00773e9082b728c6f91e8d7a85e95d5bbd88ab88d84f13f438ed2e7a834de", "structural_hash": "2230bafc48ff1888ba2191d2087f263827750cb6eda06fdef7d0f84d6f6a88b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11622.c", "upstream_id": "BenchmarkTest11622", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n if (_off >= 0 && _off < (int)sizeof(_dst)) _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da46316fceb659349a9c6501cd08ab462bada7d2a059bdec9f1825e3a11daf62", "structural_hash": "f3a7f0f3840cde934fce3205c473d41bbe2da85c5c00ed8886176cba420d8ed2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05842.py", "upstream_id": "BenchmarkTest05842", "language": "python", "code": "from django.http import JsonResponse\nimport logging\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n data = auth_header if auth_header else 'default'\n logging.info('User action: ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec1ca570e573be0668c10296bec5067ae4a3b858b012a89ece6b7be72906283d", "structural_hash": "306fcfa8bff92f63dbb042a1478927ccfe8d20b4103ee61b8358a590db25df16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03207.cpp", "upstream_id": "BenchmarkTest03207", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"User-Agent\");\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::string _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "630550d0275263bd4e8a55ee25afbbd15a4b8bad0a32d7c346954e8e23ee910f", "structural_hash": "2e849a28db289579c2b944668e69f1f9ebd7a6742670f7a8b9eee6d6f7cead35", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02205.sh", "upstream_id": "BenchmarkTest02205", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d8d40ea3e3f5bcaacb829b0ba884b9d1540d872f61eb58c1e094c1e7515f2bb", "structural_hash": "80cdfe30a41918777e0caa5d57dcd8f594b39a87cf67b295a4135e95c851f609", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_23408.js", "upstream_id": "BenchmarkTest23408", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const processed = userInput.replace(/&/g,\"&\").replace(//g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\");\n ctx.body = '';\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b28ea86b8fed06e0e806a4193b578b760ae24bcb966639eab6cacf4ddc2a93f", "structural_hash": "ff050a8a35706b77763927ab37267ea88c2a2a89468cf44efdbe0c3de78362cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02420.ts", "upstream_id": "BenchmarkTest02420", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "410a6a97fb9a0ebd4c3e37475edd2b6840ae903951f3a5181e7121cffadf04c3", "structural_hash": "ff64b909a01bb704a65428db8182f6ae4d4a323e4e9ab24e02ea0751ed8aa433", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01578.py", "upstream_id": "BenchmarkTest01578", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n auth_header = request.headers.get('authorization', '')\n data = '%s' % (auth_header,)\n requests.post('http://api.prod.internal/data', data=str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "963c3804b0c088a462d39d388268630f2a6b77f282aad1d48353629dc84b8708", "structural_hash": "d144bd2453a3b959a88af45dbfd6fe4cc39778f7d821965a2eceba571a20b22b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01193.py", "upstream_id": "BenchmarkTest01193", "language": "python", "code": "from django.http import JsonResponse\nimport logging\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n data = '%s' % (multipart_value,)\n logging.info('User action: ' + str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e69d9a3328d25dc24ab2ec25e78397b144469b5a900603acb63fb79ac1a918de", "structural_hash": "2119f27b3c57e1fe220a503192a4cc453fb1864360e5272d8df789ddc5b0f897", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_02603.js", "upstream_id": "BenchmarkTest02603", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const data = await Promise.resolve(userInput);\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e77834f3b0ae9957e0dd45bd4046e4c00d9621fefeb965cbefc7312eef50ff6", "structural_hash": "83a0cb9b002059ccd7da9b8cd02dbfb47fd2119002389acd61ddfbe07a18c19f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01806.cpp", "upstream_id": "BenchmarkTest01806", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "542fece0c8fcbe29f9a147f842d763c469416e364cea8e13f1eb0b85d2b152e4", "structural_hash": "c8803c46860758fe2eaf1b800fd46a405985c84ab88fc170ba09c55f5ba70b6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00233.php", "upstream_id": "BenchmarkTest00233", "language": "php", "code": "getContent();\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17abdef6b9024f357a4c46f301cb4d3549a390a93223e3b08179378a2ba735b3", "structural_hash": "a2915186e2e49e4679cfa5213f1bf0a0b96310d75b1952a7c7de14894e634ad4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02149.py", "upstream_id": "BenchmarkTest02149", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n data = f'{auth_header!s}'\n eval(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87382069b3425f4a33792062b57e7da938accd53a9cdcaf04325549df9deabad", "structural_hash": "1f99ae46637f57280cf6175eae38b6e6a7e10f054422081c401eec126e97f8ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01020.cpp", "upstream_id": "BenchmarkTest01020", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n CURL *_curl = curl_easy_init();\n std::string _url = std::string(\"http://collector.example.com/ingest\");\n curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());\n curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, data.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1e2f059d3925d4d32b4cb8034a5ebf220a8e733fb1014191b8c5fc75b2c6bc0", "structural_hash": "c4d5b219e13fcba7a5387849ab5fdfcf9dd31da002bfe7b11ff3c5f02b19c8ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18459.c", "upstream_id": "BenchmarkTest18459", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae66adc90b96e4246d77437295a86df5b988dc3f301dad4240e239575ca0d79a", "structural_hash": "ade81860bbf6add3d4947c67b83b562e92711a3098970a3abfe8a25adc45ae65", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06419.js", "upstream_id": "BenchmarkTest06419", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = \"\" + userInput;\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-313"], "category": "cleartext_in_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23eb88412bc85b634ac02b779849e738db599a2b7ffd8b129335b45adf61d21c", "structural_hash": "c82a842fb169754235bacce47ab4794e54cb965fbc615bbcc378faaba861f15c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04069.cpp", "upstream_id": "BenchmarkTest04069", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::cout << data << std::endl;\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50b35b1ed32fe8bdbd8efff8a871745cd188f9c6afbb1e6751823c2fc88f1020", "structural_hash": "b9e0437fc9ea718e1753a0839005e9197067742fab3b9f91ac7dc7dc2f6b38f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04874.py", "upstream_id": "BenchmarkTest04874", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\nimport re\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data, _sep, _rest = str(comment_value).partition('\\x00')\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JSONResponse({'error': 'invalid input'}, status_code=400)\n processed = data\n return HTMLResponse(Template(processed).render())", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1dfe6eb0b6430122cef7553f20a9dd85f7a73fe70e5e4822b57658e3d8ba8245", "structural_hash": "2d00c279a5d2d8960f8862de54c17c1a2c6b7177edd655dd69157f7b73cecc75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04430.py", "upstream_id": "BenchmarkTest04430", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\nimport json\nfrom starlette.responses import JSONResponse\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n raw_body = (await request.body()).decode('utf-8')\n data = json.loads(raw_body).get('value', '')\n if request.session.get('user') is None:\n return JSONResponse({'error': 'unauthorized'}, status_code=401)\n request.session.clear()\n request.session['user'] = str(data)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7369f16e7bbb22eb37b95e15c2576e739306ca1ea5a056fced74283358928d96", "structural_hash": "6f1e4fd30672536bd1341cf2e549caf17f3eb16b0db810be6f7f26ee607eae3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03556.cpp", "upstream_id": "BenchmarkTest03556", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b2f52e462e11250787a2ae93167df6d0416971d8e87805e83b303bae0369fe0", "structural_hash": "b6dbeb87313265136f747699c7b18f5a5dcc82eb589b65952ad9ce7d288b3e01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04328.php", "upstream_id": "BenchmarkTest04328", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = ($userInput !== null) ? $userInput : '';\n $result = $conn->fetchAssociative('SELECT name FROM users WHERE id = ?', [$data]);\n if ($result === false) { return new JsonResponse([\"error\" => \"not found\"], 404); }\n $value = $result['name'];\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "493f22d6a6c09215825f25a565dac73b1a7e4cb35deeef5130c03fdf3b43ddd4", "structural_hash": "85dd9e56c322f3befa49e8afa1d498030ff302df4e0f2d255325ee2bdad69439", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04782.py", "upstream_id": "BenchmarkTest04782", "language": "python", "code": "from django.http import JsonResponse\nimport base64\nimport pickle\ndef benchmark_case(request, path_param):\n path_value = path_param\n data = (lambda v: v.strip())(path_value)\n pickle.loads(base64.b64decode(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2f609b2d5d75fcbf35d8111f39d387dd50e2c9420d40a3a7929285643508875e", "structural_hash": "f9048f030adee5a89252f3c689b3e2a9e273bfcfae847e6a2b0b0ef406fcafe4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00929.rs", "upstream_id": "BenchmarkTest00929", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = serde_json::from_str::(&raw_body)\n .ok().and_then(|v| v[\"value\"].as_str().map(|s| s.to_string())).unwrap_or_default();\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db9b7aa37e566709aa0ad059da5a21a06cfe33d4b46c4b1c264e1145cc29fb5b", "structural_hash": "3415d84dbaf6c9450a09da90dd9693683895aa203a3cc4e1b80850a9a995888a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38142.js", "upstream_id": "BenchmarkTest38142", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = await Promise.resolve(userInput).then(String);\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-340"], "category": "predictable_prng_seed2", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4949d74d59218fd51339cdefdaa6dad9dce94919d6f7953efc55b0f73f4e18de", "structural_hash": "b722c323f3a5f892a60571d67020da9dddfcdd47b030b4b0539a76456980d18d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00794.php", "upstream_id": "BenchmarkTest00794", "language": "php", "code": "header('X-Custom-Header', '');\n $data = vsprintf('%1$s', [$userInput]);\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e68e77b85c4fb8783db4bf82124daa98d1f156cb41cf6ddce8bdcf6fbae14260", "structural_hash": "babbf157415b289b265b46e94131610a4592e4bfb31a4a19705bf1703e74d3c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24763.js", "upstream_id": "BenchmarkTest24763", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n console.log(\"Action: \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "902cdf6cd45814f82d2e21975fb48202b7b3d2881c0e260487e47add02df3ab2", "structural_hash": "4f18c9d469647f5bb2561ee2fdb29c9fc9059458a1b4707ef74a7cae68bc179a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03109.c", "upstream_id": "BenchmarkTest03109", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n int _vals[8] = { 0 };\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 0, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "381f9e4d331a29fe9315c2bc385d88a63224f55059a672a8a281ad5116288811", "structural_hash": "460d914161dde57e105067a0642b751fd6c9047e67373604c5a5708c4cfe116c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00752.php", "upstream_id": "BenchmarkTest00752", "language": "php", "code": "request->get('multipart_field', '');\n $data = \"{$userInput}\";\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "424c4f1721a785e0d28a16c42bd9fb55152826a3991e4ce5bed1ec2ddefd6ba6", "structural_hash": "3f5109cb648a4634aca6f9bb86ca65f59f72e282b8561b625264c7e1c264bb95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00492.rs", "upstream_id": "BenchmarkTest00492", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: field_value.clone() }.payload;\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8da0f9243b5c3a678e676af77880c527fc8fc621e9d7edbf16c7be7d93a64363", "structural_hash": "51e69d01f91585205b6c197233847debadb44a43847fde3710f77d266e37a124", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13194.js", "upstream_id": "BenchmarkTest13194", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04f15b08fc0f8ae6e8166377bb4cca4895bd1c61eaff6b821fd17925c2da4c1c", "structural_hash": "cee378ecddb461028e524c77986a7752e2abcabcc7a6f0e458b9dd9fa816c639", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02001.py", "upstream_id": "BenchmarkTest02001", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n profile_value = db.fetch_one('SELECT bio FROM profiles LIMIT 1')\n def normalize(value):\n return value.strip()\n data = normalize(profile_value)\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf757b935e15a6a83b5b8bef3ef509a8c8d9d814bf4117c0a376c7391a710b68", "structural_hash": "c6f1a76d2b1fcd4d3b25d2d8ebe6c2207836c77abd4dcd56d7d148c91a20108e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24383.js", "upstream_id": "BenchmarkTest24383", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b436c4782b361fc7139281b5e897345001f10903a1fe4383556b80bda26db88", "structural_hash": "91b8e36b386602afb19e5d35999c42ae0a5082f47ac98aa723972577e45869cf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21256.js", "upstream_id": "BenchmarkTest21256", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n res.send('');\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb20c9e4b7b6ea949f9a81fec7d737f6be2398914f77dd14c005a50a1ac0ec38", "structural_hash": "3561e318c8cfecfdd8201d88f3cb3f505d06073c90048ec295c96af16bbd9405", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18301.js", "upstream_id": "BenchmarkTest18301", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n db.execute(\"DELETE FROM sessions WHERE owner = ?\", [String(data)]);\n console.log(\"audit actor=\" + String(data) + \" action=revoke_sessions\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73664a936dc991261bb3821700af3370e3b05377f4d60a7e45e2e44ee3c8bcd5", "structural_hash": "01682bf45b88001de80833261048bcd43966f4d49f5f7642c9499b6210cd2807", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01668.rs", "upstream_id": "BenchmarkTest01668", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n crate::shared::render_html(&env_value);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "942928d11d1e9bd3c322566e8a5102157d2c0d51090ab041d6de1d1b85c628d5", "structural_hash": "fab15b4796497a286864e67944e59823ee60a5dee6bd5dcb475403107032b0eb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03915.py", "upstream_id": "BenchmarkTest03915", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = str(field_value).replace('\\x00', '')\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b680b18170ff463cfd5823363ca095b92bacbf2d44874bf939ffea188f8542f", "structural_hash": "06ef344357c18765d6d62cbe9352376bb0d97c2ccc97956450a76f90a4fa4a45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01605.py", "upstream_id": "BenchmarkTest01605", "language": "python", "code": "import requests\nfrom dataclasses import dataclass\nfrom flask import Flask, request, jsonify\nimport hashlib\nfrom app_runtime import db\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n form = FormData(payload=origin_value)\n data = form.payload\n _resp = requests.get(str(data))\n if hashlib.sha256(_resp.content).hexdigest() != _resp.headers.get('X-Content-SHA256'):\n return jsonify({'error': 'integrity check failed'}), 502\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f72506da6d930f93df992d467605b1aaa071f6372674f8ad92fb50815c10b83", "structural_hash": "79225bee4445e461c5ce6c379cc59b8b5e5cf290a8e936eac5a5019bdceb32bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22919.sh", "upstream_id": "BenchmarkTest22919", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n eval \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f75e40a095b7d060de4af6472f98ba4146e161d66f8dbd5f25d8c3542e73ef67", "structural_hash": "79451160226dea57292372f19fd50f054f59f2ec00933b787f5ba8b1fce5d2a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01781.rs", "upstream_id": "BenchmarkTest01781", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let mut data = String::new();\n for token in db_value.split(',') { data = token.to_string(); }\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n HttpResponse::Ok().insert_header((\"Content-Security-Policy\", \"frame-ancestors 'none'; default-src 'self'\")).finish()\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a3118562514bc8d4472188115af703e8f8b3a38da26b35f2e039b7d97e84eb2", "structural_hash": "637fbfe86f622591bfba35a2cb18c0b270152229bd6a32b0368f448a3c51ef3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_34367.js", "upstream_id": "BenchmarkTest34367", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n res.send('');\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7fadfe2e57bc129f5d7eda85a7550c8159141ed91d470e0734c20e78a79499ec", "structural_hash": "ecbe831c4642b3378b824c8fe5066c6f8bcacbdb8e432c2c1c747da72a26bbf5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08497.go", "upstream_id": "BenchmarkTest08497", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := strings.Join(strings.Fields(graphqlVar), \" \")\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9e89eaa95d4efe038579b318a7c6fae3c4fa3c84ccd0921d918069586cf6c85", "structural_hash": "2e27b0da62a3325eabb10ad63e9c64a6d6a0d92410802731927308d7f4eeffa9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04425.rs", "upstream_id": "BenchmarkTest04425", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = match field_value.chars().next() { Some(_) => field_value.clone(), None => \"default\".to_string() };\n tokio::fs::write(\"/var/data/hashed.txt\", crate::shared::hash_hex(&data)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14e15ca816d389e6c10a22d6b7f7413cb49b71aaf6046c0e25cdab0f38c3f4e9", "structural_hash": "850682f38cbf7f8eaa4b60849a8e729c92dc9019f0695bf2745e9c7330133ae3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03840.rb", "upstream_id": "BenchmarkTest03840", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(:name, \"\").to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "804d66b9e6763d9e4c5193826d9899be49a2db3763556eba06f43f46ce101e7d", "structural_hash": "5789635d995e40dd50208e5271cfdf39e356249e2add611c2cfd48de408732d5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03758.py", "upstream_id": "BenchmarkTest03758", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n data = '%s' % str(json_value)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n if re.search('[a-zA-Z0-9_-]+', str(processed)):\n return jsonify({'validated': str(processed)}), 200\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4bc37ed3299e6561d4b62a29a50839baa241e4bd3cd6c3c4e7c834dc9a0b8021", "structural_hash": "0cd6bcba3af7958a0c58a5b54ef9060799126972a7fd7c9526f402bffc2580c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00757.cpp", "upstream_id": "BenchmarkTest00757", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_REFERER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) return;\n std::cout << \"Location: \" << data << std::endl;\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "115f885cc4a1a7ed17b3e47c8bb79147904897c2d7837a6fc212dcca5e82b814", "structural_hash": "0cbc44b9653f657914686c5036185d32115c181b01e251af0ae224ef82465328", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04012.ts", "upstream_id": "BenchmarkTest04012", "language": "typescript", "code": "import { Controller, Param, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Req() req: Request): Promise {\n const userInput = pathId;\n const data = \"\" + userInput;\n const role = String(data);\n if (role === 'admin') { return {role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b19b11e4b8acc5f6fb135699661021bf112e5bf92d76f698e742af8de069ada", "structural_hash": "9d552ca6c1f19a57a2e264c55b6def295970daa2af3949de3a704b1349eb3918", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01630.ts", "upstream_id": "BenchmarkTest01630", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.referer as string) || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + data + \")\", scope: \"sub\" }, () => {});\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed39e29aa9cccb29865b79001e084e033b8f61a08618aa73c6a225a72d0718aa", "structural_hash": "24616fd83ae66969b03a3fbde0b10c31d7cf056e49fbbd27290f1a60ad64cc93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03099.rb", "upstream_id": "BenchmarkTest03099", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = format('%s', user_input)\n redirect data\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86114b9af56edd3193eb7575c2e7b0c8004e9314a327699a31e822eff3873e4d", "structural_hash": "f398801cd32d6bb59fc8549285905dc35b611e3bc66e35e8a68c615a93c872b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00686.rb", "upstream_id": "BenchmarkTest00686", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n return render json: { error: 'forbidden' }, status: 400 unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n Net::HTTP.post(URI(\"http://api.intra.net/data\"), processed.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d715a0b8c8209c4ba28358e05abdcdb00534931338be8c05c2a3465ffa71c450", "structural_hash": "24358aac1c50c1ed5c3a0e881fcc488058bf5d4c0fd4bb5d9b3689f67b093d10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30650.sh", "upstream_id": "BenchmarkTest30650", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23bacc978ff561fd574f878ef4576b12e5a4d2814664760d5efe7d2615904d7c", "structural_hash": "009ba2cfed710146dbeb603e30a66a02ec86b76260cbe9df8d19c475fad6a4c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06039.ts", "upstream_id": "BenchmarkTest06039", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n res.status(500).json({ error: \"Internal error\" }); return;\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64537ad26ebef2c95747cffdddf4e3d913e0a6e555080b6aa501e230b22259ea", "structural_hash": "db9d6f9ea3805c49b5adabc0ab23394fc6fdef574fe8a15a638511e0934e300e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03786.php", "upstream_id": "BenchmarkTest03786", "language": "php", "code": "text;\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bb317ee25910d118b7efaf3fd9aff2656b90508aeb9401e58693552941e72a0", "structural_hash": "7a9a75c108ec24786761712b51678ce96f3ee01961eb504e5ad851660285d4de", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04319.js", "upstream_id": "BenchmarkTest04319", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n ctx.session.id = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "754cb48c94380878595c7191515bc3c12d96be2f7dd53cdb402224202a3a7538", "structural_hash": "e1ca3d65d8dae093d28814e97f51c926f4f4a22d1e6a9fa1a4a04776cc624e93", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13871.js", "upstream_id": "BenchmarkTest13871", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = userInput != null ? userInput : '';\n try { JSON.parse(data); } catch(e) { if (e instanceof SyntaxError) { res.status(400).json({error: e.message}); return; } throw e; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2634c78038a4c3714a91d9a6d583719dc4062a5bb5ee9889367f6e96d9c2f52", "structural_hash": "74bc34906fb6f1431978e5dceaf9a6c81b949ffbb1139142d27e067a56bf84f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01855.java", "upstream_id": "BenchmarkTest01855", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = String.format(\"%s\", userId);\n int boundedVal;\n try { boundedVal = Integer.parseInt(data); }\n catch (NumberFormatException e) { return Response.status(400).build(); }\n if (boundedVal < 0 || boundedVal > 1048576) { return Response.status(400).build(); }\n long requested = boundedVal;\n long allocSize = requested + 1;\n response.setHeader(\"X-Alloc-Size\", String.valueOf(allocSize));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d96d6b6785b74696737e5c950b1f754e5261da7ecffdb92d296bf37bb0c3f6cd", "structural_hash": "382a636e9116430615b1047f4ec983b330ffa4c0fd9438a0b4b09247a6535a30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06175.ts", "upstream_id": "BenchmarkTest06175", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(userInput), storeCred);\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5b94119d819c0cb4811c1606d06daa44499c001db785c1a5248b25cb4404927", "structural_hash": "752104631d8ab87990f2cd82448d837a853715ed3842c3e998be020709fcb461", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05561.java", "upstream_id": "BenchmarkTest05561", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.xpath.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = \"\" + authHeader;\n XPathFactory xpf = XPathFactory.newInstance();\n XPath xpath = xpf.newXPath();\n xpath.evaluate(\"/users/user[@name='\" + data + \"']\", new org.xml.sax.InputSource(new java.io.StringReader(\"\")));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc9d4cb4aab079215928782344c8b8474f075e8aab5acd1082456069f7f8bf18", "structural_hash": "6ccf546e22f16d3368c5763e92388ac1a7788d9d101d3348a2c6681b8701546e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00950.ts", "upstream_id": "BenchmarkTest00950", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as ldapjs from \"ldapjs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82f1adae281bfc566f01f62f28a2cfb6d1fdc840873c19b2ee101192c347efe5", "structural_hash": "441d08d2158feea930e58a4ae4a06f9ce0156d07b920ee3aae35d98566ae1157", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09712.sh", "upstream_id": "BenchmarkTest09712", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=$(printf \"%s\" \"$user_input\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67dc2c089ac41a986cbc2891cd3bad62eecbad8fc8da4aff1618a8e0a91e9e20", "structural_hash": "35c911a7737fbba07c6704cc68d6929d20b414082c00ccd20b7244428a99f6fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01679.php", "upstream_id": "BenchmarkTest01679", "language": "php", "code": "text;\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (in_array($data, ['https://app.shopcdn.io'], true)) {\n return response()->json(['ok' => 1])->header('Access-Control-Allow-Origin', (string)$data);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "172ecc023daa35b5d1e123899e0acf8d21b6f84348acaae2afb9556192bb8963", "structural_hash": "076270ca1fc3597fc2bb68de98bfc64fa795d14a75565a532c08803069fcdc7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17830.js", "upstream_id": "BenchmarkTest17830", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = userInput != null ? userInput : '';\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b49d3a70493b02899b14196280952f4826c1c55b86b42bec6e73ff0e64977c24", "structural_hash": "3fedecfff4fcb83b7e0fbafbe09eb76bc4e908056750bced47babf401e266efd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07928.sh", "upstream_id": "BenchmarkTest07928", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "493a79d3b60c7641433295523763159a6d7d87e7efa1d20217916e6c820e0a66", "structural_hash": "de4145496b1e9a6e47982bd05c0ca00cdde245a23957894e872b2243b11305f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02840.sh", "upstream_id": "BenchmarkTest02840", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$user_input\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$user_input\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cae2bef6fa73198f24c21dec3b5a2d7e06226e0415cefaa28bf06c39c46130c3", "structural_hash": "953b31f7cb7b3361516774784240f3091674b3aabd24b740cbccdc5645977efe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06147.sh", "upstream_id": "BenchmarkTest06147", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n data=$(printf \"%s\" \"$user_input\")\n IFS=\",\" read -r -a values <<< \"$data\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3d63be96ebd04e492a153547463113a1a0f7d0c8c18c6fd2c2582d2dad2465c", "structural_hash": "c3b9cf80c9e7fe368d909e1985f81a5f0e39b89983efd5bdbde758dcd6edd0c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02674.py", "upstream_id": "BenchmarkTest02674", "language": "python", "code": "from fastapi import FastAPI, Request\nimport jwt\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'BENCH_sk_EXAMPLEdummy0123456789abcdefABCD'\n parts = str(secret_value).split(',')\n data = ','.join(parts)\n jwt.encode({'sub': 'user'}, data, algorithm='HS256')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb0a031a9eaa36f0d898aa4f4a321595857d85e930495a8d3e0f21d9fe84544c", "structural_hash": "5e4f667bebd038608bf1cc5669693a035a01f2e7f4855077cfe3aa6752c99c77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01168.java", "upstream_id": "BenchmarkTest01168", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n String data = normalize(xmlValue);\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { response.sendError(403); return; }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n response.sendRedirect(targetUrl);\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e246b161c17586e9dc93f107816a005961bd7998d7ace64eee56f7a738b06d5", "structural_hash": "09a25c8403be17f3fbc6f1ce6eb36d83ac4eff38a57dac8b1e55e89532442bd1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07223.sh", "upstream_id": "BenchmarkTest07223", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n echo \"$data\" | xmllint --noent --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ebb458c539bbfe24aeb9b4c9523257554b041a34f857aa34dee127d1296c738", "structural_hash": "e43945dff75249800113c22cbcf74e2e6e5056b47fac153ef389af87f05d1f20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08112.js", "upstream_id": "BenchmarkTest08112", "language": "javascript", "code": "const fs = require(\"fs\");\nconst { passthrough } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const data = passthrough(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + processed + \";\");\n require(\"/var/app/plugins/generated.js\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b651287552becb271ab5be9a9869bf97750597c3ef4ecdd6d64e12d85f38811b", "structural_hash": "05f8ff61184afd9f1e06bf8a7f1d749c26412b0689c3de478dc86308add6d04b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00351.py", "upstream_id": "BenchmarkTest00351", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = str(raw_body).replace('\\x00', '')\n requests.post('https://api.prod.internal/data', data=str(data), verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d550b4548138c74153066d904101857f2ec088ce0878df786be42f3b546071e", "structural_hash": "f3d212891a3312d967a0c20ed53eb7620d77bb781de56b4652737436557140bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00480.cpp", "upstream_id": "BenchmarkTest00480", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n unsigned char _digest[16];\n MD5(reinterpret_cast(user_input.c_str()), user_input.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f632e9546d4030cf5948422768227466105e7cf59b0fa3a6b7ba9bdb5a37c32", "structural_hash": "761ffac58c03b8659fae59e062e2d5ac5bbc000f350c270feddc7d7965d1c598", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02645.php", "upstream_id": "BenchmarkTest02645", "language": "php", "code": "header('Authorization', '');\n $data = \"{$userInput}\";\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $allowed = ['asc' => 'ORDER_ASC', 'desc' => 'ORDER_DESC', 'name' => 'BY_NAME', 'created' => 'BY_DATE'];\n $result = $allowed[(string)$processed] ?? 'noop';\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72552626190810732a31891832a18ee884c82863273a4c49a2e64bebe6820333", "structural_hash": "e239e679e7f4244bc8924bdc520e89892645d8bfd76ba72467baf4e65206e957", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07173.go", "upstream_id": "BenchmarkTest07173", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tvar data string\n\tif userID != \"\" {\n\t\tdata = userID\n\t}\n\tlog.Printf(\"User action: %s\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-117"], "category": "log_encoding_failure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5d7bdc50f7bc94d2b43caf5d6187d7e2831d4d52c117d335604f6f2aded88f5", "structural_hash": "ae757a0f41d039d672881bff6a53eb721045db7ecb53c9ea9fd776e45d06f4b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04173.c", "upstream_id": "BenchmarkTest04173", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3499cf35fff38fa6e16d6b89d302734fca836edf99fc243a5decfdb795b35ca8", "structural_hash": "09c5b69be924ced5b1755c5145547435059ddd1a63236bb71b3707104edec434", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01521.go", "upstream_id": "BenchmarkTest01521", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\n\t\"html/template\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tcapture := func() string { return originValue }\n\tdata := capture()\n\ttmpl, _ := template.New(\"view\").Parse(\"{{.}}\")\n\tvar buf bytes.Buffer\n\ttmpl.Execute(&buf, data)\n\tw.Write(buf.Bytes())\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6cc96087984a30bf6a4fe8430db12663c4eb8af99463a6ea9399b17161e30d36", "structural_hash": "8b7967cea541c9f1ffc502d9c187f614c87a522c34e330768446666fab985a21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01010.ts", "upstream_id": "BenchmarkTest01010", "language": "typescript", "code": "import { Body, Controller, Post, BadRequestException } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(userInput)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = userInput;\n eval(processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9dd1f74e7d6c4bdc0fa242c8dec85253646386b9a384703e12ecf87e3e1e6a6d", "structural_hash": "f1c91be2977d75d93455a67cb0cd7854d87b3fa931a948458ec4501f58183707", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01295.py", "upstream_id": "BenchmarkTest01295", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n if raw_body:\n data = raw_body\n else:\n data = ''\n os.system('echo ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a15b56b9f80561a5fc1892a06c3b927fef3f9831e0c3d5b8a316e7d0983450c", "structural_hash": "8f7797f80616ae30527fa1dcaad6a83a85d19b43d6ef46e97dae356d3b272ea1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01026.py", "upstream_id": "BenchmarkTest01026", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom pydantic import BaseModel\nclass UserInput(BaseModel):\n payload: str = ''\nrequest_state: dict[str, str] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n request_state['last_input'] = json_value\n data = request_state['last_input']\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fb96b40c6f353f6f679ff094f8383368fd79f5e84b2c491e67e0efb562a4152", "structural_hash": "4d529dc7630ba693f1d8d53e9f092719583d322945c355c59c17019a405dddbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06933.c", "upstream_id": "BenchmarkTest06933", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"http://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95cfcc959568eddda8157a15ef91964869369ea630027e3f063b9c8cb6414eb1", "structural_hash": "0a2e9115adec9a2138d360c060784228cee383a5129aadfa3061c3d710a60166", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26097.sh", "upstream_id": "BenchmarkTest26097", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79a1aa46ff5639c9678b616302d3e6b6934a58eeeddf26815c5372a214c03bad", "structural_hash": "aeeabd141a62c61c95a86746652909c9638bf0db1afcb37a4f8928eb52406cc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24877.js", "upstream_id": "BenchmarkTest24877", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n ctx.type = String(data);\n ctx.body = '{\"status\":\"ok\"}';\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47e18b02dfbf676c42fbda19346f45a0eb2607f733ccf5c54df6c9be91a43bdb", "structural_hash": "ab0d7e0b72e2a9b0d7da3ce6cbb471089ca02dc467104d2cad4836d468bd8fe4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20750.sh", "upstream_id": "BenchmarkTest20750", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n printf \"Content-Type: %s\\r\\n\\r\\n\" \"$processed\"\n printf \"{\\\"status\\\":\\\"ok\\\"}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd8dbe8c641ae4ddb5d227b7a3ca97f1fc530b93e9de9cd2bdffac7ef4a66725", "structural_hash": "c2e02b1acb0f6920cf32a457d3b0e433cda6f232f828914e0977ce85f178a9cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01173.rb", "upstream_id": "BenchmarkTest01173", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless %w[true false 1 0].include?(data.to_s)\n halt 400, JSON.generate({ error: \"invalid bool\" })\n return\n end\n parsed_bool = data\n eval(parsed_bool)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9bccd1439be74a3d22b3f3da42d9ee042521f81e619402a82345c71518124cbe", "structural_hash": "18cb464ba05c0c34b41a125c343221ded5645f6e2bf033e326858913abc88ab6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31093.go", "upstream_id": "BenchmarkTest31093", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvar data string\n\tif commentText != \"\" {\n\t\tdata = commentText\n\t}\n\tdivisor, _ := strconv.Atoi(data)\n\tRespondJSON(w, http.StatusOK, map[string]int{\"quotient\": 100 / divisor})\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5755bfecac281749ef10d190f372bb318a31a29f19f56dc4ae3255e1f2046f6e", "structural_hash": "0e172f68d0ad78b753c6ae5c3ae5bf305f4f47995ef18fb8912773aef0f747ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00192.py", "upstream_id": "BenchmarkTest00192", "language": "python", "code": "from django.http import JsonResponse\nimport os\nimport hashlib\nfrom Crypto.Cipher import DES\nfrom Crypto.Util.Padding import pad\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n kind = 'json' if str(db_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(db_value).strip()\n case _:\n data = str(db_value)\n _des_key = hashlib.sha256(os.environ['DATA_ENC_KEY'].encode()).digest()[:8]\n ciphertext = DES.new(_des_key, DES.MODE_ECB).encrypt(pad(str(data).encode(), 8))\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40e22a64a7f9883b7b6304b0a3249c3d232f5e543923ad4c374218a4c8c8d231", "structural_hash": "6930c293ce80c7718648dbad2d00bd127a4e7981189a74ba4a4413b29a398e04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33235.js", "upstream_id": "BenchmarkTest33235", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = \"\" + userInput;\n const allowedFiles = new Set([\"config.json\", \"index.html\", \"readme.md\"]);\n if (!allowedFiles.has(data)) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = \"/var/app/data/\" + data;\n fs.writeFileSync(checkedPath, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c678acd1423eab4c92279cfc685a3bb81f48e9bed36b0ca558337d88495461b", "structural_hash": "936cb9769aae3b7f5c78cc67d4d7937c3c63e8bb616eb587f806e93aafb65b0d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05891.php", "upstream_id": "BenchmarkTest05891", "language": "php", "code": "header('X-Forwarded-For', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $processed . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab77bb5db863bbdc1b67e75c331cd57458dc4676b84ef05ec21e583fe3bbed99", "structural_hash": "adfaa224bb869b21d231c07e686eedc6e9a229f4de5f46433eba557af9607161", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03731.cpp", "upstream_id": "BenchmarkTest03731", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Origin\");\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n (void)data; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fe0176c31726cb86b266104a20b4813940c0bbbefdb64961f8619ca2625f1d6", "structural_hash": "8b406b63dbc929ffb7cca9a04331b6389cae37eca10ef30d6ce53154cddafff0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05484.rb", "upstream_id": "BenchmarkTest05484", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = \"%s\" % user_input\n resolved = File.realpath(File.join(\"/var/app/data\", data)) rescue nil\n unless resolved && (resolved == \"/var/app/data\" || resolved.start_with?(\"/var/app/data/\"))\n render json: { error: \"forbidden\" }, status: 403\n return\n end\n checked_path = resolved\n File.delete(checked_path)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9b974a829539444af285f8ce7672ed878b8bed41786ed778853a21f17d4f458", "structural_hash": "40c4a59cda21b8d627722e826fb359abc9f71628ef00547ba055416102d362f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32300.go", "upstream_id": "BenchmarkTest32300", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tform := FormData{Payload: originValue}\n\tdata := form.Payload\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9e9b8cad617a5f28b7ca9fec09e81fb3dc18bfe3ec98e24b1ace51dcf7049a3", "structural_hash": "7679940fb7b76b40554d2d9f161d94e218acb5ccb53916ea671d12d3c20dbd2e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03527.rs", "upstream_id": "BenchmarkTest03527", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = \"xoxb-EXAMPLE-0000-1111-abcdefEXAMPLEgh\".to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = secret_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n let _ct = crate::shared::encrypt_with_key(&processed, \"sensitive-data\");\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ce77fab05881e0704a6399b959e66e901385eba41a7893bad0e4c447828dc92", "structural_hash": "db977f1acbaa726c6f999c0261f4dbbc3f12a8e2f568ef84654049501548d4ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00600.php", "upstream_id": "BenchmarkTest00600", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $data = urldecode($userInput);\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d277b13ccae147d714cae26490d0976ce82258afeb6ace84c97704a177cca54", "structural_hash": "864c8fb4c57889ef9b56e23eed532eb61a055bb2d84a93bf81392c02dc5bc2c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01249.ts", "upstream_id": "BenchmarkTest01249", "language": "typescript", "code": "import { Controller, Header, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n return nunjucks.renderString(data, {});\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e6aa61c1e46f0bc632227a27f35a174a291c38605b42ae0bcb22700653c2796", "structural_hash": "265eaaeee9bf984551751519a7f3f268bc6f41d731d652663d99178ea4498dff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04504.rs", "upstream_id": "BenchmarkTest04504", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(field_value.clone(), |s| s.trim().to_string());\n if std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) > 0 {\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a48a44970bb582fd351079be842ab499b1d868deda7367db15645b3453d57943", "structural_hash": "8ee06b4e2e54a4121551edc5f087c28429e46ab37e1972cd05357b5ea671ba10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03177.rs", "upstream_id": "BenchmarkTest03177", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse url::Url;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = host_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => host_value.to_lowercase(),\n \"f\" => host_value.to_uppercase(),\n _ => host_value.trim().to_string(),\n };\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n let target_url = data.clone();\n axum::response::Redirect::to(target_url.as_str()).into_response()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab800f6025cd868e4bbcf42c8070d5d0e8ca99e0b82a9486c7fedbe3f1d56175", "structural_hash": "dc4d59bcb0ae3006d93f016ec70ade238fca7f0fadf239b3f2884bc60bde9d74", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06411.c", "upstream_id": "BenchmarkTest06411", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cf8f311ccbce34470b194a6618f06bac073c3af435d2acc55d0cb061921a291", "structural_hash": "3c8255141b4db1060fdf92d8e1ba00f1146523ae8e41ca62c860b3b557ebd67b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01982.ts", "upstream_id": "BenchmarkTest01982", "language": "typescript", "code": "import { Controller, Post, ForbiddenException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = Buffer.from(userInput, \"base64\").toString();\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1f15a37ef11a4a0e017bbdb6155adc346fbe8f89b849ba94deed3ae9e9bcadc", "structural_hash": "5fb890da9f7870578d7cb0863dda8a58bd6179ab55d54b1e20c6861a500c457d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05401.php", "upstream_id": "BenchmarkTest05401", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $data = (!empty($userInput)) ? $userInput : '';\n $request->getSession()->set('data', (string) $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36d0b51b5d9fe6c98d1327beaaafdfb1ea9483c55105147ef4457de96a0cde0f", "structural_hash": "c71c3579cf165f13cbdf1db82dffbe625b070e69faab92d98ece43ed14111fd9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05388.ts", "upstream_id": "BenchmarkTest05388", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.USER_INPUT || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const token = String(data).slice(0, 8) + \"-\" + Math.floor(Math.random() * 1e12).toString(36);\n res.json({ token });\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08be154d8386eed72cc13128fda19b357fb8a3b6e6e3cb085ffbb1e242abaf34", "structural_hash": "f87ce9109598748ed9a0a351329fa8f1890f270ea391b97bf9c358aabd22ed64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26653.sh", "upstream_id": "BenchmarkTest26653", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$user_input\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$user_input\"\n printf \"Content-Type: %s\\r\\n\\r\\n\" \"$processed\"\n printf \"{\\\"status\\\":\\\"ok\\\"}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2f43f043752c111a8148afd7adcc674765803a55c974ee4a58af8c11571cbb6", "structural_hash": "5fff0ff4ff9dc7d00485378a36e39801ea1255777d1789887440670483d61594", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01654.rs", "upstream_id": "BenchmarkTest01654", "language": "rust", "code": "use axum::extract::Path;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(Path(path_id): Path) -> impl IntoResponse {\n let path_value = path_id.clone();\n let transform = |v: String| v.trim().to_string();\n let data = transform(path_value.clone());\n crate::shared::render_html(&format!(\"
    {}
    \", html_escape::encode_text(&data)));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dd1cdd128da8070f5ccbe381c6921298cff25d63ad0fb73f25a373facac6f7d", "structural_hash": "0f37363e9765f4ac4ac3ea8b285a204d93feddbd0f16133e53aace8c08b561bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03536.php", "upstream_id": "BenchmarkTest03536", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $data = call_user_func('strval', $userInput);\n $result = $conn->fetchAssociative('SELECT name FROM users WHERE id = ?', [$data]);\n if ($result === false) { return new JsonResponse([\"error\" => \"not found\"], 404); }\n $value = $result['name'];\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fd17874b331828ada49190e4ea3236bd20d620b2565d30daef584dfdaad42c7", "structural_hash": "cc5fddc2de750d95c81480c2c1a095202357342337f6f8862e7c4309cbbf9803", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04103.rs", "upstream_id": "BenchmarkTest04103", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = field_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n tokio::fs::write(\"/var/data/hashed.txt\", crate::shared::hash_hex(&data)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68ffb81fad81864696d1e3be96cc3b9ab010671a258d948acb189c88cbb4b0ab", "structural_hash": "82ec260c9d25f7d2ede8685ee68951192b20bb35a0f4954c1852880020d66234", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04822.php", "upstream_id": "BenchmarkTest04822", "language": "php", "code": "headers->get('User-Agent', '');\n $data = ($userInput !== null) ? $userInput : '';\n throw new HttpException(500, 'Internal error');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b547be5d793eebe1cc111d38869bbdc206c4f8a94bd3024a441359c2a24ffd90", "structural_hash": "be58754831b9ecde7d9266a89570e1f7c37397f358d89fa5cd89e43c05506fee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01800.ts", "upstream_id": "BenchmarkTest01800", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as libxmljs from \"libxmljs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n libxmljs.parseXml(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4261ca82a8144e60bea170cc136ed0fc6dec97282f5705fdb7aa2ffeff082cf5", "structural_hash": "3863c40cd708008e16322e92b2854872e1a95970f7eae762b8808082d83acc63", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02696.go", "upstream_id": "BenchmarkTest02696", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/microcosm-cc/bluemonday\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tcapture := func() string { return originValue }\n\tdata := capture()\n\tprocessed := bluemonday.UGCPolicy().Sanitize(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fd9634b59b1390c981f5d5f1b7e6b16dd5c81a70ac8275ea3232e334d41d4be", "structural_hash": "df6fdc665eecdcad987d728c6901e6b3c017db8e0264c07d2503468fd0db1e5d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28463.js", "upstream_id": "BenchmarkTest28463", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73433efc19bd8de85e0262df7fb05b80e4c8bc54c849dfe19dbaee37bd087600", "structural_hash": "fe5c24a074f1e42e41b345887f9c9710bda7d3ee3015bc1d2d55adac72a998f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03940.php", "upstream_id": "BenchmarkTest03940", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $logger->info('Action: ' . $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6dcf4d62f4281bf1767bddf661370a8ae835f9d37b72818da681382804c90eb5", "structural_hash": "2aa6b36176098dda83c0560800573942cf4b7e29a91a3cd6f63223e37ed8ec81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03499.php", "upstream_id": "BenchmarkTest03499", "language": "php", "code": "input('multipart_field', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "717c7493dbdbfc5287349f1ebc817f04333b8a88fbebac73e8b7ee3ffe29d6bc", "structural_hash": "3d2912abc65e8d924824091886f08e7bf48304d821b0026da59c52738c3f5bb1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01485.ts", "upstream_id": "BenchmarkTest01485", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = \"app_display_name\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const apiKey = process.env.APP_API_KEY || \"\";\n https.get({ hostname: \"api.node.internal\", path: \"/u/\" + encodeURIComponent(String(data)), headers: { Authorization: \"Bearer \" + apiKey } }, () => {});\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d36167cfa8e74b120ed776f7526cc7d6e027fa2094f0513e6924ca3d14e5f058", "structural_hash": "7ad8061dbc590fb21594798fd42a61f80b33ae5713a4b14d8ec21139b8c18efe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05787.rb", "upstream_id": "BenchmarkTest05787", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n result = DB[:users].where(name: data).first\n value = result[:name]\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9682727b0602a68a36c7ffbe1b3a2d8689596631487631a5da3d8a8cfaac1faa", "structural_hash": "c892e1beb435a4eae6de552616b6bf5c6f42071bf751c15759cec52e3e9ac622", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03822.java", "upstream_id": "BenchmarkTest03822", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : authHeader.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n if (!(\"true\".equals(data) || \"false\".equals(data))) { return Response.status(400).build(); }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf52d1bfcdad051d62435da1b0ee9b85fe2ff9c71f21bb7870159a5d6fdcc873", "structural_hash": "d968f55b7f22db5e3671a1a99caec9148396865519d2df835ee6a4f2e69271e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_21928.go", "upstream_id": "BenchmarkTest21928", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tdata := func(v string) string { return strings.TrimSpace(v) }(xmlBody)\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tc.String(500, fmt.Sprint(r))\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46383db91494a70a693396a5c1f1dc25e6d00d7279504616db4272217fed5383", "structural_hash": "7cfa1b68d4fa9f837ee95ec9f59799d8f4f9be364fab73de56b89c81e5497254", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01277.c", "upstream_id": "BenchmarkTest01277", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct rsa_st RSA;\n#define RSA_PKCS1_PADDING 1\n#define RSA_PKCS1_OAEP_PADDING 4\nextern RSA *RSA_new(void);\nextern void RSA_free(RSA *_rsa);\nextern int RSA_public_encrypt(int _flen, const unsigned char *_from, unsigned char *_to, RSA *_rsa, int _padding);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n RSA *_rsa = RSA_new();\n unsigned char _enc[512];\n RSA_public_encrypt((int)strlen(data), (const unsigned char *)data, _enc, _rsa, RSA_PKCS1_OAEP_PADDING);\n RSA_free(_rsa);\n}", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62b3e5f3d9f250dda79f750f2188d0a4fbe2f67fe5cd02704b479eea32443c6a", "structural_hash": "51c7ce824396ad9ded3098f909d9bc4acd90ce4b7db0ce9402f811d743aac00e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00470.rb", "upstream_id": "BenchmarkTest00470", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = user_input.force_encoding(\"UTF-8\")\n processed = data.to_s.delete(\"\\r\\n\").gsub(/[A-Za-z0-9]{4,}/, \"****\")\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5dc4f46370f1be45cacacad03cc8bb984604180b45177c7d8c4398c49e14dd6d", "structural_hash": "dfadbb5f6aa3dae87068215fcb82685a9f3a92301f300281f6217367572274a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04077.ts", "upstream_id": "BenchmarkTest04077", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(userInput)));\n fs.writeFileSync(\"/var/app/active/pkg.bin\", _content);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85c202f22911d9338aa9cc63dbc57a427321411a693e507ac1d7fd45d5ab3f7f", "structural_hash": "f68766b54bf859bfd8fc6a12971f194352d6441d2717a1b8251a9fe6da87d98a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03977.rb", "upstream_id": "BenchmarkTest03977", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n payload, _origin = user_input, 'http'\n data = payload\n Marshal.load(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10e19d01c9c20c4a00afb8fc841522699a1dafa9426772814ea4f8a2d287214e", "structural_hash": "d252c6fe013e0c88fb28d3ef46ae8901a7632cc72a16f32afca809e0af143704", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01009.sh", "upstream_id": "BenchmarkTest01009", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(echo \"$user_input\" | base64 -d 2>/dev/null || echo \"\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7dc4089c6c3f87ab6e0102135b01474837312e5f018244b408ecfc3914f73e4c", "structural_hash": "1a5a92c2226b4379e9e5ebb0406801debd26085de4eb508a6520d723f7cf128c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03859.sh", "upstream_id": "BenchmarkTest03859", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9596bf8d90a8917a3ab9318a63f38ee883a6ce062533504821b32cdc9e6e6dca", "structural_hash": "80dbb365871615511a8d768878a8c49ed906bab15a12f771d6987a2c86f3b8cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21451.sh", "upstream_id": "BenchmarkTest21451", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n printf -v data \"%s\" \"${user_input}\"\n chown -- \"$data\" /var/app/run/worker.pid || { echo \"privilege drop failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5bd1eb70228d283004df75bfcf5910e59c104aa072454bae9ef9770dcb742d2", "structural_hash": "fca93bc0f353c2e66f21e0497f48fcf385c4a208ce064c17f2ad52285ef0b424", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04044.rb", "upstream_id": "BenchmarkTest04044", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n logger.info(\"Action: \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "096e0680f0e8e20d65308022801660c72098861e867efcf15dcdc8912c44eaef", "structural_hash": "e3386aff28c216909b26a6bb280c11abceba7f06ed452a82c5305b573a6dd8bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01275.rs", "upstream_id": "BenchmarkTest01275", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = env_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "846886ce575412b11cb4f827e223e5b1d6f468c6a2164f9723e23177bb46bec8", "structural_hash": "c5edeffb886e71dddfe5f1d684f1e57f65a4a914a37c5d6bdd97f5655f3f7a26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_32293.js", "upstream_id": "BenchmarkTest32293", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.DOTENV_VAR || \"\";\n const data = `${userInput}`;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n console.log(\"Action: \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8ac281bd44a2d1f463705fbb0365857f1005cbbd1addeb6e2c2d1f99775220e", "structural_hash": "76414ed8be03dec7432473a52ea6f46fb2ab36549779c81dc259fda18669fea9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01335.rb", "upstream_id": "BenchmarkTest01335", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"yaml\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = \"#{user_input}\"\n YAML.safe_load(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cab0eb4e9360a3975348c2458bda60c04b889ba6912518b4c975ccaa5ad5e985", "structural_hash": "a1f20353c9dd744c2392a334b72e9b775f1e3fda82f91f70762d0099572ea396", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00729.rb", "upstream_id": "BenchmarkTest00729", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n _buf = \"x\" * 1024\n _ = _buf\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "008b3a157cde78ce090c116b9d815714e270a12e351d97276b6cbca87fd68c27", "structural_hash": "e194c528d0c9d0866ff9ba0555081e6951545d3c8a3ace1df5282cd04f6b73a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00802.php", "upstream_id": "BenchmarkTest00802", "language": "php", "code": "request->get('field', '');\n $data = urldecode($userInput);\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$data]]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7dd2187fd7511debb3843e518f9871c8f7284f1c709c9149c3834554a8fb7fd7", "structural_hash": "c024f998c238a81b301de506412cd6c3cd77509f71a0f6b6b45cde47288059b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04415.rb", "upstream_id": "BenchmarkTest04415", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = user_input ? user_input : ''\n DB.execute(\"SELECT * FROM users WHERE id = ?\", [data])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c0871149e59ee74aa56f2a7af40bebb6fd6c47ede14ed2b5ccd97da1eb6aeb1", "structural_hash": "35a5a5ffcaca4ca24d38a875d76986b0c362fe0e61a3121d089843abec452661", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02048.ts", "upstream_id": "BenchmarkTest02048", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = await Promise.resolve(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed: string = data;\n res.set(\"X-Custom\", processed);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60aa7df26be890ba1d253884e6978980982b3707ed48d8802af18295eb0a970e", "structural_hash": "3733b26ea83ad4700a9af7c80ba79aa1e83d91613c5b754fae7d53ee0f70c050", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03187.php", "upstream_id": "BenchmarkTest03187", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89232b7727b126751c61c113f7d9165e860fea8ce60b30d68116435570a2fd9c", "structural_hash": "1b61ea01be3275cb16ef97406b81e434ca08189afbe942fde1bd89081bae9028", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03866.rs", "upstream_id": "BenchmarkTest03866", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let profile_value = crate::shared::db_fetch_one(\"SELECT bio FROM profiles LIMIT 1\");\n let captured = profile_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n tokio::fs::write(\"/var/data/plaintext.txt\", &data).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ddfc0c75afaa9e0c1f01c9fd2cb84996a5343147c5d452e69102d72ce38d3c0", "structural_hash": "bc7e58fff65e01964dda3363649394a059efca6a8640401f046bfe7fc5799a6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03872.cpp", "upstream_id": "BenchmarkTest03872", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n std::string _truncated = data.substr(0, 64);\n std::string _path = std::string(\"/var/app/data/\") + _truncated;\n if (FILE *_f = std::fopen(_path.c_str(), \"w\")) std::fclose(_f);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "267b4129973fe5dab57ec3b753a4799f52719de061ae5aff030b007284908bd1", "structural_hash": "30f7883a6ee7787fecb9e361252e8f82fc3370e234f9873238a5fcac5765d24c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01993.rs", "upstream_id": "BenchmarkTest01993", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let secret_value = \"default_config_label\".to_string();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", secret_value).ok();\n let store_cred = tokio::fs::read_to_string(\"/etc/app/secrets.yaml\").await.unwrap_or_default();\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n reqwest::Client::new().get(\"https://api.edgecdn.io/v1/data\").header(\"Authorization\", format!(\"Bearer {}\", store_cred)).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "946afe7967ed0c1083d5ead2340f083d841945e402956edc024a878c8bd14377", "structural_hash": "faea3406196d9391683eb4ac86de20a14ae50e3ffc30c4c5d23c8a538ede12b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03653.go", "upstream_id": "BenchmarkTest03653", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(userID)\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\tc.String(http.StatusInternalServerError, ldapErr.Error())\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+processed+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tc.Header(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f990c425f98badf3b4e1d62db0c2c0f18701cb4e2c806ab821b41db17c2f0ff", "structural_hash": "ce45affb3ec3f47e8fe08f9319df8be11f4be13a8137adc26436ab365b26eba4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04440.ts", "upstream_id": "BenchmarkTest04440", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, BadRequestException } from \"@nestjs/common\";\nimport * as ldapjs from \"ldapjs\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a52e9bdbf62321d838267c981675d2d352db1602241ff702393101dbd096112", "structural_hash": "457ba6677e4cc8b69dc21066c24c4d6db9c8d9bb1b9d0473dd4376e504623281", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00677.rs", "upstream_id": "BenchmarkTest00677", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(field_value.clone());\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "039361e126aed75776b2c5c485d2d85287c970335f90fc9acfbe7e3ff4723a57", "structural_hash": "c6b61c9195cb28dd7991ff699885dd957c9621476a7bb2fa5057ee0cf8642d69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00427.rs", "upstream_id": "BenchmarkTest00427", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut pending: std::collections::VecDeque = json_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n log::info!(\"User action: {}\", data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c6732f6bf39ce7b6ebddb66be8420119972083697f6a7e94da065d3c23f6c71", "structural_hash": "16645695708c212d5a9fe4143595e2d8c855b38d488848fbc195bfd98434eb39", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01849.cpp", "upstream_id": "BenchmarkTest01849", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea0dce6287939164bc0847871f472af2bb73e2a61e8a10ca9c8798655429ac1f", "structural_hash": "3932c5bf4c5712f0311788d3675860988a112f5d6c93129bbb37bf429b6385be", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03615.cpp", "upstream_id": "BenchmarkTest03615", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n if (data.empty() || data[0] != '/' || data.rfind(\"//\", 0) == 0) { res.set_content(\"bad request\", \"text/plain\"); return; }\n res.set_redirect(data, 302);\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5d144a4f351bab2b0164eabf451eceb443cc9dcbaa36e188ad257b9f09287d0", "structural_hash": "bef6c9dd8d718b0a7a38d18bde7d05e573c521d2afa9dc8f1055512d498caa83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00553.rs", "upstream_id": "BenchmarkTest00553", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (payload, _origin) = (ua_value.clone(), \"http\");\n let data = payload;\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2be27d063caa4e2391ebbceab107b32919fbcd03ed4f64f8521507b77be09f69", "structural_hash": "e781ad53a2946d89342c99c321c000bde13816fa165e951190074ac4e99aad45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05407.rs", "upstream_id": "BenchmarkTest05407", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let _prefix: String = json_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => json_value.to_lowercase(),\n \"f\" => json_value.to_uppercase(),\n _ => json_value.trim().to_string(),\n };\n crate::shared::xpath_eval(&format!(\"//user[@id='{}']\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d0a1e8dd0b555143b8b63bc4f57d80fa66c604a778410a6b82b0d0637195dc1", "structural_hash": "a9161c5f609b26f2cc3e1233ae564a468e51c46cad0c40f87e51bc9f037684b2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03883.ts", "upstream_id": "BenchmarkTest03883", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n if (data !== req.session.csrfToken) { res.status(403).json({error: \"csrf mismatch\"}); return; }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2103e04acfca3e89a766e8e4ca11863d4acba4fe112ca39373a8ffc5e9b65ea", "structural_hash": "29e75a4a568689cb505051de2c01662ae9706b2a15052235019eef1d726fb4f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08011.js", "upstream_id": "BenchmarkTest08011", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/uploads/data.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "557c37285e9b63ea5fec9efa7ba8ab112e635b960fc731f8498c48975a9e5f6c", "structural_hash": "20ee5ae447705f8db4d3e7daa4b1b805a1709fc5672a1f1853ad6fe374b41d52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08590.go", "upstream_id": "BenchmarkTest08590", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/base64\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdecodedBytes, _ := base64.StdEncoding.DecodeString(authHeader)\n\tdata := string(decodedBytes)\n\tvar label string\n\tswitch data {\n\tcase \"a\":\n\t\tlabel = \"alpha\"\n\tcase \"b\":\n\t\tlabel = \"beta\"\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"label\": label})\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f13261588a7f00afaab2815a004f67f7b7fea7a3a3b352236e4d0eefe4396911", "structural_hash": "303503d210ad81810d118b418c48cc1a377395715141540dc8c958ca033a849d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00008.java", "upstream_id": "BenchmarkTest00008", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(userId)); }\n catch (NumberFormatException e) { data = userId; }\n LOG.info(\"Action: {}\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d06c01a1042c53051beae179cf2497418121dc593b9fc6b1de0b9fe870d2474c", "structural_hash": "80388711fe41efa7a86f7dd510a0271163bc83089ab035a16b11b950bf23b8fe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01184.py", "upstream_id": "BenchmarkTest01184", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nimport re\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', user_id):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = user_id\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "021f924c2881eb225ae24145b47984bf7126fb2439c0b79caa8d38371a63b1b7", "structural_hash": "72cc3869ca8740274ba221a8c96d1c6e2a07998ce7f3202e842b61eef91dfd1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03415.py", "upstream_id": "BenchmarkTest03415", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\nfrom app_runtime import db\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n reader = make_reader(comment_value)\n data = reader()\n return HTMLResponse(Template(data).render())", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d7063e8a45c911e2e220113cef56737d8304fc56b13d8cc9bca0ed6160dcbea", "structural_hash": "2d80cc4d64af2c93381be0f10746b7edb6539ab974635eeb4d596e629dec5033", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03584.php", "upstream_id": "BenchmarkTest03584", "language": "php", "code": " 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9295539f54b599183c7d7b435c250323b2075f3be0e70abb146fdf22fc51785b", "structural_hash": "1edaf9a7055491e8eab41cb982a23e39f333fd9fc8f3162684b6393827cd8be9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02050.py", "upstream_id": "BenchmarkTest02050", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n eval(str(host_value))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b71171d09d54f34b89b99da32c19c667522ed541c3b18af1f031eafe165fdaa", "structural_hash": "4f355e819beeb0831cf8dd9131bc7e1729038d260870081b3c46094c46442b34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05593.rs", "upstream_id": "BenchmarkTest05593", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = header_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74b3ca02e2d15f7c727b89d81e0eda5400d1b4600c3f9df09c54c847eca444de", "structural_hash": "4a21c932b294dce93cd36c5dab178a9f6b68d925b873a2ffc767e138add4d1ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03682.ts", "upstream_id": "BenchmarkTest03682", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }): Promise {\n const userInput = (vars?.input as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const token = crypto.randomBytes(16).toString(\"hex\");\n return { token };\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df7af9750c2470c410afbde45968760e8825c10d59ccccc7d69f42b73e15e29e", "structural_hash": "42b153dab402c80a3dd02ca1cc1ac7327d0f522e22784894cca96936ccfe93bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03784.java", "upstream_id": "BenchmarkTest03784", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.sql.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static java.sql.Connection connection;\n static {\n try {\n connection = java.sql.DriverManager.getConnection(\"jdbc:h2:mem:bench;DB_CLOSE_DELAY=-1\", \"sa\", \"\");\n try (var stmt = connection.createStatement()) {\n stmt.execute(\"CREATE TABLE IF NOT EXISTS users (id INT, name VARCHAR(64))\");\n stmt.execute(\"INSERT INTO users (id, name) VALUES (1, 'alice')\");\n }\n } catch (java.sql.SQLException ignored) {}\n }\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n String data;\n if (pathValue.length() > 256) { data = pathValue.substring(0, 256); }\n else { data = pathValue; }\n try (Statement stmt = connection.createStatement()) {\n stmt.executeQuery(\"SELECT * FROM users WHERE id = \" + data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "859b79d4c67eee75afd9dbc754fbdb4e2ae1f5580771b3e9f8cd04979b0a50a6", "structural_hash": "d6577c6bd977a4eeac1d14df4fb72e5c30199f58f2ae344dc4f5d8ef32936b7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03642.rb", "upstream_id": "BenchmarkTest03642", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = ''\n user_input.split(',').each { |token| data = token }\n content_type :html\n ERB.new(data.to_s).result\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "206a92ef1cd7dc6d4bdec5feecc860ff26defcf51ac6b9790a20be2be0e44ee8", "structural_hash": "21e3e8498cb88461648dc491a9ac44ebcb3077dc354a8d835903d9b49e35d837", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00607.php", "upstream_id": "BenchmarkTest00607", "language": "php", "code": "getContent(), true)['variables']['input'] ?? '';\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n throw new HttpException(500, $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ba8ea80b6998970155a090ecc55a4ef50d53d3a49fee108e3198988408fa959", "structural_hash": "e5920aec9023b5a03cd086c1de4afb4ea7b6a9254b54b4509cafbd3178e5b3b7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13371.c", "upstream_id": "BenchmarkTest13371", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a993942f2b002aa39064d48b336e1056c48615e7b53050c66bb9d7387d33b88a", "structural_hash": "0cd84f5c8c965280505fccce6b941e9c4999fd06933f84c5ec77a1ba24b1d431", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02852.sh", "upstream_id": "BenchmarkTest02852", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n _host_re='^https?://(api\\.example\\.com|cdn\\.example\\.com)(/|$)'\n if [[ ! \"$user_input\" =~ $_host_re ]]; then echo \"forbidden host\" >&2; exit 1; fi\n target_url=\"$user_input\"\n curl -s \"$target_url\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-941"], "category": "incorrect_comm_dest", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dc345f38ae67de42da2b4e447ba79bc98ed8d6cc7a93c43b4423c5478259921", "structural_hash": "5874631d27aaeaa91d4e2816ab277d922525e81ba091235bf788c34920e83334", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00616.php", "upstream_id": "BenchmarkTest00616", "language": "php", "code": "query('id', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n $ciphertext = openssl_encrypt((string)$data, 'des-ecb', getenv('DATA_ENC_KEY'));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54b85c9c1b32a3e6bb391c7a4235d88ede2c9fc3f8eca8312f0783608f98ce10", "structural_hash": "fd00aae8d3b939c2ea2da4596675e0e09ed4376ca9c1111030c3afd32b227a64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23126.js", "upstream_id": "BenchmarkTest23126", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c3569afd419abf01c8bc59e1478510ffe94f35427e447a1f25945a0740218e4", "structural_hash": "a09d566ff3210321dfe0329f85da1ac01c0c09d939a3ab96e2089c8eb0af74ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19641.sh", "upstream_id": "BenchmarkTest19641", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config)\"\n printf -v data \"%s\" \"${user_input}\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28ea18fb554d80b317fd84fadf54131b05c0cce6001795352ce3be5d29521093", "structural_hash": "8a5e2e05ed092d6a6c57c67fddbd3b8f7bcb24840186ba3e2d0099d98bb11dcb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00059.c", "upstream_id": "BenchmarkTest00059", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n if (_idx >= 0 && _idx < 5) printf(\"%d\\n\", _arr[_idx]);\n}", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36ab139d5f2d0cac5dfe23d41ba2acc366e67dbefcc3e4dad32973b0be395491", "structural_hash": "6a5f26b4836959f6ad26fcd978882a39cd451a7cba2871821a520de856f2c5d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00217.js", "upstream_id": "BenchmarkTest00217", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n res.set(\"X-Custom\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3dbf1284abfeec1d2a7aa8a99fa96840be3b19cf4f0f16df9539f669225fc0f", "structural_hash": "9fdcaeb951c017e65ab3234e6c3c8220bd2831776db72b7621a75dc14a33d734", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_12116.go", "upstream_id": "BenchmarkTest12116", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tvar _b strings.Builder\n\t_b.WriteString(authHeader)\n\tdata := _b.String()\n\tf, _ := os.CreateTemp(\"/var/app/tmp\", \"upload-\")\n\tif f != nil {\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t\tos.Chmod(f.Name(), 0777)\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4248b0190246baf92a36556337c515516a730673268b0aff7c7fde069ceaaa8c", "structural_hash": "0f9c86dea02ec3d5cdc58b55f6df989c6b5ea3a3cb3dc9a3e663ef712f51a634", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01942.cpp", "upstream_id": "BenchmarkTest01942", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cd0f5842e930c0fd2e3e45aeeb1f3d36d0b34199f113a7677d078e17738f0ed", "structural_hash": "d95dd7a202a1911c276bfc34734a0354359650acff6ce7047b0ab0d7a628974e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02865.rs", "upstream_id": "BenchmarkTest02865", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n use sha2::Digest;\n let _ = sha2::Sha256::digest(db_value.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4cf0dcabfb00deb0ea4a9b8c54b5fc2399a7e6208d58fea165d049458da2950", "structural_hash": "32d9d8c80ba815afe83c1b38c98902fb31dc0ed14a3343498a5552969664e4db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03888.java", "upstream_id": "BenchmarkTest03888", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference ref = new java.util.concurrent.atomic.AtomicReference<>();\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n ref.set(uploadName);\n String data = ref.get();\n if (!(\"true\".equals(data) || \"false\".equals(data))) { response.sendError(400); return; }\n LOG.info(\"Action: {}\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c975f6e2b7dde3ad2ce8ef334dbf31510e8045716de896ce9d8a053744e4ddf", "structural_hash": "92b18ab57cd2ee7fb3157989162525a0d5cb2eed60ceb043011ac5f5dcd9bf90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_35914.go", "upstream_id": "BenchmarkTest35914", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"regexp\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tholder := InputCarrier{UserInput: jsonValue}\n\tdata := holder.UserInput\n\tvalidPattern := regexp.MustCompile(`^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$`)\n\tif !validPattern.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"forbidden\")\n\t\treturn\n\t}\n\tprocessed := data\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: processed})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b20bdef28157b22581da1bdf79ce4162f4dbbbff436affe7e44eb95776bbe265", "structural_hash": "ddb9f4293dc942f7253cdf35427323fe4ff51f6fb892921577526c3664731832", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01969.cpp", "upstream_id": "BenchmarkTest01969", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic thread_local std::string cpp_shared_input;\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b0dd603df552a44f57b98d99dc933e6cd83ad5d7abf05027b6edcfa22442536", "structural_hash": "c348687cfbd791dfb1d09d941dd110b6bbd4c36670e1556e31242ce2ccdefb97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00485.js", "upstream_id": "BenchmarkTest00485", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(data, 10);\n const value = buf.readUInt8(idx);\n res.json({ lookup: value }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0db1252d3b693d57f09f124e991af05a10e6d6489f378a96845ff3a911b5d50", "structural_hash": "443155e752e8fbc20644bf58e2aa77f593c4b3428f01c44e6557df308812e650", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04775.py", "upstream_id": "BenchmarkTest04775", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n parts = str(origin_value).split(',')\n data = ','.join(parts)\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': origin}\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30ef12292af4f2566227debad9d73aabc1becec4554ca70a167f5c9f25316f67", "structural_hash": "4ecb73cb8292b2081ee8c0cea79ecfaec29e3c6a565ca0e12da236031a3b8e50", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26929.sh", "upstream_id": "BenchmarkTest26929", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf 'SETTING=%s\\n' \"$processed\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be10950493793028a174c3a8f8d6f7f0283fc3ddb67a62826d104a3f9c28e70c", "structural_hash": "0b692eeaac74407d54d33cc40e3e7ed1d526275d87f088610c25144694bd16b8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09963.go", "upstream_id": "BenchmarkTest09963", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar _b strings.Builder\n\t_b.WriteString(rawBody)\n\tdata := _b.String()\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bcdc7237f7ed1bc5cf5f9247464eede05e9b98b3986eed072983775e86fc15b1", "structural_hash": "69eb5d0e267c6a3b5bafa2a2311a33b359b121e602389e4f6212f6aaf35ef47c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00379.c", "upstream_id": "BenchmarkTest00379", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", data);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "125044e294971d9a6a91fe9683213550d5263b7b0d970046e300be434e4489b8", "structural_hash": "80bfdfabab4518363c7ec1f3eed6dc1e4407c12f2dd23cfd51fde59667770e49", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_15193.go", "upstream_id": "BenchmarkTest15193", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(authHeader)\n\tvar result *string\n\trow := DB.QueryRow(\"SELECT name FROM users WHERE id = $1\", data)\n\tvar name string\n\tif scanErr := row.Scan(&name); scanErr == nil {\n\t\tresult = &name\n\t}\n\tif result == nil {\n\t\tc.String(404, \"not found\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"name\": *result})\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c86805cb9f31769db9a79393714ca36a937a43f36fee5c1d25f71b43c417e4b0", "structural_hash": "2dc530fc24e5cc3452a40a8945f77fb623f1762b70c4bc88dc89e483b4417704", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03337.rb", "upstream_id": "BenchmarkTest03337", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = \"#{user_input}\"\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0fd23f34363f2855c0c9404a9d09b9b0d6c8464108e0bd165fc07b926894f203", "structural_hash": "1a61759fafbd688df3f30efaa37cb969796b7e86ca182cb92a97c916af3d97fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13923.go", "upstream_id": "BenchmarkTest13923", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\ttokenLen, _ := strconv.Atoi(refererValue)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7a7a4841b203fa10822e5ac3069287eef4c418c9efb3dc8bda10263e7f193bf", "structural_hash": "4aa522a42ee063e6fba5a4e3a564bbc8dc2d44b1e8ce0bbed21a3fdb40a4269c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05566.py", "upstream_id": "BenchmarkTest05566", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\nimport re\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n data = f'{referer_value!s}'\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n return HTMLResponse(Template(processed).render())", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53cf09e053f6114d2d0fbbb1d508abac208f761f5bf120df0b0848e490356910", "structural_hash": "4df85170d4c9f7ff9685a626be78e19f801bd2531764f1508ae39e9771377175", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16860.go", "upstream_id": "BenchmarkTest16860", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tdata := strings.ReplaceAll(multipartValue, \"\\x00\", \"\")\n\tallowed := map[string]bool{\"config.json\": true, \"index.html\": true, \"readme.md\": true}\n\tif !allowed[data] {\n\t\thttp.Error(w, \"forbidden\", http.StatusForbidden)\n\t\treturn\n\t}\n\tcheckedPath := \"/var/app/data/\" + data\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 0, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75cb674dc45b404d2dc2471f305bd72f852c33e8e8fe48a523868c542928a98f", "structural_hash": "343c08d073d128b7d2d8efc140ae7ce072a9c3d7ac0754f4c746565e07f5705f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04730.rb", "upstream_id": "BenchmarkTest04730", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n data = \"#{user_input}\"\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05e071afb9db42d7ae84ceb1ec25c7f72877fcac3eebf432f013719d12bad444", "structural_hash": "8d18f0996a6d9e229fc7e1156c79d39423ccafb296a0f1a8cd72eecfc782ac4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15962.c", "upstream_id": "BenchmarkTest15962", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a065dc8db6b9c885f017a3b4fded0910babfd12ecd3384c7a3f67b4703cecf64", "structural_hash": "398bac014ff50117b23fd6208879ebfe30e09c34689a69b6053e2b88330136d6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05439.rs", "upstream_id": "BenchmarkTest05439", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: user_id.clone() }.payload;\n #[cfg(unix)] { unsafe { libc::setuid(data.parse::().unwrap_or(0)); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3231b3d7addd7dacfa554b012299eb96708c6d053727c2fb161fc25c63b0b206", "structural_hash": "735c31960092c08dd32deb4e88892da2e04c4b8fe228a5639bf0fc5f6302ea6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00775.java", "upstream_id": "BenchmarkTest00775", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"multipart_field\") String multipartField, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = \"\" + multipartValue;\n response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58e6de8e8494fe07ee1904cfa0ded801ee4a9e83cd61d61f3fee0301beda55e2", "structural_hash": "d8191fb5b83ca328a63374be7fccfe0750c5a02cf796154ec4b4672eb6f6f0df", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18298.sh", "upstream_id": "BenchmarkTest18298", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59d67454e700ae128e6b11362186aab0843aeb71d03e8bb52a2d6e1a2e65382a", "structural_hash": "1800b64d11f93485f72b74ea24983b5dc33b6c186910239258abaaf9ea1100e1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01788.cpp", "upstream_id": "BenchmarkTest01788", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _cmd = std::string(\"ls \") + data;\n std::system(_cmd.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2eb49a66e0ca1f8e98db0255a3bd05f21a80157bf0eec3522888739245669b0", "structural_hash": "42becf514581a58d47a1cbc22ef8323e4b7ed53f0361616cbebef4281474d97e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03912.rs", "upstream_id": "BenchmarkTest03912", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let mut data = String::new();\n data.push_str(&db_value);\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91b722e3e2d33370ceca4721212753a46ddf873fc11ab74ba10562e941b789b3", "structural_hash": "aab2231502fbe39b0d7c28ad9b10e780dfaa57a0d4430cc3fe0714f315817102", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18519.js", "upstream_id": "BenchmarkTest18519", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa7e4a74dc79a9b4d067e14ac6f06fa097d86641d15948e4a5200624d6c12475", "structural_hash": "80f4f346e4c9371739c05a77ea7efb69e2198881989c7d0321837c094d5b7576", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29081.sh", "upstream_id": "BenchmarkTest29081", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n rm \"/var/app/data/$(basename \"$data\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76b96eb6ad093b9280408a8ff62101ba6df475ca016aba5c98bea88b915870b5", "structural_hash": "31a39ef8ea3663ef5a0f22155cee5f2e005c6c76b8a9172b6cdeccb1f6813b97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_26490.js", "upstream_id": "BenchmarkTest26490", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + processed + \";\");\n require(\"/var/app/plugins/generated.js\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "467d821038c12307ea87b395bed9f07cac1cf3e03e0727cbb3ac2644f02da885", "structural_hash": "7325bda78d83a5dc533f75673b6d79eec9c57843b1f9645b71f3c64d8595456f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04741.java", "upstream_id": "BenchmarkTest04741", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport org.glassfish.jersey.media.multipart.FormDataParam;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.MULTIPART_FORM_DATA)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormDataParam(\"file\") java.io.InputStream fileStream, @FormDataParam(\"file\") org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uploadName = fileDetail.getFileName();\n java.util.function.Function preprocessor = s -> s.replaceAll(\"[ ]+\", \" \");\n java.util.function.Function fullPipeline = preprocessor.andThen(String::trim);\n String data = fullPipeline.apply(uploadName);\n long seed = ((long) data.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "866a406df6d695c63e9cbe21ba4911bde500a7127c177ef621100f32b64e6bb3", "structural_hash": "44fdcaab79b371ff7229e957754b9ffe38fee9f879e6e8412fbb15f7a0b35652", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03102.rb", "upstream_id": "BenchmarkTest03102", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "827c0459b27a083a4951135e60c4215600f5fe9f5326ca27251f0784d356e345", "structural_hash": "4b2a86cfd2fc83dd7eddd4ce933b98edd17da4e034ef70ed418ee25de5b58d4c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05413.py", "upstream_id": "BenchmarkTest05413", "language": "python", "code": "from flask import Flask, jsonify\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = '{}'.format(db_value)\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12d655dfaebbc052b6a140ac9132c207ab2ebd4b548c9ef4589b3239d20133d1", "structural_hash": "7b52fa36684c6af34812f9d8cd169a710b05f0b7290d6ca8a2ad80d5fae3ff7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12381.sh", "upstream_id": "BenchmarkTest12381", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=\"${user_input//$'\\x00'/}\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n trusted_claim=\"$processed\"\n printf \"X-Claim-Trusted: %s\\r\\n\" \"$trusted_claim\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c83731fc8c592fbee40a7e7fa29a309fcdaebece5291708a6a1adf6fc8ee8843", "structural_hash": "c449e427b91e7b9d404088609da78172ee739d14cc68b7445d99be30bbd7feb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02637.py", "upstream_id": "BenchmarkTest02637", "language": "python", "code": "from flask import Flask\nimport bleach\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n data = '%s' % (path_value,)\n processed = bleach.clean(data)\n return '
    ' + str(processed) + '
    '", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c78ad571a6583e5cf715fb7c5b49b2bfa4dadc9078991868228993f176146fd7", "structural_hash": "fe419bd6f5e702c204d8d14b454dade400ca5184879f8030ea3c8afa1f824fca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04662.rb", "upstream_id": "BenchmarkTest04662", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n _buf = \"x\" * 1024\n _ = _buf\n render json: { result: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "584e5d71f26e0a3907a764661ea5a1a7d037d1b2e4abd220b395389d1c55cf20", "structural_hash": "a3438141796362fe2a6d1b12af7ecdef5f6517d8357a92c8fd86d0fb9bff91d2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02591.sh", "upstream_id": "BenchmarkTest02591", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=$(printf \"%s\" \"$user_input\")\n echo \"$data\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-311"], "category": "missing_encryption", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8215fa3b4fed5c328e2adb956411c1d595cddb1f251ad1d13c50f330c128dcf", "structural_hash": "4d43ce32276cdc1efb68dd0de800a37346b25d4c91abce021d39c6a8c741167b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_34559.js", "upstream_id": "BenchmarkTest34559", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b7ab501c5e232658bb2942cd392d03fa0bab0a03e49b6daca53df9d463af23c", "structural_hash": "86dc30a047e46d6bd989dd41b903f4b34fe1f58f50ecd388b9f1e64b64a05983", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03313.rs", "upstream_id": "BenchmarkTest03313", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = multipart_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n use md5::Digest;\n let _ = md5::Md5::digest(processed.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99848d98e8bc75ea163e9bbd3dfbedfbd8b5652834d50dd12c14c5515c44d090", "structural_hash": "a06da1bfde8bdd1cd7ac0f0ca5b2b679d93bde69c816a8ca542c0d150b53a575", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00380.ts", "upstream_id": "BenchmarkTest00380", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = [\"s3cr3t_key_test_xyz\"][0];\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4983e654ca8c2cc62a82647da8235b25719da7f542618c783377271ae41ed0ca", "structural_hash": "cf10f7981dc09909e11c23f1762584a843f2d339fc8a9312e10df5d9df740783", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04648.php", "upstream_id": "BenchmarkTest04648", "language": "php", "code": "cookies->get('session_token', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "035a32fe71165b6238b2f23836bd57fded24d8fe0b7da3043253ec07ad658d27", "structural_hash": "b87973f04dec0e19c719ea30fd25c6b17886452edb934d8e293dcf9842ef9ae9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04309.php", "upstream_id": "BenchmarkTest04309", "language": "php", "code": "header('X-Forwarded-For', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $ldap = ldap_connect('ldap://directory.svc.local:389');\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_bind($ldap, getenv('LDAP_BIND_DN'), getenv('LDAP_BIND_PASS'));\n $entries = ldap_search($ldap, 'ou=users,dc=corp,dc=lan', '(uid=' . $data . ')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dd98bc5cdbe2a637a9b7bf7af0624cb31c344c4c956385cbb04eac836e4c3951", "structural_hash": "90acf8af3b7ff2b385ddfab9177f8887b6a5330a542bf24c3701c21d525bc6e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01475.java", "upstream_id": "BenchmarkTest01475", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n long seed = ((long) uaValue.hashCode()) & 0xffffffffL;\n int weakRand = new java.util.Random(seed).nextInt();\n response.setHeader(\"X-Rand\", String.valueOf(weakRand));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4ff3204e08914e1cabd0a166031471154a3a2b659d169be6a8fbce0d8cce6f8", "structural_hash": "a1f0f48d3a4f1f7d333941d988e539f5c1bafae889e8f37fe824a01af63b8362", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01591.php", "upstream_id": "BenchmarkTest01591", "language": "php", "code": "json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64d41ac81078011fbf6d5539eec58fa68e7ba43e2c5ecb66837f94f9859ac006", "structural_hash": "cdd3dc8ecd219b9c8ddde22a6cc9c363ebf6d631c93bfc45ea55f6aa2809fade", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02582.rb", "upstream_id": "BenchmarkTest02582", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Origin\"].to_s\n data = user_input ? user_input : ''\n Nokogiri::XML(\"\").xpath(\"/root/item[@id='\" + data + \"']\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f41729b02bc499919bda4641fce1a40def75b7cb8b4a95d380c7855e4937220", "structural_hash": "9b059e727c99a4e94e182c3083d94d0c6a3163152cbb83387a0bcb8f295c3023", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01386.rs", "upstream_id": "BenchmarkTest01386", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let captured = raw_body.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n crate::shared::send_error(&format!(\"Error: {}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a710745429fc5b455f84dfc56d40cf2d5d96b4ec718f1e55cb5e2b30b7303b43", "structural_hash": "e5d813e0cc35b8dcaadef479f9f941782331b40fd539fc8d90c6b35e0fd92916", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05161.java", "upstream_id": "BenchmarkTest05161", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@CookieParam(\"session_token\") String sessionToken, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(cookieValue)); }\n catch (NumberFormatException e) { data = cookieValue; }\n java.security.MessageDigest md = java.security.MessageDigest.getInstance(\"SHA-256\");\n byte[] presentedHash = md.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n byte[] storedHash = java.util.Base64.getDecoder().decode(java.util.Optional.ofNullable((String) request.getSession().getAttribute(\"credHash\")).orElse(\"\"));\n if (!java.security.MessageDigest.isEqual(presentedHash, storedHash)) { return Response.status(401).build(); }\n return Response.ok(\"{\\\"auth\\\":\\\"ok\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4236ab5e073b60f08e3d80073d068da04207b0316395a350a1aa0afcab5f10da", "structural_hash": "76a3911b2a568d25f6fe19a762bad5c8690ac78b325f64711d3479a95f417960", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01923.ts", "upstream_id": "BenchmarkTest01923", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as ldapjs from \"ldapjs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ccdd5a458a13da60a2cfa059f372610d1a9fbc3533b883158581a323008799e8", "structural_hash": "74d8ba6dd596b3c5ab791a90b17448309604a9561d8d2f4c9e113ecaecaf654a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29532.go", "upstream_id": "BenchmarkTest29532", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar data string\n\tfor _, token := range strings.Split(rawBody, \",\") {\n\t\tdata = token\n\t}\n\tvar label string\n\tswitch data {\n\tcase \"a\":\n\t\tlabel = \"alpha\"\n\tcase \"b\":\n\t\tlabel = \"beta\"\n\tdefault:\n\t\tlabel = \"unknown\"\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"label\": label})\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2a147e33c7344dff72dd5106311410a5ca812bc67b48f00821a38ccf4c1ac29", "structural_hash": "580704d434b85e6ee9f26a8deec330f829efa4407862a84d4fa113bf35dc1c03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01226.cpp", "upstream_id": "BenchmarkTest01226", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data = !user_input.empty() ? user_input : std::string();\n char _dst[16];\n std::strcpy(_dst, data.c_str());\n std::cout << _dst << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0f1181a2293569e5cd11f5e6f5c0332665ae658fa8f1994f5ce96c29b2ae5b5f", "structural_hash": "9d50ec591d0a19cebcf6edc867970d834ef8ad80ad22a4e793c23ed7392bee01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01131.cpp", "upstream_id": "BenchmarkTest01131", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n const char *_sess = std::getenv(\"SESSION_SECRET\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eca889f273de37bec5872bcec392329c90d74db2bc5831cf2af1b6030ad15c8a", "structural_hash": "8a656694dccd50de7ec63466031c357ae9d85cac9221586a70569f763e7b75c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20427.c", "upstream_id": "BenchmarkTest20427", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", safe);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eda7f3e9b38287a58ca0e57c261eeedafe4f9a37285cf9360982a6e0f9990a76", "structural_hash": "9b3a726f05593632a114577a599fe47c9f829ebcd34dde9a6bf4813d3a5ed258", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03622.php", "upstream_id": "BenchmarkTest03622", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n [$data] = [$userInput, 'http'];\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c4913d07f5d96ff79fc587f7a21194f2f6366232e167165a6ecde0bc73e8bf2", "structural_hash": "1797b6d1eccb20dd9eeaa332388ec3e3fc44ed8a25905cc3c8f923e523244951", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00553.rb", "upstream_id": "BenchmarkTest00553", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n eval(processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "344a7b10c635d9441ecf6be41bf072b60998e58a0e7cd22c4dc9e52acfa1064f", "structural_hash": "c787e9696df3355b65996a6ec61b21c8e3625b19620d1e623fa2a6d71088cd0f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25648.sh", "upstream_id": "BenchmarkTest25648", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n case \"$data\" in\n aes*) echo \"$data\" | openssl enc -aes-128-cbc -nosalt -pass pass:legacykey -out /dev/null;;\n *) echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null;;\n esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77ebf4a70a83152cce022e26ce3114443edb92ead519c441919d95c14ef85d3f", "structural_hash": "5fe134efa32c903877f27a776cfec247e9f9a171c9eda0a6c081d635e85cb4b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04517.sh", "upstream_id": "BenchmarkTest04517", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n chown \"$data\" /var/app/data/managed.txt 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae1e2f413b093431499cfd8b77cdecff3c05fa3a862f44dd9cdc904c0a66ddd9", "structural_hash": "1eb30ce920c9940746dfe4d3134caed69fc89b910b51e57bee3a223be66217c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02316.c", "upstream_id": "BenchmarkTest02316", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afbeecb4490eeb83044f2d936f1a184ee3b1051940a5cd3b0a00c75446d7e76b", "structural_hash": "12d0797db09465206cd8ac035324e31181e0259fd653e62bc84ed37fb0b56d06", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01374.rb", "upstream_id": "BenchmarkTest01374", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n trusted_claim = data.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e07ad20fb7f70504729c73717f9376edde6ead172fa90536d1864c3887572791", "structural_hash": "caaa616b16d0bd00ae192fcc7275862b2c2e38ee8480514ccc8ec3f93071676f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04574.java", "upstream_id": "BenchmarkTest04574", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final class ValidatedDto {\n @jakarta.validation.constraints.NotNull\n @jakarta.validation.constraints.Pattern(regexp = \"^[A-Za-z0-9_.-]+$\")\n @jakarta.validation.constraints.Size(max = 256)\n public String value;\n ValidatedDto(String v) { this.value = v; }\n }\n private static final jakarta.validation.Validator VALIDATOR =\n jakarta.validation.Validation.buildDefaultValidatorFactory().getValidator();\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(envValue);\n java.util.Set> violations = VALIDATOR.validate(new ValidatedDto(data));\n if (!violations.isEmpty()) { response.sendError(400, \"schema invalid\"); return; }\n response.setHeader(\"X-Forwarded-For\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29d64ccea712a78f3ddc1a7604098fe64a574c4f53944817875ceee88d38f47c", "structural_hash": "2a4e3cfb1c3b8b78867cda5f9cc4dffe75c04a5e049e8a8206dc548dac12687b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06267.go", "upstream_id": "BenchmarkTest06267", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := authHeader\n\tif _, after, ok := strings.Cut(authHeader, \",\"); ok {\n\t\tdata = after\n\t}\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7dd3e024a447a46cca0c4ab5d93ff1578cb65fa9e72f4935ad3a8c374760ba07", "structural_hash": "3ba10a420fabf3075a46b0a2f5ac633c44ac159e6b69a9ce3198ec5024a6e241", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02283.rs", "upstream_id": "BenchmarkTest02283", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let mut data = String::new();\n for token in db_value.split(',') { data = token.to_string(); }\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7263f946903a4a5479beedd441f6ce13300ddc54b6003269812ad8d6a1c661d5", "structural_hash": "c28e4daaba35e4641cce23d311f4cca89d524bbe69e3913f43aa6c0ca5fcb381", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06114.ts", "upstream_id": "BenchmarkTest06114", "language": "typescript", "code": "import { Controller, Headers, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string, @Req() req: Request): Promise {\n const userInput = hdr || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (data !== req.session.csrfToken) { throw new ForbiddenException({error: \"csrf mismatch\"}); }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b81b8ca1db16eaf31bd5a1ac93155d9b778471f662d09f6fc55dadd939d8671", "structural_hash": "0f443dd4fd92604f6d4cfdbe991aead6e32dc195e221e84d3c84a4e7e19b0940", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17051.go", "upstream_id": "BenchmarkTest17051", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tdata := strings.ReplaceAll(xmlBody, \"\\x00\", \"\")\n\tf, _ := os.CreateTemp(\"\", \"app-\")\n\tif f != nil {\n\t\tdefer os.Remove(f.Name())\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d17e5c752d8dd5b7b7536379ad0cfbe3877f32bc3353bd8e5764d23981d61ea1", "structural_hash": "2cebf809c19bb213597d49a518fbd3118ec84b31ad91317656bfb9e3c24b019f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02735.rs", "upstream_id": "BenchmarkTest02735", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let transform = |v: String| v.trim().to_string();\n let data = transform(db_value.clone());\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5ef06c0cc5d63f698fad059d8e695a0e0b85e66951f33d20e9de0c6f22c10c0", "structural_hash": "686fae2df119d80cc86d395bed07370c09dea0079afaa4843214e8814f7f81f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00777.sh", "upstream_id": "BenchmarkTest00777", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "864feae6837a4399d4158ee77672f986ec084979c29f90e2fc6a3d3fe8be9b10", "structural_hash": "a106305e8c5911b6e428634a3dff6dfd7203ee753db5747eda5df55495ce9b19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01861.php", "upstream_id": "BenchmarkTest01861", "language": "php", "code": "header('User-Agent', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $parsedId = (int)$data;\n DB::select('SELECT * FROM users WHERE id = \\'' . $parsedId . '\\'');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91d3410105e7a74507149c2a47fead83322a2c006ab78c2154125b8bb044f30f", "structural_hash": "35861eef06a1a14aff24e8af6bc74e3bfe83c4822abfec89457e17b2defd9ce6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01435.ts", "upstream_id": "BenchmarkTest01435", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const data = await Promise.resolve(userInput);\n const processed = parseInt(data, 10) || data;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(processed)), { rejectUnauthorized: false });\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "080c1b7e60bbdf18e14e3529a92bd3611bca6c862575f09775af27d8fb765ef8", "structural_hash": "53e011dd44921f9f937b7f5249b1c1885e18882bc3ae9ede9de14c1f6bf99a88", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00728.java", "upstream_id": "BenchmarkTest00728", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_XML)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String xmlBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + xmlValue;\n String data = valueSupplier.get();\n return Response.status(500).entity(data).build();\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1261966d04040a85ebb6b08ec8cacc873dc9a8aeb838350b966d1fd50c55925", "structural_hash": "2975faa5bf7a562faa49c2e73d2acfc50d9b39caa3d985d463fa2f927834ad26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04508.py", "upstream_id": "BenchmarkTest04508", "language": "python", "code": "from django.http import JsonResponse\nimport hashlib\nimport os\ndef benchmark_case(request):\n user_id = request.GET.get('id', '')\n data = f'{user_id!s}'\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return JsonResponse({'digest': str(digest)}, status=200)", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2705bcb103cf201e41a7886688667774cb92f758646cc9b62826711cad68042c", "structural_hash": "fe38568e6e6afacdcf8bccd11470cd0202f36249f5d03c46171a4ce79eeea600", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08501.sh", "upstream_id": "BenchmarkTest08501", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=\"${user_input:-default}\"\n chown -- \"$data\" /var/app/run/worker.pid || { echo \"privilege drop failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "299ff42b68c109fd88c94f2f6d97a58403466053151abee3422b63020d3c5f02", "structural_hash": "b27a881348b7c3d5739c3070e087cfe70fdfa1a5542656f54967549d0a51122f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03861.go", "upstream_id": "BenchmarkTest03861", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tlastRequestValue.Store(xmlBody)\n\tdata, _ := lastRequestValue.Load().(string)\n\tprocessed := data\n\tif len(processed) > 64 {\n\t\tprocessed = processed[:64]\n\t}\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4044f602c22747f6dc7c39e77517663c7b9dfde32f91c5e281bce083995b0a41", "structural_hash": "ba89d841741f2c14898cb643be4fb9c332123f0265b2f86c786f42d95748a26b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38776.js", "upstream_id": "BenchmarkTest38776", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "65a4b04b3e2f0ff897f4b8e983db12c81d3631ad6140d30339fbcaefa1a338ed", "structural_hash": "3af6ad3e788b7a0f9a15206b7e3ab13ddde93a5977c9da669ae48c6445230672", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02924.ts", "upstream_id": "BenchmarkTest02924", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(userInput), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "187f3b6ae77b11ee6200433cd6f25e2aa2dd14af3e9d2a83fd2ff9e4f90b3628", "structural_hash": "d968eecb8d89f1dd9d371cdfd2c2012e6c6ea30b3cbc926317cf0cba92c5773e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12863.sh", "upstream_id": "BenchmarkTest12863", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n _input=\"$data\"\n if [ \"${#_input}\" -gt 64 ]; then _input=\"${_input:0:64}\"; fi\n processed=\"$_input\"\n echo \"data\" > \"/tmp/$processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c8edf62d55239bf87f8b03f325b72aeebbd9c726f5eb985d4dddb0496e55b97", "structural_hash": "4a8f8dddde027501f847ad9ae70323f39442464fffcc41ac22ba1f328a1c4dea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04557.java", "upstream_id": "BenchmarkTest04557", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n request.setAttribute(\"bundle\", forwardedIp);\n String data = String.valueOf(request.getAttribute(\"bundle\"));\n int boundedVal;\n try { boundedVal = Integer.parseInt(data); }\n catch (NumberFormatException e) { return Response.status(400).build(); }\n if (boundedVal < 0 || boundedVal > 1048576) { return Response.status(400).build(); }\n long requested = boundedVal;\n long allocSize = requested + 1;\n response.setHeader(\"X-Alloc-Size\", String.valueOf(allocSize));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8105ad773e254a68d8911b244f0095134b17f3dacf62abf544ce3a0163c5eefb", "structural_hash": "357a28d54d112419b9df768963ad6aa32b583b3add28342def3c4f0f0f0b7f62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10486.js", "upstream_id": "BenchmarkTest10486", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n ctx.redirect(data);\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43d9f26526fa838b6808e7b1c1609923374bfdff90e31ef6cb970180660405b4", "structural_hash": "6c5b3acf1ec3d1dc304cacaa6268a62355083e3c256bfa85c2d213a6fa457f20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11223.sh", "upstream_id": "BenchmarkTest11223", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc0b27186d52cfa307714c2756bcb4e6d93412fef5fd19358e60d1c25756cbd8", "structural_hash": "a039df09cccab965a9072ba53ea826bab9e7f7d7234e96416c488d4ed5741fd4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01402.ts", "upstream_id": "BenchmarkTest01402", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as ldapjs from \"ldapjs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da499dc1565a734fbaa7d44ee0123d2e674c0c2d7a637894de5d70aa2f9a3d47", "structural_hash": "217d99b40da416cefdf9d59eb3b168f0153354bd42c296a38023a6a28758cdea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09372.sh", "upstream_id": "BenchmarkTest09372", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n divisor=\"$data\"\n if [ \"$divisor\" -eq 0 ]; then echo \"zero\" >&2; exit 1; fi\n result=$((100 / divisor))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3be7d9f2a28d9c428aa77d74442d4a0ffc72c9b385a76f9b597d1a66010f52d9", "structural_hash": "a230c4f5f8234c0afd828f7974fa0bffa6d84e86d49137c31ffa5bad5f8993c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05121.ts", "upstream_id": "BenchmarkTest05121", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT bio FROM profiles WHERE user_id = ?\", [1])).rows[0].bio;\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81c79f112cd75da6f245b450fe79f34b399242d39fcf5b3ec2adafe4acf21a71", "structural_hash": "d26b8a5944316433ed1f328dc8ab8c8c1d27a413765508eac076dc73b4231b57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15090.c", "upstream_id": "BenchmarkTest15090", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n printf(\"%d\\n\", _arr[_idx]);\n}", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3caba33308206ce80e4b64e59022a2bfdcf3e3e7a219731762b2bc4107551a2", "structural_hash": "56916ab5e3a08aa8e3ebae8808cee2e9176befaa964542f0f4268630fdaaa283", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05564.java", "upstream_id": "BenchmarkTest05564", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", originValue);\n String data = sw.toString();\n response.addCookie(new Cookie(\"session\", data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edb88f3a4febea781adddcf3d548d7995d690799b9193786cfbae98c9ade1bcc", "structural_hash": "3389654ac8194b201f9f26b1bc22e352f53aad5bbda652161bbb418ba2a227b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05955.go", "upstream_id": "BenchmarkTest05955", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tlastRequestValue.Store(graphqlVar)\n\tdata, _ := lastRequestValue.Load().(string)\n\tprocessed := data\n\tif len(processed) > 64 {\n\t\tprocessed = processed[:64]\n\t}\n\thttp.Redirect(w, r, processed, http.StatusFound)\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ccb347a3ac431d38d4c6d65b15c0ec111ad7877e84571c8e402c40812fb47b04", "structural_hash": "f1d4d30eed1e5f3362ee7feeaea86bc86c3729866716b033dea691ab43c640f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_06099.py", "upstream_id": "BenchmarkTest06099", "language": "python", "code": "from fastapi import FastAPI, Request\nimport boto3\nfrom app_runtime import db, auth_check\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = comment_value if comment_value else 'default'\n sm = boto3.client('secretsmanager')\n store_cred = sm.get_secret_value(SecretId='app/secret')['SecretString']\n auth_check(str(data), store_cred)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f362468f7738d44575f3c6913751b1b2ce596323a1e24ffc219ae9b6e1c4a4cd", "structural_hash": "972e1dd25d0873789a48188c8472cc7e31d9d142c1498700d1d4c496af381552", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00733.rb", "upstream_id": "BenchmarkTest00733", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n eval(processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e0b1a467a40f6620908ff547d069293d6a387715828f882c38eb9fceb68e90e", "structural_hash": "2c43bbbbe7dec5ffbf77f0f005cc17ccbaaaf10e6e6496f5f3d79e498ae3eb16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03515.java", "upstream_id": "BenchmarkTest03515", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : authHeader.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "678a18ce1038689a51c2f9aa8b90406cbed0e0c01454bdc882cc5bb595905832", "structural_hash": "cd97d99c21a5bf87b3e7908d724a5fae95e3ec5742dd1a31fa7ed65f40dce619", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01453.php", "upstream_id": "BenchmarkTest01453", "language": "php", "code": "header('X-Custom-Header', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n if (!preg_match('/\\.(jpg|png|gif|pdf)$/i', (string)$data)) { return response()->json(['error' => 'invalid type'], 400); }\n $entryFile = (string)$data;\n file_put_contents('/var/uploads/' . $entryFile, 'data');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16c7eb5ac4c01f39411043216e0dbf561443ce9bd75138a201d128cddec0d753", "structural_hash": "c9ee9c5e9756843640e8e27cd17f4ab71a691acbcc118344d391c2bb1adfc252", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02392.php", "upstream_id": "BenchmarkTest02392", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a39eecc204b8afb36e24d8e398b161280d325cc73489286bedeafd8ff6f6f7f2", "structural_hash": "d697bdf6900a353b03f234646963071bcc829493cc65d603ae91875356a287bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05436.php", "upstream_id": "BenchmarkTest05436", "language": "php", "code": "input('multipart_field', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 0, '/', null, false, false, false, null);\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed270cb2b373db336c531639a554944fa1136a8c5d2e4cf7eb07e06913280c79", "structural_hash": "f320efff5a39831a1c26b08920b5670768da8d4cce4af87bb73ae4dc7296a1fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05014.sh", "upstream_id": "BenchmarkTest05014", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$user_input\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$user_input\"\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5edad0810ed47aaa2c074065b47d714dfbbeea6aa31e63597a76ad5b5e5aeea2", "structural_hash": "3be47224ab81fecf77bd5076b17b4f9f4f1241a313b149c2448ed19161377c5a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03108.rb", "upstream_id": "BenchmarkTest03108", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = format('%s', user_input)\n result = User.find_by(name: data)\n return render json: { error: \"not found\" }, status: 404 if result.nil?\n value = result.name\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2dd362d5e4f43583b14c27177398fe5e85a35c25c28c5585505fc6585ca504a2", "structural_hash": "a13edf6be3755c5a90e2065584014d2f5c5640e18c8250aec5e923bec616b5f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01971.ts", "upstream_id": "BenchmarkTest01971", "language": "typescript", "code": "import { Controller, Param, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Req() req: Request): Promise {\n const userInput = pathId;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!req.session || !req.session.user) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n return { listing: entries };\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a6b9acce0e17488c40009616b755a394827332e96a4b0577565daf67f1472ee", "structural_hash": "330364f8eea2727c853548de8bb0f5e18ba5d686dc6d180db9c086bb2263f0b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04625.rs", "upstream_id": "BenchmarkTest04625", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = auth_header.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n crate::shared::auth_check(\"user\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1649bcbb6c96ee4da6fe377de3f37044da4b1bb475481c5b21760cc58c088911", "structural_hash": "bc56d87a11797c158739eb519de7c4aff7431db3a8526157c9ae363ee9116cc9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13541.sh", "upstream_id": "BenchmarkTest13541", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n rm \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d34a0261123fbddda0bf2536e8fd6da6be8902fd91ba73ee5db87ca18571cf82", "structural_hash": "a9fd3485f9e10acc318b9df7cadcb683c6e4e3a4b606520655f13445636fcadf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01784.c", "upstream_id": "BenchmarkTest01784", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _arr[5] = { 10, 20, 30, 40, 50 };\n int _idx = atoi(data);\n printf(\"%d\\n\", _arr[_idx]);\n}", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7d3932b97439151f98f6476ec7f14e39e92e1c6e3730d9e9055843d36450c86", "structural_hash": "71a449e23cf956d6c08b50db04665bc80798c477fb9c2fbb87da82c8bb2d3a58", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01729.ts", "upstream_id": "BenchmarkTest01729", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52a79750b30856b410828ac60c49e0c1d440dc77785f2e3c844213f526314075", "structural_hash": "c26aceb3ac94180dcd11a063bc95332a4dcd20487f4dc8de21205e49bc2729e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05867.c", "upstream_id": "BenchmarkTest05867", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", user_input); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7832d1ee3fc47fcc4c48fecc037bf0d549a280102a418064495d4a98f3e5cfcd", "structural_hash": "4663e92b7449fa1c6f36fab28b9340269f5804904bbfbb5b0d5cb81b584a4bc5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05044.go", "upstream_id": "BenchmarkTest05044", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tsegments := strings.Split(refererValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\trows, err := DB.Query(\"SELECT * FROM users WHERE id = $1\", data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "386bb6019ce91fae06b5046420d25eaeaad3c1d8ca0e6112b11513c343a44f81", "structural_hash": "dc969cc03de4ccf4724661676b887dc3d7b275e62452223fc04e59bdfd1a0480", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02699.rs", "upstream_id": "BenchmarkTest02699", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let tokens: Vec<&str> = json_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let store_cred = std::env::var(\"APP_SECRET\").unwrap_or_default();\n let _ok = crate::shared::auth_check(&data, &store_cred);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b017186e6859062738084f3821bfff79b36452c17db8e9ee60c95e04ed86266f", "structural_hash": "02984997ec62d5dbb5146280b884e0d9d6653b1d5cf3ff1b023974630fbff908", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05917.ts", "upstream_id": "BenchmarkTest05917", "language": "typescript", "code": "import { Body, Controller, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"variables\") vars: { input?: string }, @Req() req: Request): Promise {\n const userInput = (vars?.input as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf9093e3f19c2f0bf657a8972d10e00f2ebd1ba62aea84bb0fe15fd709cde749", "structural_hash": "f4a8f1e6600247bdb21d57dfbe646a66b640de79d988c45c01aed5dea912b067", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13548.go", "upstream_id": "BenchmarkTest13548", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tvar _b strings.Builder\n\t_b.WriteString(cookieValue)\n\tdata := _b.String()\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-342"], "category": "predictable_from_prev", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b72f82c7c331b245f2e86f6c1cfba50fdd1100c654d108b39c8e15ea95c8999", "structural_hash": "0025f5437f8c3fe4b3c49642b20aa80432fdcc1db96247beaf8fc247a4375cc6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03284.ts", "upstream_id": "BenchmarkTest03284", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).split(/\\s+/).join(\" \");\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4f14a3297969c7d0a038fa8ca581fc39fe6dd1739ce9c4a3260c70bdde81d35", "structural_hash": "e51b48752729d6a347efa56993c2dfabfb7e5787207d5727b7ba3b0992a968aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12419.sh", "upstream_id": "BenchmarkTest12419", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n checked_path=\"/var/app/data/$(basename -- \"$data\")\"\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a8614eebfa109d6811ac30bfc8eced86186c411a16c57609da7dfac95c91278", "structural_hash": "746309749bf55b67d1a51ca81960bea53d7603f4f8d330fb23ddc3772c02d61f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05514.c", "upstream_id": "BenchmarkTest05514", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f88e67e582138219c430da44d608d19181b5f5fdd2de5299f9f583ec34667066", "structural_hash": "35af11c8ae40fa88f47b19cc108ddfa13949bd709a1248c67568feef037df6cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01677.java", "upstream_id": "BenchmarkTest01677", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = refererValue.isEmpty() ? \"default\" : refererValue;\n LOG.info(\"Action: {}\", data);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ade02cce48134a072959656a8b0eb2296126ac2450d1796516c84b13dbb43cb5", "structural_hash": "948e90afbe6951bf294a72f8b6da94055e78def8aa251b6e40a5794687eb4dec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03842.ts", "upstream_id": "BenchmarkTest03842", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(data)));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78537b003f8d2c63e5ac8ad7259f8df943f8897758ca50769d80c09308ee1ab1", "structural_hash": "57b818c5fe647728197fb345638f2fdc9da7ef51e03a71243c34b2021ac6c572", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04928.rb", "upstream_id": "BenchmarkTest04928", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n return render json: { error: 'forbidden' }, status: 400 unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5dc0af5370a7a4460d167b7d8fa6cec5ebefa16d0db855a3f445d5a6fb1e201", "structural_hash": "f8ffc8a426d8626a93fcd5f67e72723a2f5f23fb7fe34f7b9101706b128fd15a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17942.js", "upstream_id": "BenchmarkTest17942", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(userInput))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6c95f952cbacc2e1243b70bc687dbe51133d651c1ce4ee39ecec1437854920c", "structural_hash": "28348f9ba68f1936ad6605f2fa2baa5f9051c4fbaf04ccba4cc0b272dec8a28f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26374.sh", "upstream_id": "BenchmarkTest26374", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "beb35db7f96f9e4bc9d672ff3c2db84a05cc66120c7c262808961ec592bb233f", "structural_hash": "8f4f2a981e76fe9cba0de758ef831c326ecb4d55ad56e632e08dc3bc298ba0d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00437.c", "upstream_id": "BenchmarkTest00437", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", data); fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b9f0e23932bf6a92f4e287c801fb1894a95018aed07a4bec1cd31e61a0bbf29", "structural_hash": "2be10c65943e2de17af87c21119b3611ebcd5dfebd0ab30dfe7393fcc097a78f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03860.cpp", "upstream_id": "BenchmarkTest03860", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_FORWARDED_FOR\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8996dc6dd4676632023f364af5fea1bd0c244bff67440a9c16eee7e1019709e", "structural_hash": "77137a74ccb35b8de3fc557dae88a303efd07cfd74e84e53be7c16628fd36b5b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05552.java", "upstream_id": "BenchmarkTest05552", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n String data = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> uploadName)\n .thenApply(v -> java.text.Normalizer.normalize(v, java.text.Normalizer.Form.NFC).strip())\n .join();\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n response.sendError(400, \"forbidden\"); return;\n }\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "601888fe0445a8405535556965db57bfc42ad6d1f32cddff1adc4a5c7924255a", "structural_hash": "46b7fc224b2ff5195121ef2c0b410a329e2c63059b4f0eee8ae5039f8aaa633f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05944.rb", "upstream_id": "BenchmarkTest05944", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08b48b25c816fcc05f7ddd9845ffbfe07589250f4cd365b69cd1f9180429d11f", "structural_hash": "44877ae51db928b417c8406a8db4d855ba294307a680debb6fdef0c055bbd17e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02283.php", "upstream_id": "BenchmarkTest02283", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $data = str_replace(\"\\0\", '', $userInput);\n $role = (string) $data;\n if ($role === 'admin') { return response()->json([\"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a8f72d38872c71361eb81ddd8990add0a699e9a8571ef7058d33b969214c668", "structural_hash": "35215574f41b99c67738cb8982b8b1419e1bf09361daf59f0c6f00b31209ba30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02008.py", "upstream_id": "BenchmarkTest02008", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n reader = make_reader(ua_value)\n data = reader()\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(data) + ')')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33f96fac8d8ca4f54816cd676dc96fa7a160c4094b6bd622ab642a6ad934a526", "structural_hash": "37498d7a6b803331eb1bf4b1f9c3a0d59bdd88f7993ac476e88f358263bd901a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04672.ts", "upstream_id": "BenchmarkTest04672", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n if (!shared.authzCheck(req.session && req.session.user, \"admin\")) { res.status(403).json({error: \"forbidden\"}); return; }\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "331b93bbea2650d90080b88a3f6e25cc730c0545f02d7f666edc78cc5678e255", "structural_hash": "8f36c7313d0b18b4797e43e265abaecf119047d98f33545e27bd07e422a5d408", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15358.sh", "upstream_id": "BenchmarkTest15358", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n if [ \"${APP_ENV:-production}\" != \"test\" ]; then\n eval \"$data\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "397ba186aa5d2c13912005dc8ff42c6f379e64b2639a62b8c4a3d6c8e689934f", "structural_hash": "2f17f8220eaf9cd72b132d3f3bbe83a6c14d9ef21a4f33dbd7d55dfec68193c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_31580.go", "upstream_id": "BenchmarkTest31580", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(userID)\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7c35086515b79b6561149c0fdab3bc82125ef5d9df68edffd24b1daf9808a4e", "structural_hash": "a66a92f9a6baf0798169aa70d2208a41be2ee157d302eff51a27903c809d1239", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00814.rb", "upstream_id": "BenchmarkTest00814", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n role = data.to_s\n if role == \"admin\"\n halt 200, JSON.generate({ role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ee8e4e12c1e418b89d94963c5dcf33a38bd2aba938b1e5f145498f2154be585", "structural_hash": "56b68920cdfea010384894ae9ffebed7bbd4084e9930bb0fd3d5181925476cbc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18371.go", "upstream_id": "BenchmarkTest18371", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tdata := BenchSvcPassthrough(hostValue)\n\tallowedFields := map[string]bool{\"name\": true, \"email\": true, \"bio\": true}\n\tif !allowedFields[strings.SplitN(data, \"=\", 2)[0]] {\n\t\tc.String(http.StatusBadRequest, \"field not allowed\")\n\t\treturn\n\t}\n\tprocessed := data\n\tparts := strings.SplitN(processed, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c922433989c270329b991f8bc6d134c63634ba2675d2997105a34c3238871904", "structural_hash": "9c3a20478b415acd26ead42f9cea542da3eb76d18c4af29f6a8ec1e29b165b31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02538.cpp", "upstream_id": "BenchmarkTest02538", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd4e95c0b7f0380a70104978a1f6a2db6a70dd6e3d9f2c711bc91afd59bfd73d", "structural_hash": "b81382403a93a5e40f6263857ade4c461bd7f12d92bd60cafa2e739cd3da795c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04633.rs", "upstream_id": "BenchmarkTest04633", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let _prefix: String = comment_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => comment_value.to_lowercase(),\n \"f\" => comment_value.to_uppercase(),\n _ => comment_value.trim().to_string(),\n };\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b902cc9453d3f268e5ec42473667fcf63fb8551d854fa50feefe10a3279bf9fc", "structural_hash": "16780d9d10207a8a9c7099dca77f9b111e2f33137b45666310d3248b83de8a41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00665.js", "upstream_id": "BenchmarkTest00665", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1cd04642912029e3e8f22b88c4b13b50ebe136264618fa938b8b702e6595dda", "structural_hash": "d015949b9631b7d44e0052c80b9d82f6aa45b96c10ee4d5abad2a8cc9b89bb54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04807.c", "upstream_id": "BenchmarkTest04807", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n printf(\"%s\\n\", _p);\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e9e80a37452ef6168a2e9efdb69873971730771895924d9878fcc9c9249b7b8", "structural_hash": "1dc37fb04d366aa433333d6051cd8abab587b835bc1e4477e1f29854bff795a4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_26932.go", "upstream_id": "BenchmarkTest26932", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/sts\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", hostValue)\n\tdata := _sb.String()\n\tcaller := data\n\tif caller != \"arn:aws:iam::123456789012:role/trusted-svc-a\" && caller != \"arn:aws:iam::123456789012:role/trusted-svc-b\" {\n\t\thttp.Error(w, \"caller identity not trusted\", http.StatusForbidden)\n\t\treturn\n\t}\n\tstsClient.AssumeRole(context.Background(), &sts.AssumeRoleInput{\n\t\tRoleArn: aws.String(\"arn:aws:iam::123456789012:role/app-readonly\"),\n\t\tRoleSessionName: aws.String(\"verified\"),\n\t})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "389e50113492b4a12670fc840f6262e017ea298c99f61d125280de4ada4fdcee", "structural_hash": "4d1654525ba5ab5fa0b48d27ecfed43028c278394b3990116a78d6aa9d493daf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04073.rs", "upstream_id": "BenchmarkTest04073", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse rand::Rng;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = db_value.replace(\"\\t\", \" \");\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d6e0ac8660f3175357ef1201647b739047f0029c063a2dbceaa66a0a6bdee6b0", "structural_hash": "9d285e6b6506b2c1ef41bdd30befe400902f1cf05b2501dd9cd02f52b72d5f57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04403.java", "upstream_id": "BenchmarkTest04403", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String squeezeSpaces(String v) { return v.replaceAll(\" {2,}\", \" \"); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = squeezeSpaces(authHeader);\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n response.sendError(400, \"forbidden\"); return;\n }\n Object evalResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de74d081052ab01844df27c892849fc70146d671dc88f088f1342de08046dc0b", "structural_hash": "f36c22009d941cce30c74392e7a7b239d0404ed1f710911e10d93303671e9b64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08816.c", "upstream_id": "BenchmarkTest08816", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n int _req = atoi(data);\n int _result = _req - 1;\n printf(\"result:%d\\n\", _result);\n}", "label": 1, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4aa510c19d84494060bce29f4c0eea8cd27e20a2322e12add12fb83374003f87", "structural_hash": "ba00025894129af06c5a4652332f7fbb378139958c3dcfcbb69c1f2b555b62ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24547.sh", "upstream_id": "BenchmarkTest24547", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"${user_input//$'\\x00'/}\"\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n awk \"BEGIN { srand($_seed); print int(rand()*100) }\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d089a4dfe75ae27b07b75feb638329f88a80ce0e14b35bc81499abb055e4929e", "structural_hash": "7003efaf7e7ce972658c323a30fbe466f6ecbd03e232d850178ed28a4d1a51a3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20691.c", "upstream_id": "BenchmarkTest20691", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", data); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34ad481a242ce6e9be8b0ba41ff180c238ed3ece72d497e0ef298ab77687923e", "structural_hash": "2b85beb6a76756490946fd26cd0c63fa465302bfb013c65647962d6678b1e0c0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_22411.go", "upstream_id": "BenchmarkTest22411", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := BenchSvcPassthrough(jsonValue)\n\tif data != r.Header.Get(\"X-CSRF-Token\") {\n\t\thttp.Error(w, \"csrf mismatch\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif !verifyBearer(r.Header.Get(\"Authorization\")) {\n\t\thttp.Error(w, \"unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-308"], "category": "single_factor_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1aaac3a7e565cb3a494592bb32805e807ec55b7c28ef9cce44b909b3b3f22d9b", "structural_hash": "d77581a40006be54e484e32090a9d05f80d977afcb17d89f5d4bf16ea403ba20", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03999.php", "upstream_id": "BenchmarkTest03999", "language": "php", "code": "request->get('field', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n simplexml_load_string($data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e51fcf90e95848f622882b62e2d7e643ad6aa6d30777bbc63f675f0ebb54f3e", "structural_hash": "aa670554cd9fb7ffbdf6f0a1f58e92753e874a78e0acad8e0adfc4413e72bb10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02294.java", "upstream_id": "BenchmarkTest02294", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = \"item_%s\".formatted(userId);\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n return Response.ok().build();\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e74b10a1667ffd55586d0784b3296ba1ddddb3667be3f507bc178ac9d81b9bda", "structural_hash": "932b9615502c1a17d15dde9dbf75ba9438c8228006f2e793c502541ee06c8b8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01739.php", "upstream_id": "BenchmarkTest01739", "language": "php", "code": "request->get('field', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "454592c7d90d8d3b17d955d74cdbfa00edbec8861aa1c3239c184f2659c0c52b", "structural_hash": "a4d2795c4080fb2775e31a32480b8e5a9f6650f02d921126cb49b477a1305016", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05956.sh", "upstream_id": "BenchmarkTest05956", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n curl -s https://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a819995d340d1a318334ba6c1cc675de6fadfe63fa14d525f4c95e78488f38ef", "structural_hash": "47ac0e6308ac57f9864860ccc6e50f4ec9e1e308e00c9ee1968ccd29e3de6f83", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02161.rs", "upstream_id": "BenchmarkTest02161", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse base64::Engine;\nuse base64::engine::general_purpose;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = String::from_utf8_lossy(&general_purpose::STANDARD.decode(&raw_body).unwrap_or_default()).to_string();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", data)).await;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f78355a7f16ad7ee03be64fd7f37a8d4cffefd45be04251698101eea0663b26e", "structural_hash": "61a073305dcbec5ec4bc83f7f314f8b5b2f6386f0ed3efae27b39d8454d166c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01433.php", "upstream_id": "BenchmarkTest01433", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $field = 'data';\n $$field = $userInput;\n if (time() > 1000000000) {\n eval((string)$data);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5ecdf40c1094c26a97c7bbc23a8f8c74fb543963b21e80ed72973e6273375b8", "structural_hash": "b76aff7a9516f15b31d729db38fd6a7849d0c20e3766e2c7e7541fdf3db78273", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03141.go", "upstream_id": "BenchmarkTest03141", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(refererValue)\n\tallowedVals := map[string]bool{\"asc\": true, \"desc\": true, \"name\": true, \"created\": true}\n\tif !allowedVals[data] {\n\t\tc.String(http.StatusBadRequest, \"invalid option\")\n\t\treturn\n\t}\n\tprocessed := data\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\tc.String(http.StatusInternalServerError, ldapErr.Error())\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+processed+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tc.Header(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1812b672bb8dacb6f52c5b2fbcac73f4e1dc6fa2f87bcac13de544bc5df2b76", "structural_hash": "cf32c7fcedc15ae3ee7b527738791e4bbccaa8852a7accd6b98da3ce932e3902", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25817.js", "upstream_id": "BenchmarkTest25817", "language": "javascript", "code": "const path = require(\"path\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-668"], "category": "resource_wrong_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0862ad001ddeb2301e9f270288dbebc69278352bfb25c49cfa94c0b2641f3bd", "structural_hash": "caa89082e52ac9fef83ad500fb9f030fc004dfe4a1afac04a23401766bb266f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03722.cpp", "upstream_id": "BenchmarkTest03722", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n std::cout << _buf[_i] << std::endl;\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0b5e687866bd65d813d47483d60e1348e7f2c04d794af8afd7b2c41b5a08bcd", "structural_hash": "d30c04bcc4ab03ccf4f50189e05ef594a342da723dd6f1ec09103c8336555d70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_21394.go", "upstream_id": "BenchmarkTest21394", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", refererValue)\n\tdata := _sb.String()\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 1, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa527f68628fff059c4930339ce28a9991e0df7b9f5e448052667717c407d411", "structural_hash": "4b0bba5945c218f21669c0665a9b72c51002c6fb36a06469a0a1ffdb30b25ed2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05505.java", "upstream_id": "BenchmarkTest05505", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"X-Forwarded-For\") String xForwardedFor, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String forwardedIp = xForwardedFor != null ? xForwardedFor : \"\";\n java.nio.file.Path resolvedBase = java.nio.file.Paths.get(\"/var/app/data\").toAbsolutePath();\n java.nio.file.Path requested = resolvedBase.resolve(forwardedIp).normalize();\n if (!requested.startsWith(resolvedBase)) { return Response.status(403).entity(\"outside safe scope\").build(); }\n Runtime.getRuntime().exec(new String[]{\"chown\", \"appuser:appgroup\", requested.toString()}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok().build();\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a03e21d9151efe045bdb221ab64928cb074a8a9ad01fe6cbc8002a917f30a46d", "structural_hash": "a3f9931930ef7e2e12cdb3d5c9d38247addd06bdda1f5e7bb8b32f6037c2068b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13941.c", "upstream_id": "BenchmarkTest13941", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n unsigned char _salted[288];\n snprintf((char *)_salted, sizeof(_salted), \"s4lt_%s\", data);\n unsigned char _digest[32];\n SHA256(_salted, strlen((const char *)_salted), _digest);\n}", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "670e048135aba92a64ee7bf852f18d5f62e570a410debb4512e306e4e29c7d94", "structural_hash": "9e6649bf4d5fa8851b7ba459ac924712fa4a1cb06e678fbbd659ab73cef111cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_12456.go", "upstream_id": "BenchmarkTest12456", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", fieldValue)\n\tdata := _sb.String()\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28e74d3c4b5a4bdfb7d43a10a7ae225ba04c556a1f4a910581e9e767dde3a6cf", "structural_hash": "0ae1dbf2b13c0550bebd722d8dd61406bfbcb03089fd7ded9f00ffca1812665a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10448.js", "upstream_id": "BenchmarkTest10448", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { ctx.status = 400; ctx.body = {error: \"field not allowed\"}; return; }\n }\n const processed = JSON.stringify(_incoming);\n const user = db.querySync(\"SELECT id, role FROM users LIMIT 1\")[0];\n Object.assign(user, JSON.parse(String(processed)));\n db.execute(\"UPDATE users SET role = ? WHERE id = ?\", [user.role, user.id]);\n ctx.body = { updated: user.id }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a99138fbff3d12ed370a4128690a27e039ea923a969f93ff92346d426b5e5f5", "structural_hash": "6f2c95b4a7720531f2cc4650670949ad15e80e7cb58a1ae14497f189d151b51f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_36022.js", "upstream_id": "BenchmarkTest36022", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n db.execute(\"UPDATE users SET name = ?\", [data]);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "398aec6f26507f86a496fdb946fc6e927cc183584cfcf8ebfc5d8ffce74ae7d3", "structural_hash": "db97e7608b75438fa8bcd0034661eceac1ec8bde23151b1836729b41a874dad1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00131.php", "upstream_id": "BenchmarkTest00131", "language": "php", "code": "headers->get('Referer', '');\n $data = \"{$userInput}\";\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->set('Access-Control-Allow-Origin', (string)$data);\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "718de240992793feb7f49000042d4a7d9cdfa625f248c00f1a80e69913cc3c50", "structural_hash": "281909c0e383e5f2a3c545ebe9daeb3b6357bb8bb167e6f241420a6ffb286ec1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37535.go", "upstream_id": "BenchmarkTest37535", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(commentText)\n\tcmd := exec.Command(\"sh\", \"-c\", data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 1, "cwe": ["CWE-506"], "category": "embedded_malicious_code", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:embedded_malicious_code", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94d03e0af4ca63372a88db7e9641b429a792e7d800325acf93585bd57c4262ce", "structural_hash": "2dbaf73b7b9119818bcab2c64938515c677f4d24686f4fb397401ca87253e0da", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01626.rb", "upstream_id": "BenchmarkTest01626", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = user_input ? user_input : ''\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d353350e95c6917dd105ab02970e6893824fbbf4378db7ac9dc3910988859be1", "structural_hash": "f83456ebb68d1c8795b271aec306ecbdef5c79d8daa0c19f016bc0590dc5069a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00926.php", "upstream_id": "BenchmarkTest00926", "language": "php", "code": "headers->get('User-Agent', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66feb6fbc349304ee1e3577f66392169b2866989f31a032b805b1c4e27ad057a", "structural_hash": "44c7540f1c05a945397d64b06d562ec032b505bd169a80de05799c35431642e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15868.c", "upstream_id": "BenchmarkTest15868", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fef56db2d3d4e30a606055d2621c9af9ceb794afd59851b1f0b7fe2df93b4e9c", "structural_hash": "dfd3ff418540c2b5dcdddc9138ff1f0dec91423df4bc220f57015389e39fe076", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05950.java", "upstream_id": "BenchmarkTest05950", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(uaValue)); }\n catch (NumberFormatException e) { data = uaValue; }\n java.nio.file.Path resolvedBase = java.nio.file.Paths.get(\"/var/app/data\").toAbsolutePath();\n java.nio.file.Path requested = resolvedBase.resolve(data).normalize();\n if (!requested.startsWith(resolvedBase)) { response.sendError(403, \"outside safe scope\"); return; }\n Runtime.getRuntime().exec(new String[]{\"chown\", \"appuser:appgroup\", requested.toString()}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "784db15bbc5eab5071435a5bb4095c2b859f6355b0ce583df38426a49c125fdf", "structural_hash": "e2e25a432a9373ba31d6b730861db563825e4b5f4bbc0e04aa93b7616b823d2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26966.sh", "upstream_id": "BenchmarkTest26966", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(printf \"%s\" \"$user_input\")\n cat \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3213ac9536e6125fa275dc925cdf3cddd3efe29d19c83ca764e153d699f138c6", "structural_hash": "7a3844e03541232f7835b9050f9868c90ef95286f70a40be9e7cbb3819ad22bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06727.c", "upstream_id": "BenchmarkTest06727", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char *_found = strchr(data, '=');\n if (_found != NULL) printf(\"%c\\n\", *_found);\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2cc372a4fa53e0db3cb9ba74a669cb4c2525a65b3f3db52399d8ed3ae00d3e5e", "structural_hash": "90e4fd038f9d7bd346381ac72033a449226c4fdbb2ef0eca95556bf6fd0c05b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02445.rs", "upstream_id": "BenchmarkTest02445", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", cookie_value).ok();\n reqwest::get(&data).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0a8c535b66c0ceae4a4005b2e675867671768f041cdd8ef9cc5d70df6236407", "structural_hash": "d3c2794689bf7f88f1bcd6b81341dda5111789a892eb51d87f3e71ff3d8eec43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04423.js", "upstream_id": "BenchmarkTest04423", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n ctx.body = nunjucks.renderString(processed, {});\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b48fb6bb4a8b8265b719482e939f4ad857f135224376ca1f65cd14f1ddbc0b3", "structural_hash": "3183da3a8eebf1ee88d17dbd5dea840552cceacbfb94d098925a00f12412e9a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04283.rs", "upstream_id": "BenchmarkTest04283", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let profile_value = crate::shared::db_fetch_one(\"SELECT bio FROM profiles LIMIT 1\");\n let tokens: Vec<&str> = profile_value.split(\",\").collect();\n let data = tokens.join(\",\");\n crate::shared::auth_check(\"user\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2425216b6e1047f6caa4e6e9bb67b2b4d526add459067a2d3b9fd365a827b73c", "structural_hash": "818513ed9236f31c71c38453ab436df79b84f5db01e3b15421ed3474896bd768", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02783.cpp", "upstream_id": "BenchmarkTest02783", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb1f3eb31404568228f69d8bf1f2b23170adbf2d6d0bd849d43cebfd0d588ec0", "structural_hash": "2573437f62fb595814ab0d956d7ef9952ef279d5f7e2cfe7c7964879b5f20570", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_35272.js", "upstream_id": "BenchmarkTest35272", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { ctx.status = 400; ctx.body = {error: \"field not allowed\"}; return; }\n }\n const processed = JSON.stringify(_incoming);\n const user = db.querySync(\"SELECT id, role FROM users LIMIT 1\")[0];\n Object.assign(user, JSON.parse(String(processed)));\n db.execute(\"UPDATE users SET role = ? WHERE id = ?\", [user.role, user.id]);\n ctx.body = { updated: user.id }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a28016dcd44ce21e5f59282cba9d00e15fe773f4d12b6fc04b1c596681156601", "structural_hash": "dc237dd37383c5130c7d8a311567c539e831a0d2065b6c57d8b5f31ea4721a53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_25968.go", "upstream_id": "BenchmarkTest25968", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdata := BenchSvcPassthrough(dbValue)\n\tresp, err := http.Post(\"https://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53a05c960ac242496a99070f1528aedba2dfa34a9ffe7bb9f4e7efa52189b771", "structural_hash": "cdd07cdda9d182d4f85fd3ecd6ab66a5358189c34f8d21ae0d35efcd40b59c12", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_34293.go", "upstream_id": "BenchmarkTest34293", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"golang.org/x/crypto/bcrypt\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\thashedPw, _ := bcrypt.GenerateFromPassword([]byte(rawBody), bcrypt.DefaultCost)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": string(hashedPw)})\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "673b79e0d7e6794062562ece514ad81fc03194ff7f302d1bc0b676bba89692bd", "structural_hash": "42ea71cf98ff054194f57361a61bd48f73afaa85e1732885a22a1c25c6a41fdd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31695.go", "upstream_id": "BenchmarkTest31695", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"net/url\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(rawBody)\n\tparsedURL, err := url.Parse(data)\n\tif err != nil {\n\t\thttp.Error(w, \"invalid url\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tallowedHosts := map[string]bool{\"api.svc.cluster\": true, \"cdn.gocdn.net\": true}\n\tif !allowedHosts[parsedURL.Hostname()] {\n\t\thttp.Error(w, \"forbidden host\", http.StatusForbidden)\n\t\treturn\n\t}\n\ttargetUrl := data\n\tresp, err := http.Get(targetUrl)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tw.Write(body)\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9a435dde8a622348ab85c1bf115ffa6c3f151be08022d89273f34637810e256d", "structural_hash": "d27413a78f57de65794c0bab6b80a8916e9dc6384cfe35b48e8ad3c820c64c6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04279.ts", "upstream_id": "BenchmarkTest04279", "language": "typescript", "code": "import { Controller, Param, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = pathId;\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const requested = parseInt(data, 10);\n const wrapped = (requested + 1) | 0;\n const buf = Buffer.alloc(wrapped);\n res.json({ allocated: buf.length }); return;\n }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1e227081a213677c81147dbbd0fa7439efb9f4931caeb9fd61c3c0929e5ec97", "structural_hash": "9216e7fca40802671c85684070f48fe0a1792c23ec38d5fab9af05045f2bef31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03581.ts", "upstream_id": "BenchmarkTest03581", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = String(userInput).slice(0, 200);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n}", "label": 0, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af544133b735feabac2458ceb3ab2e52f039105515c84f73f24846f056add76e", "structural_hash": "0ca5a3aa2c9fe784118174f70cd8f03dbdc994e8d800358f832455600d99fe57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00597.rs", "upstream_id": "BenchmarkTest00597", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(header_value.clone());\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6fab2ef795719f3f6de18c6e651c38739e08042d7ae8f86d9264ddeafa846b8", "structural_hash": "a00acdec8a9d7bea042f666711a402ec9f6928b2b6ec01dfca29620ff957870f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12313.c", "upstream_id": "BenchmarkTest12313", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n int _req = atoi(data);\n int _alloc = _req + 1;\n printf(\"alloc:%d\\n\", _alloc);\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fe3fc91ff2ab71bb43d7da9c6020e0d6a23ff4935217c0b3a40b6f76b10263b", "structural_hash": "fec9a697918fd132c31046b81972cbcb8513d657e44be378d89efa48bed37507", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03279.cpp", "upstream_id": "BenchmarkTest03279", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Origin\");\n std::string data = cpp_own(user_input);\n std::string _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17ccff090355264ca9200b20dc7111f63ff85aceb0b0cbbb544daf6d79a17545", "structural_hash": "b18d0d550e6b6b56679300435097df45236ed06d97d487eec1d47ad87a43d745", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18548.js", "upstream_id": "BenchmarkTest18548", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const data = userInput != null ? userInput : '';\n crypto.createCipheriv(\"des-ede3-ecb\", Buffer.alloc(24), null).update(String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97e8a7a3d55170565beb86ebb20097b2586b6b4383223c113e8c0810f6a91d50", "structural_hash": "f48cdad81b23ac639093299f45867c0194b4a1657192c8ad072e23af59f66a9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02039.rs", "upstream_id": "BenchmarkTest02039", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse rand::Rng;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: ua_value.clone() }.payload;\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec6e6144986f1376352597f81a99d63b7e754475f60da35ad9bf020bdfd702f8", "structural_hash": "cae31f7abf9a45ec99980e11d1ba5ec3828b9528ed6dba06a9fdd86a34e15843", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01544.php", "upstream_id": "BenchmarkTest01544", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n file_put_contents('output.csv', (string)$data . ',data' . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d66590a8333caeacce5155fbfb154c54162041d4cb20159ed8b95cba5aea0ba", "structural_hash": "57a6591cf9de13668b5e8e6b11daf6f2a7eb3ab922a8975045d4cad202144849", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01749.py", "upstream_id": "BenchmarkTest01749", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n if field_value:\n data = field_value\n else:\n data = ''\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': origin}\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88940d0c4c37432aeb5a473181d9810738f37bce20ff25465afb068af351b8bc", "structural_hash": "f90bdc01e04f776a013659d757863430b8df1583a9198ac26fa7ec218cb6d602", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04693.php", "upstream_id": "BenchmarkTest04693", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $field = 'data';\n $$field = $userInput;\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return new JsonResponse(['validated' => (string) $processed], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9edb1c7beaf6971dfcec2313e7115def9209cd82d1d9d6f4f105e4924e303f1", "structural_hash": "f17b5b616f5a985f6e4f209de8f32c8cdd4a4607cfb2b81be4f6b1ee912592a7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13612.go", "upstream_id": "BenchmarkTest13612", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tholder := InputCarrier{UserInput: graphqlVar}\n\tdata := holder.UserInput\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "420b643f83625627f972e4a38759cec392554ec78f808ca6d2813990d5e58ddd", "structural_hash": "9f8e5854446b583f91d1f8c834ddba883a34ed9dab5b0998b811dc9ed8ec9b72", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07614.js", "upstream_id": "BenchmarkTest07614", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/data/secrets.enc\", _ct);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-922"], "category": "insecure_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6a7565a89e5a92057a6eff333439083b2d383fffdfa2d38823935332779811f", "structural_hash": "286d76825a1fd33e69594a25e55ff2710cb03f1e72995980b0fcc9b6cc1e8380", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22323.c", "upstream_id": "BenchmarkTest22323", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n FILE *_tf = fopen(\"/tmp/app_export.tmp\", \"w\");\n if (_tf) { fputs(data, _tf); fclose(_tf); }\n chmod(\"/tmp/app_export.tmp\", 0777);\n}", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "daef9f8019ec572ca3c9269414bcdbf9b3fd3216b6409aef5de0a3564f538a82", "structural_hash": "795fa950ac28d6db9d61a66ee74220f4683b73c7531ec9af5755949c443be3c9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01453.rb", "upstream_id": "BenchmarkTest01453", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7941b05f48898865b219dae513b7552b028c5b737c35bb4da384bdb4f7119571", "structural_hash": "e9470121f48be045d3da913dbec3773aa2943004b06fd57fff780fc7f53359d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00960.rb", "upstream_id": "BenchmarkTest00960", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = Thread.new { user_input.to_s.strip }.value\n processed = data.gsub(/]*>/i, \"\").gsub(/<\\/script>/i, \"\")\n headers[\"X-Custom\"] = processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17194bb9de03f823d1370f2b435b60dba854c85833749e4eedb745af0db6fda4", "structural_hash": "cc5c4fb7ac52faa24aac92532ada4519bf852703d8ac04cbc11d142a6f4a4f8c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01130.py", "upstream_id": "BenchmarkTest01130", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = '%s' % str(db_value)\n requests.post('http://api.prod.internal/data', data=str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "317b2d33aca7ab97d3177bbd93b98f97b05435cd003c580dadf4ebe22d0b2501", "structural_hash": "df601884b06789c42219964a2a0924d11e44818e093228caa30f823e780e7ffc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01473.rs", "upstream_id": "BenchmarkTest01473", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", origin_value).ok();\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "970e08089d1fe20e48d1909634753128528f2a98ee556668239e5ca218db2866", "structural_hash": "dd746b7acfc86ec5d35766dc9bdeeb84cf3c4365e791d419f26d685ab9d1f27f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10975.sh", "upstream_id": "BenchmarkTest10975", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n normalized=$(echo \"$data\" | iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null || echo \"$data\")\n printf \"Content-Type: text/html\\r\\n\\r\\n\"\n printf \"

    %s

    \" \"$normalized\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-76"], "category": "equiv_special_elem", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:equiv_special_elem", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfd900479af7d3285de5651cd273a4a48be89a116f6957365c7243e577375224", "structural_hash": "f8d57a999f07b2dd4374ae890ad5385c65a85e846acab34b470df8c8f76f0c82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09756.js", "upstream_id": "BenchmarkTest09756", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3351259f2e72ce7c4244097ab5d2e4b7d7a153c77166352f57cf8016565a0141", "structural_hash": "e55dd938bdfaa3a7cbf573f33d52a213e94a2ce83fe1ed9a5d0e46c3a1dfcdac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37522.go", "upstream_id": "BenchmarkTest37522", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tpending := strings.Split(rawBody, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tpassword := data\n\tif authVerify(\"user\", password) {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-308"], "category": "single_factor_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f60db51811d1ccca0c1081742b4fe2e57b5e0859a16b6315af025b85ac0d87cd", "structural_hash": "230ccaf2c1628b905349f3645612924343d3a4b80ca1b2d58395c0082a4c6684", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04152.rb", "upstream_id": "BenchmarkTest04152", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n render html: (\"
    \" + data + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d51cd26c499e02b3600db1a090e05d4267f3609b36d38d9ed4c5e5ef933e180", "structural_hash": "6bad1a3c10bd3952678d75e895f610e2ea38f2aed9e497bc135f3ee35f7a9245", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17752.go", "upstream_id": "BenchmarkTest17752", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(xmlBody) {\n\t\tdata = normalizer(xmlBody)\n\t}\n\t_resp, _err := http.Get(\"https://api.svc.cluster/lookup?q=\" + url.QueryEscape(data))\n\tif _err == nil {\n\t\t_resp.Body.Close()\n\t}\n}", "label": 1, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d76a5a191716d7fb3d0dc67c495e415ead7a0e59682ebb853dd63419bb275a35", "structural_hash": "92d5171827fa3c714e9caf1ea3575add54b6befa0c8b430f1b6e7a1f228240f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19051.sh", "upstream_id": "BenchmarkTest19051", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd3fb1afef83dc6e64568ad60a719805c0b1c67b5231ae6917d9c902308db78c", "structural_hash": "1218e7e22cf9bc7cff2c5eade5423cf0d99116ee3fe19bbf5cd36301139202fb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02808.sh", "upstream_id": "BenchmarkTest02808", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f49c816dfbb65c08a8486da670157cee65450c23db6f87d13ef4c7a8047c6c62", "structural_hash": "a58e68d8ca5a7257b05989b73391b621c82e5cb3c4842719112ba3eea2ab1774", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12351.sh", "upstream_id": "BenchmarkTest12351", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n checked_path=\"/var/app/data/$(basename -- \"$data\")\"\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c63e7064e7ea49dbb5b99a152f474a267f0aa168969e52f5ff44e162b01afb27", "structural_hash": "1b854a53ffdad6c43d48c880d426d94c12a135d6a11ac684feddf9d1b4cdc823", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03054.sh", "upstream_id": "BenchmarkTest03054", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n checked_path=\"/var/app/data/$(basename -- \"$data\")\"\n cat \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f189d81976426a55c34522c09e734494896438e9b059dd3e5f9f848c951a8c31", "structural_hash": "0e9153dd511bbc1a200dfa8e35b1de62cf5e335061b07f64a02dc9e1c3543c31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02308.php", "upstream_id": "BenchmarkTest02308", "language": "php", "code": "json('variables.input', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n file_put_contents('/var/uploads/' . $data, 'data');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ccacb4ba5e70ff8083ea66c51e9bc7ccd0c14bbf5a36bf28d9ec716e9779b295", "structural_hash": "adc357d761972bfbb53cb278bd295aaf2b25f39d7f761db2f9bd0ff52d239cf0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08034.js", "upstream_id": "BenchmarkTest08034", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1fa76da5dac0b843e640100ab187120a038f797d2f3219f8ad84f4cdb015dc88", "structural_hash": "687079d5e9b86d32051f6110cb740aa42d086d30738c9a44cf44efa802e8ae1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00632.c", "upstream_id": "BenchmarkTest00632", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", safe);\n system(_cmd);\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c51cd830157a3e4a96b92e601ce70b4ab4ca4285c1fdd13bab9deebb77418048", "structural_hash": "6f9014deee37340821f06290c7004e5117cfa59ed05e1cb83e76b6730c043873", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05307.php", "upstream_id": "BenchmarkTest05307", "language": "php", "code": "header('Host', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!preg_match('/\\.(jpg|png|gif|pdf)$/i', (string)$data)) { return response()->json(['error' => 'invalid type'], 400); }\n $entryFile = (string)$data;\n file_put_contents('/var/uploads/' . $entryFile, 'data');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37a38c8c6ad563e0280a1e060db90c2dee55ab84779f4a958d0506ed80ffddc3", "structural_hash": "57a01ed826860506dd990b0b6f8e832d6e3caf736ffeec5fcbf495d10b61cded", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04774.py", "upstream_id": "BenchmarkTest04774", "language": "python", "code": "from cryptography.fernet import Fernet\nimport os\nfrom flask import Flask, jsonify\ndef trim_value(value):\n return value.strip() if isinstance(value, str) else str(value)\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n secret_value = ['feature_flag_value'][0]\n data = trim_value(secret_value)\n store_cred = os.environ.get('APP_SECRET', '')\n Fernet(store_cred.encode()).encrypt(str(data).encode())\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "130f8548941f25870d3654f50124d19407414f85b5cf8e165309e3751c345b2e", "structural_hash": "64dfd9f1d6403a3edb7b6cfea432deeb14a8895f7eaa2b89a3c5ee799b6a9117", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05355.ts", "upstream_id": "BenchmarkTest05355", "language": "typescript", "code": "import { Body, Controller, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string, @Req() req: Request): Promise {\n const userInput = mf || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f23e3c3d51cb46aabbab87d9819d82d709c7ec70dd785973a213548a7fee5a2", "structural_hash": "032333e839f33592eff75470af14100c20b59f9c6ffde5704cd3478d57c59ded", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05080.ts", "upstream_id": "BenchmarkTest05080", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n res.send(\"
    \" + data + \"
    \");\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55d55785514bcc70e5bf9548247a07bda3a366f345feaa41d29d1ab607504fe3", "structural_hash": "44ae0ed0a343d3a40b2f48ded4a03557f0b8ebf8559ac4e166ecb46910a46ebe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13885.js", "upstream_id": "BenchmarkTest13885", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const transform = (v) => v;\n const data = transform(userInput);\n const _allowedFields = [\"name\", \"email\", \"bio\"];\n const _incoming = JSON.parse(String(data));\n for (const _k of Object.keys(_incoming)) {\n if (!_allowedFields.includes(_k)) { res.status(400).json({error: \"field not allowed\"}); return; }\n }\n const processed = JSON.stringify(_incoming);\n const user = db.querySync(\"SELECT id, role FROM users LIMIT 1\")[0];\n Object.assign(user, JSON.parse(String(processed)));\n db.execute(\"UPDATE users SET role = ? WHERE id = ?\", [user.role, user.id]);\n res.json({ updated: user.id }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ae5af405ccda32e5587fda54972ae90cd690fd988d94201eace5fdb638db02f", "structural_hash": "2e30a129e932492b82113eed30f7698952d7b2fd28b5fb7ac37dd6c4e4b17ed9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03122.php", "upstream_id": "BenchmarkTest03122", "language": "php", "code": "name;\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20ae47b67a054c18bcb1c2e620307ebdd1e8a28e92324a2e6735c97bf0a55acc", "structural_hash": "b56ed678960fc430b5675eaee794bf95b487050f741553c883625cd2717c8631", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05525.rs", "upstream_id": "BenchmarkTest05525", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: field_value.clone() };\n let data = payload.value().to_string();\n let processed = html_escape::encode_text(&data).to_string();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e37d0d1c2009c5af8a5e425c2cf4eca26f7a51cb315f6b27c0a6ae906ab1ba1", "structural_hash": "07208a4968b72ae9bf80839f0b80c49617d8312fc8960112e7ef292c6e3bc143", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02338.rs", "upstream_id": "BenchmarkTest02338", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest, body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = match raw_body.chars().next() { Some(_) => raw_body.clone(), None => \"default\".to_string() };\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d512796af5b7a5db08c659abbf1db0a39b848272fa8e6158a95955e14e7d0682", "structural_hash": "43904f3ab1479b16aaa1bc9727519eb92ed8f8f78408c4b4cb1239c81062966a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05238.rs", "upstream_id": "BenchmarkTest05238", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in header_value.split(',') { data = token.to_string(); }\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab276faa7f99ef91f0af4ef9de1123590743ba6fd6299cb6c66e66b8c6b38a19", "structural_hash": "b68033447d2b9dc94db8a9b059913e55766d9d69f7ab6f6723c16c65bb76d065", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04863.ts", "upstream_id": "BenchmarkTest04863", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "135b759bef66fccf51a2508f5a592984ea7364bab5edabb78b8f58f38b41dae9", "structural_hash": "a09d1d1dd5c9a5bf5ec01f79e74b6bdebb07cbbdd28089c9d056e0ad913cf4f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04764.c", "upstream_id": "BenchmarkTest04764", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n FILE *_f = fopen(data, \"r\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6c26dc5336e4892cc1b8cbbc947689c12f83b5a0f6145583ca422aff5787580", "structural_hash": "d3da7d8c8d3f643382464632b8e01a1543f4e94ff6033deb31a334d31073ede8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01768.py", "upstream_id": "BenchmarkTest01768", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import db\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n json_value = (request.get_json(silent=True) or {}).get('payload', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(json_value)\n data = collected\n if request.headers.get('X-CSRF-Token') != session.get('csrf_token'):\n return jsonify({'error': 'CSRF token mismatch'}), 403\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6dd88a41a067494990e6c3e32cebc9d10bca79565f57d0dda9b7627f8a3ae463", "structural_hash": "c537e26a3da16114607f993878e6d9977680efbf98fe6f8b4adf8d50b48b5427", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00295.ts", "upstream_id": "BenchmarkTest00295", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as jsonwebtoken from \"jsonwebtoken\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = [\"feature_flag_value\"][0];\n const data = await Promise.resolve(userInput);\n const jwtSecret = process.env.JWT_SECRET || \"\";\n const token = jsonwebtoken.sign({ sub: String(data) }, jwtSecret);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7dba90e2d97e6fc386fb76c4918aebecbd65e622f2da5bea6fe581fba118db0", "structural_hash": "37f4e6a2c4e1e586ed770c2b806afe9cf56db84416e4cc8a5d0c35271b6a49b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03862.php", "upstream_id": "BenchmarkTest03862", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $field = 'data';\n $$field = $userInput;\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $processed)) {\n return new JsonResponse(['validated' => (string) $processed], 200);\n }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f02658c75bcbbaacfa8d8df5dfb2946006f95462286b917d03f5ae763968fb66", "structural_hash": "0c217b6e417069c4c5fbfe05a3cdcb9a3f87f903122d21a8c9f99099d3d8afae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03575.java", "upstream_id": "BenchmarkTest03575", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.List tokens = java.util.Arrays.asList(multipartValue.split(\",\"));\n String data = String.join(\",\", tokens);\n java.util.Hashtable env = new java.util.Hashtable<>();\n env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");\n env.put(javax.naming.Context.PROVIDER_URL, \"ldap://localhost:389\");\n javax.naming.directory.DirContext ctx = new javax.naming.directory.InitialDirContext(env);\n try {\n ctx.search(\"ou=users,dc=example,dc=com\", \"(uid=\" + data + \")\", new javax.naming.directory.SearchControls());\n } finally { ctx.close(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb78a3d54436b0824ac34f7c1dc3dc70584b158c80f17e66cd3b49d7d51ead1a", "structural_hash": "f043445dcf613bd0d98f354f2c12c6216d5731772ea10886115d1bd6b35bd8f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03475.ts", "upstream_id": "BenchmarkTest03475", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n const _handlers = { primary: () => {\n childProcess.execSync(\"echo \" + data);\n } };\n _handlers[\"primary\"]();\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a902decb4bd99a09c1c89b995947578e81bc33e7129d8cbccbf829f27ceca2ff", "structural_hash": "805a7db1d0f20af68f1fbf079a7f6558ce8355dc1b2400070bc3d876b5bdbe75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09202.js", "upstream_id": "BenchmarkTest09202", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n require(\"./shared\").s3.putObject(\"app-user-uploads\", String(data), Buffer.from(\"data\"));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e5cfbab553b02cd02b7772b944b0dbe40f98b9a898fadd448ccb5567484bec6", "structural_hash": "cc5075c3642c5dea936d90919ac7eb687018491c535a22d4f975caa0f78c2bde", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00024.rb", "upstream_id": "BenchmarkTest00024", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n headers[\"X-Custom\"] = data\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48b8d8d83b288ec0255c8af0f78158618e6618d8665d7a91ad4fd9333569af05", "structural_hash": "7b077040e001f212fb0c49d228e255fedd3e21f53b56aeae08aeda7cef83f5c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02209.ts", "upstream_id": "BenchmarkTest02209", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n res.cookie(\"session\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "12820c53f322f4924169a980a92a424bfe0cf3816ba4da7cb0e8f50fb0d9d46f", "structural_hash": "0ea5922bad7bbae2eb24f240245ffae9f5a308f9b0df2ae72195f4f994cfbd7a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03992.py", "upstream_id": "BenchmarkTest03992", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\nimport re\nfrom app_runtime import db\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n ctx = RequestContext(comment_value, source='form')\n data = ctx.payload\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JsonResponse({'error': 'invalid input'}, status=400)\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab598d1edc7f8ae2fa1c6da3800c3f3b1f7e86ac04ab54d9db8a51a249b79a24", "structural_hash": "e255e505a45d174f2fc5c17195dac31a84b915451fdc285c8d14c56653d64058", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08663.go", "upstream_id": "BenchmarkTest08663", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tdata := cookieValue\n\tif _, after, ok := strings.Cut(cookieValue, \",\"); ok {\n\t\tdata = after\n\t}\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data, Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "332ff26dafbd19c31161b3216ee73a7aa3cbac062ee6a806307452e6ef6f095f", "structural_hash": "2e6acaeffad665e222bc6f0a270ede0c671f1d121fd30934d87e5c63633b98e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04176.py", "upstream_id": "BenchmarkTest04176", "language": "python", "code": "import requests\nimport os\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n env_value = os.environ.get('USER_INPUT', '')\n if env_value:\n data = env_value\n else:\n data = ''\n _resp = requests.get(str(data))\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd5320213d12e85726ab4c0bea73150f097992bbcb2d567392d4780fe5c38932", "structural_hash": "ea96c5761a8fe8e5bd45bee966a34e1de219008d8ff11cf197376e56c1eaf465", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01342.cpp", "upstream_id": "BenchmarkTest01342", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n static const std::regex _re(\"^[a-zA-Z0-9_-]+$\");\n std::string safe = std::regex_match(data, _re) ? data : std::string(\"default\");\n std::cout << safe << std::endl;\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e813353a913e3585d2494c36433372690db5b81e7393bff0d6fb66d14d8eb56", "structural_hash": "1f82963b14fc95de98f9c018c754d58f78c97180b3546c6de9a67091a713e802", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04609.java", "upstream_id": "BenchmarkTest04609", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String stripWhitespace(String v) { return v.strip(); }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = stripWhitespace(fieldValue);\n long rolloutEpochMs = Long.parseLong(System.getProperty(\"feature.rollout.epoch.ms\", \"0\"));\n if (System.currentTimeMillis() >= rolloutEpochMs) {\n ProcessBuilder pb = new ProcessBuilder(new String[]{\"sh\", \"-c\", \"echo \" + data});\n pb.redirectErrorStream(true);\n pb.start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ebb99e3c003b49baacb4c68e6fed9d7d8d8340372713996760f632e8891b6a3", "structural_hash": "d40fb351f64a8fd8c490823c0024f475fd5d6b85db8c6e2ac55f597908517657", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18102.sh", "upstream_id": "BenchmarkTest18102", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"${user_input:-default}\"\n case $data in config.json|index.html|readme.md) checked_path=\"/var/app/data/$data\";; *) echo \"forbidden\"; exit 1;; esac\n echo \"uploaded\" > \"$checked_path\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbe856cb5c4ec0795eb772f0431b298292983c5df68813452a1ba897a694ea10", "structural_hash": "b264f1be32b56db2713bdf5d4348930c58bbb979c69a69245415f2f2b81d623d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_37639.go", "upstream_id": "BenchmarkTest37639", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tpending := strings.Split(refererValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tc.Header(\"Content-Type\", data)\n\tc.Data(200, data, []byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 1, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e748b98b6f1d3b845c7a9fd5b4e55a5ce14b7b501ff0ca03e0b725c152eede7c", "structural_hash": "0c71412514416709d6b34959ff7260cf56eb4a06add1d3d9c77ddbd66a62b303", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01201.rs", "upstream_id": "BenchmarkTest01201", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct FormData { payload: String }\n let data = FormData { payload: ua_value.clone() }.payload;\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa7d1dfb89d29cbcb31fc0c5052d0f68b54e23f879b5eb8b35b807263994f34c", "structural_hash": "d41623016d8cabca2ab76c5eb96de7cebe7e69b1f6156281e346c352a0ccd5aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05613.rs", "upstream_id": "BenchmarkTest05613", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let result: Option = std::env::var(field_value.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92c93cbc811c3108a2b08484fb5ca16eb3f6b931cc99e81e69a51e12aaa98270", "structural_hash": "821eb5f32e47bcde4c775f64690a42a5ea2adf823432960f8dc522a6fd8c9887", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00705.sh", "upstream_id": "BenchmarkTest00705", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\" >&2; exit 1; fi\n requested=$bounded_val\n if [ \"$requested\" -lt 0 ] || [ \"$requested\" -gt 2147483646 ]; then echo \"overflow\" >&2; exit 1; fi\n alloc_size=$((requested + 1))\n echo \"alloc:$alloc_size\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1044cd210e16dcc9c96dd06b46fd73e6d22fe137c19f84043a9edbadc3df66bf", "structural_hash": "7879bb4ab802ca59b7d858b17c3530695bbc299417ebd97a7d9f3220c8d56918", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12697.c", "upstream_id": "BenchmarkTest12697", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n free(_p);\n}", "label": 1, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe79aef31bd462f6165545e7f527b947b0fdfc37013820bae7cf3ef6b6594be8", "structural_hash": "6c24bf2199404328cfa254beb318d664ee86b906784b943e4edd856cf19968bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_29838.js", "upstream_id": "BenchmarkTest29838", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n db.execute(\"DELETE FROM sessions WHERE owner = ?\", [String(data)]);\n console.log(\"request processed\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c3dec3aba2b2c343e690d5cbfc9c927e0792e9d9ad1d4333e3ec409f53c6ec0", "structural_hash": "94b4f0daca3605a81eaeaa475a88b196047b5d340d865f0cbc99af95c0d29070", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03836.php", "upstream_id": "BenchmarkTest03836", "language": "php", "code": "header('Host', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n posix_setuid(65534);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efc02e74d56e81023149c8a3e972effba47606ec4b4a449720a662f95ecefbe9", "structural_hash": "bdcf4043d49e3bab7c0ea07513ec86735e1a291824d88f6efda7469a8a06d0f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01000.php", "upstream_id": "BenchmarkTest01000", "language": "php", "code": "input('multipart_field', '');\n $data = ($userInput !== null) ? $userInput : '';\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $processed . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1157e65d39382fe8e5adacb19b3e694313e1cb83f315fdea83e6b5707bf57942", "structural_hash": "4e1d7803aaafbbfbaaf5a6ed8bb5f53b2ca553f6bd3d2f71f3cf6e55fd4f8ad5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02470.c", "upstream_id": "BenchmarkTest02470", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc53ea36f1a2ab0cda5ebd44318409b3c8d0e6bb6a09754dc9050e1a315c7718", "structural_hash": "02d6420e95e703dfd4bc91a4accfff426458439e8ab3c46b0a3979d91a38beaa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00061.rs", "upstream_id": "BenchmarkTest00061", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\nuse url::Url;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(upload_name.clone());\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return HttpResponse::Forbidden().finish(); }\n let target_url = data.clone();\n HttpResponse::Found().append_header((\"Location\", target_url.as_str())).finish()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77a4fd2d06aaac5f88f6fe73d88b22fdaf07921af8df2799e3a224c3123c9753", "structural_hash": "0dcb86ba3630073f2e340c6aee082e539eb634e6d6bb88093e14e3cfe0ea7bcb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01642.ts", "upstream_id": "BenchmarkTest01642", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n eval(processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55efcc19580764590aa30ef6672dddc166a759f87c8e6bd2d0e7a45a5ae1d5aa", "structural_hash": "a7362634743c2f0792c953d63c8fb7cc649cc87ff02004b464d0fc34b145844d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02025.cpp", "upstream_id": "BenchmarkTest02025", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"field\");\n std::string data = std::string(\"value=\") + user_input;\n std::string _cmd = std::string(\"ls \") + data;\n std::system(_cmd.c_str());\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0ccfc15a623e81e95cb991d675715ecb8e369574f4a7a5ce659f392bae8b36d", "structural_hash": "f314c6bfda7f0b0a2a4d4efe4034614a52b2a1280f2a4181bfb640c6dca04d99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04889.ts", "upstream_id": "BenchmarkTest04889", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45cbe8669f50eeef34ba95ae34bc604f4ddafc8a8cfc539afe6a8817f445de3d", "structural_hash": "41e762a6dca8ea5a9556ee84df26b0a1aff6bb8104cc58735187a4f942ec0561", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13363.sh", "upstream_id": "BenchmarkTest13363", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n encoded_data=$(echo \"$data\" | openssl enc -aes-256-cbc -a -salt -pbkdf2 -pass pass:\"$APP_KEY\" 2>/dev/null)\n printf \"%s\" \"$encoded_data\" > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-313"], "category": "cleartext_in_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eaf2ea0f03771087f00cfdf7bf5818dd419f10813e960319d9e4dbb3ef01aac9", "structural_hash": "57d7912438382aa71d9bc67d6c467536e709a845a147c0f3699d4f16e2d9fada", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12554.sh", "upstream_id": "BenchmarkTest12554", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-311"], "category": "missing_encryption", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "caecb4ec5a20aa0c87b31c78002a7955b00b4d26f2353afd89ba6a2350e02b70", "structural_hash": "e4a706aee686cecd68f3fba9b44d4439b4dbb3f04455d01af89469d97634df9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00583.py", "upstream_id": "BenchmarkTest00583", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n upload_name = request.files['upload'].filename\n data, _sep, _rest = str(upload_name).partition('\\x00')\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c93cddcd307933f1e042d591e6367277ccf9df92c19d2f3de33d636bada624d", "structural_hash": "a1c4295e6637e0bfdafbe8e8f58d72a6b080ee8c993ae40597cd2a195eb00f96", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00561.py", "upstream_id": "BenchmarkTest00561", "language": "python", "code": "from lxml import etree\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n pending = list(str(origin_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(data) + '\"]')\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ad13e9faaeb52a1d3b19115c7be023c4f09b6a274ba0d8bb6885169d9f50af5", "structural_hash": "e1d8b02dc337539f82633b3caf10b4864eefc7d7c544d983bc302e1ef58980fa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04020.py", "upstream_id": "BenchmarkTest04020", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n multipart_value = (await request.form()).get('multipart_field', '')\n data = multipart_value if multipart_value else 'default'\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6acabb36897ea2c0cc9de770efc14a6ac4a50045cfe1baefc83013380366fd8", "structural_hash": "319d76b2a3e6e720b4ae3908d2fbb8831483b56c946caeee47362f850ccc3af7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01113.php", "upstream_id": "BenchmarkTest01113", "language": "php", "code": "query->get('id', '');\n [$data] = [$userInput, 'http'];\n $cell = (string)$data;\n if (strlen($cell) > 0 && in_array($cell[0], ['=', '+', '-', '@'], true)) {\n $cell = \"'\" . $cell;\n }\n $fp = fopen('output.csv', 'a');\n fputcsv($fp, [$cell, 'data']);\n fclose($fp);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68e2fd13fad4878e063464f33c048a9774b78cb98a9a9fe86a9ab13ab62ac579", "structural_hash": "c31e8b3fca952609484d49c3fa7b83ab3fba12eda149becfac0202acfe8d8c71", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04364.rb", "upstream_id": "BenchmarkTest04364", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n eval(processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6e1de121d06a475d2af147a0e833727cec685fb84c2f22ec0a9be4143438835", "structural_hash": "d73712800d997dd656e6f07b43e6985350bca0f5299bc27644d744310a101e3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00231.php", "upstream_id": "BenchmarkTest00231", "language": "php", "code": "header('Host', '');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $processed . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7dfb2baab3fd0df9f9ecf9ced5d7fe549b003900116d4c4bfc5affefd733ea3d", "structural_hash": "0e51e011a218da3e9527dcb0bca852fe4cf3c40634df61ebc8500b98bdcbbe9d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04795.sh", "upstream_id": "BenchmarkTest04795", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n logger \"Action: $user_input\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de850af8dae33e44a1ef3ae0cc3d8f69443d725ce02378bfdb4ec93c9fd5b56f", "structural_hash": "cc5feeddf5ebdeecc398440b61890aaf36b2ab1396388f13c8e0e85e6761610c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00297.ts", "upstream_id": "BenchmarkTest00297", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"user-agent\"] as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "43898a321de332cb1a56edaf60a154893215ab1313849ee876bb824390aaa81d", "structural_hash": "0185ed5dc29fd1561d5f0472133581940ae2449a5af1dda9f259868851f61631", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12658.c", "upstream_id": "BenchmarkTest12658", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "565d3142afee421f4e9e9db602178ba6c123db2379abbc77a9fa12b8844485bc", "structural_hash": "3d268070353be1470d6b84ce7f82c5cf83f8d63c02a6a01a088b97c997b7bc49", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05990.rb", "upstream_id": "BenchmarkTest05990", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n data = !user_input.empty? ? user_input : ''\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n ActiveRecord::Base.connection.execute(\"SELECT * FROM users WHERE id = '\" + processed + \"'\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aacef5d1908768bcda634687cf334cd1e9550d6950510adf8ecf73f93c2adf0b", "structural_hash": "f675c6fd64b873d1e4f65c18c1d9b42d4ce11b9887a68a9a54cdecfc0cd05b2c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00854.cpp", "upstream_id": "BenchmarkTest00854", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n (void)user_input; std::string _msg = \"internal server error\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "086beb623e87f2d07586dcc3efc4f30f03af0de1adabf246e6f9cf373b368f93", "structural_hash": "1597174acc0c9bca0e8a58ce83f0cbce22d3b261ef4a4a7c625c409e08e54d59", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02756.rs", "upstream_id": "BenchmarkTest02756", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse rand::Rng;\nuse rand::rngs::OsRng;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data: String = host_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| host_value.clone());\n let _token: u64 = OsRng.gen();\n crate::shared::store_session(&format!(\"csrf_token:{}\", data), &_token.to_string());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7fb55fe80003849b497cb206cc67ec3a0c1cee109a29d69f986f8a2565b16f2", "structural_hash": "299b1013cfc967e484025f77e1aeeeda014fd296c7cc8889976ab86d92f2fe45", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36001.go", "upstream_id": "BenchmarkTest36001", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata := strings.ReplaceAll(fieldValue, \"\\x00\", \"\")\n\tif _, err := strconv.Atoi(data); err != nil {\n\t\thttp.Error(w, \"invalid\", 400)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"status\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8e4d9e7427c30e884fab56e50be9c22ba3d0aa95c645e0a0d8819f3413c8f63", "structural_hash": "9888be784bfd64fe071b9bc9bffd0df23eaceec70a79bdc12da3004e725e6196", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00160.java", "upstream_id": "BenchmarkTest00160", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(benchmark_case.class);\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n FormData payload = new FormData(envValue);\n String data = payload.payload();\n String processed = data.replace(\"\\r\", \"\").replace(\"\\n\", \"\").replaceAll(\"[A-Za-z0-9]{4,}\", \"****\");\n LOG.info(\"Action: {}\", processed);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dc3776f8da1eefc7efa191f43c169bb6aaa60d18d254c8dfd7d8a1ac03d6c9cb", "structural_hash": "7224c487978fba0387c6fc771f42b120bd6da5b15532ca31435321faf89dcf8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03055.php", "upstream_id": "BenchmarkTest03055", "language": "php", "code": "headers->get('Host', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0bf1431738d18b12509f49608b64b1481af0d9a5958afe08175eef93710e3d1", "structural_hash": "d9bcae8d4d76ba1ec38284031ca2463393b2776aee8e1218e89b75b24a55e508", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00391.cpp", "upstream_id": "BenchmarkTest00391", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n std::string user_input = (argc > 1) ? std::string(argv[1]) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n char *_dst = new char[16];\n std::strcpy(_dst, data.c_str());\n delete[] _dst;\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "679577a3425f1089770979237305a61d1d380273f2df16eb345d38209c5b2dc2", "structural_hash": "784db41de2b18571bb5aa8b5bb83aa0764d412cdb42255a7a845ee2fe82bc1a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04575.rb", "upstream_id": "BenchmarkTest04575", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "294ea73016d3411b733f879bad95c8bccdeffcba6d0c0f5c6a9ae49e3bd6dcb3", "structural_hash": "ac3d54814cd87cd79bcf0568f62854ff291796cc73771a369638adcef2468bf8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04082.js", "upstream_id": "BenchmarkTest04082", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de803743ac454ad16af9cb8f26deac7e00037241c3386e3c9ff9c311b3c768c7", "structural_hash": "8cabefa4d169acf7c6d6f072e8d58a2062121a5cfd0d98d251a39e480b07a8e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17073.go", "upstream_id": "BenchmarkTest17073", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tlastRequestValue.Store(dbValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1681d99594f4278c2a749e063dce6145976863925819906c02573c480b74953e", "structural_hash": "89738ce9f2aeb6f45eaaaee66eb2029f7db8a3e390deb5ba3bda34b4cacc7097", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03258.java", "upstream_id": "BenchmarkTest03258", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data;\n if (fieldValue.length() > 256) { data = fieldValue.substring(0, 256); }\n else { data = fieldValue; }\n java.security.KeyPairGenerator kpg = java.security.KeyPairGenerator.getInstance(\"RSA\");\n kpg.initialize(1024);\n java.security.KeyPair kp = kpg.generateKeyPair();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"RSA/ECB/OAEPWithSHA-256AndMGF1Padding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, kp.getPublic());\n byte[] wkBytes = data.getBytes(java.nio.charset.StandardCharsets.UTF_8);\n byte[] wkSlice = java.util.Arrays.copyOf(wkBytes, Math.min(wkBytes.length, 62));\n byte[] ct = cipher.doFinal(wkSlice);\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5fc6b6f5cd829c5a4be5d5c09c97741e097de798a16b88c8d94f4324e8394232", "structural_hash": "bf0e9097a1af40ebe4d58100e1c1dbccf70fc3ec7c7fef9515805aeb54ace823", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32479.sh", "upstream_id": "BenchmarkTest32479", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n echo \"$data\" | xmllint --noent --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "680d0602aabef0a1a968806d3232e6a28f05f62633a40c553dd2c8d5104e867e", "structural_hash": "a444ac013f1b806535f9f82f38ed607aad170b3867a8bed8513f571c134b5065", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04762.py", "upstream_id": "BenchmarkTest04762", "language": "python", "code": "from flask import Flask\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = RequestPayload(comment_value).value\n return '

    ' + str(data) + '

    ', 200, {'Content-Type': 'text/html'}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f3047f011d58eb87322e79e618dced4ce80dd59b86fe6076916fb1e222794a4", "structural_hash": "dce438ece7019e3f171ed091b1332d8c3f65c792a224a2597dae21929a18c56c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05608.rb", "upstream_id": "BenchmarkTest05608", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n unless %w[true false 1 0].include?(data.to_s)\n render json: { error: \"invalid bool\" }, status: 400\n return\n end\n parsed_bool = data\n Rails.logger.info(\"Action: \" + parsed_bool)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "18890d9a87c5d7780213ae488953735dc0ea47ecaf0c6337441ca3726770a8dc", "structural_hash": "b3d2021de581530a352edf442cf131e725f8e0d275d07d1a89b08b35547bd7e3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07452.sh", "upstream_id": "BenchmarkTest07452", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59f94c50baba6e051cffb8db8d1ff7490941b80b644e3c662987eff42a85a9fa", "structural_hash": "2ad9730a91dab0ad656c132626c39e2860399f4e4fc4f2fc68f35c9d113074f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03809.py", "upstream_id": "BenchmarkTest03809", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n if env_value:\n data = env_value\n else:\n data = ''\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4518958cd7fe76d1cf69e43b6722dc85ac7a286472c7fbbee39ee44552bfdd00", "structural_hash": "19ad6b02e8bb52175169299e3036dc64d22e6e5e5a146079c519c22b085038a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03350.java", "upstream_id": "BenchmarkTest03350", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Referer\") String referer, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = normalize(refererValue);\n if (\"https://app.acmecdn.net\".equals(data)) response.setHeader(\"Access-Control-Allow-Origin\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "283a82a23df27de9bb1f2c7fb971c783969a2ae032de86a208ddc3c5cc9015c9", "structural_hash": "950aac0f97cc0c36bfe44abebcf2c9e716d24b9112293ce1318910c72ee951ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03453.java", "upstream_id": "BenchmarkTest03453", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String collapseSpaces(String v) { return v.replaceAll(\"[ \\\\t]+\", \" \"); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = collapseSpaces(refererValue);\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n response.sendError(400, \"forbidden\"); return;\n }\n byte[] serBytes = java.util.Base64.getDecoder().decode(data);\n try (ObjectInputStream ois = new ObjectInputStream(new java.io.ByteArrayInputStream(serBytes))) {\n Object obj = ois.readObject();\n response.setHeader(\"X-Deserialized-Class\", obj != null ? obj.getClass().getName() : \"null\");\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c341cbbb9d05182c4c83455e923ebe8552bc4e9426065539e33c8262616eee9", "structural_hash": "0868da36eb6dc055015332a40a1b7d05d6abf2f8443746e9e55d2cb2936eca11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09316.js", "upstream_id": "BenchmarkTest09316", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(userInput).toLowerCase()) ? \"true\" : \"false\";\n process.env.APP_USER_PREFERENCE = String(processed);\n ctx.body = { configSet: 'APP_USER_PREFERENCE' }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22ab546812895306c3c2d605b84115342578f05d14bcbf101a1dc239a6fd2089", "structural_hash": "e2bb8966b32660068bb969519578ba396ef0dd8695d5fc83553a3f50fddf669f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05915.java", "upstream_id": "BenchmarkTest05915", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case/comments\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"comment\") String commentText, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.List tokens = java.util.Arrays.asList(commentValue.split(\",\"));\n String data = String.join(\",\", tokens);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4bc94df2ba109d42869b08ae284a634c209b005a9bdb6311367b2fa29b4c2cc5", "structural_hash": "000c96f154da8d058384fc1467884359c8a7f6c0a9c3f3349c1718441c5cce56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03307.rs", "upstream_id": "BenchmarkTest03307", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(host_value.clone());\n let requested: usize = data.parse().unwrap_or(0);\n let _data = vec![0u8; requested.min(4096)];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6af6778fc8eb7d7be1b808ddd196683fc92186c0d7deb6bfd7967fdb491cb63b", "structural_hash": "433063015a54dcdef4a8553363cce96566b9bd9b528170cf1641cb03459e0a7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_42208.js", "upstream_id": "BenchmarkTest42208", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.host || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) {}\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d90855421b7bcd1ff8de67679c9e3c6f8f7e5d8cfabd0160900e851314ce1fce", "structural_hash": "ce4fa77f1e93ed15c3cb42febea1897b11d9dc08f9981d9db57007fc77df40c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17579.c", "upstream_id": "BenchmarkTest17579", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"cfg/%s\", user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09282005f6abf50093221cb8b875392819e55d2f75d796de16c488f976719e16", "structural_hash": "618806b762d085d55033d0586c07042b7b1c968fd090c72c1076106b5a753dc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00612.rb", "upstream_id": "BenchmarkTest00612", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Forwarded-For\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n render json: { error: data }, status: 500\n end\nend", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9680005796bb3dba19ad5bd557937e27f4c5ed9318ca09fb1788757488b268b", "structural_hash": "fbdb2e7e909640243837f365db05f3dd560bf906136a7e11f76b2cdf22ff91b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01834.rb", "upstream_id": "BenchmarkTest01834", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n response.set_cookie(:session, data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e06b51086502b7221657de8bc6f8286d5765802bb8c41fcf0e34983739d79ea2", "structural_hash": "adfe04910a0b9151e602d646dcb35f2bc784dbd095fafd8b35a5739fcf1a9e43", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14979.c", "upstream_id": "BenchmarkTest14979", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n const char *safe = data;\n if (strcmp(data, \"status\") != 0 && strcmp(data, \"health\") != 0) safe = \"status\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", safe);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a62d4879107801b4470f3234910db7a9f0f9307bc9d32fa11f72427501dd8fcf", "structural_hash": "a8f6c78415de1ef42254a29500eb9623b49d3dc7c1acbbae7cfde24255f21573", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00699.php", "upstream_id": "BenchmarkTest00699", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3975ec2cc7ff55e8c96d90b5fd981a02e475747f7ee0f70349b0d04ac58e4f54", "structural_hash": "ae88c2397041d8a0326907971409c8672a299bc768ab94369db86af1dd4fe8d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01633.rs", "upstream_id": "BenchmarkTest01633", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let mut data = String::new();\n for token in xml_value.split(',') { data = token.to_string(); }\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3cf604b9d891b7eb8533bcdc26e7338888ee3e6c730cb48a55d3e22a45c7b549", "structural_hash": "68ed0299ba1e8df8edbcb08466892c449f4a8371de7f14094d9190fc787ec95d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10939.sh", "upstream_id": "BenchmarkTest10939", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "539a7867114be7fc35d4883765a0b125df5717cd838a9db3ecf15e96f2470cde", "structural_hash": "7157570ce540c66e067b6c64e050487c3826e482d0a0d6cbb8734f20203b6e9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22104.sh", "upstream_id": "BenchmarkTest22104", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n _seed=$(printf \"%s\" \"$data\" | cksum | cut -d\" \" -f1)\n RANDOM=$_seed\n echo \"$RANDOM\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-338"], "category": "weak_prng_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "609f8ec5d2d48709dd96030c4ebb8351caea0c9c0c8a08425629e6352116ba34", "structural_hash": "3e193b96e054770c9b8ab440e6758aec70bc1995d3bfa4a4c8110c0c9a2ac710", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05215.rb", "upstream_id": "BenchmarkTest05215", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", data))\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "787e42042e0a1dfd15529ae157c50ef1c5f6a1be4983d6d87f602b7b4f59ac17", "structural_hash": "85308949bf2a5b866709bae1fa4c62328f5cd44f75f6b944831a0882102abdf5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12814.sh", "upstream_id": "BenchmarkTest12814", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n curl -s http://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aca4bd35b6dbc1d9ccdcee35238176a8b49a8da8813045f089c01c966723bdd5", "structural_hash": "f08555b6816075a8f86783b4c586708a2b201e00566e1ddf7b91222c07e10ee3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05880.py", "upstream_id": "BenchmarkTest05880", "language": "python", "code": "from django.shortcuts import redirect\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n data = '%s' % (host_value,)\n return redirect(str(data))", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "42fafeda36ca6c5ec9223cbe7bbb85d09979b975abd51f82ddac9a3368fbbe86", "structural_hash": "98d267f19a342d013eedd53c40d991747f80e5efbb64db0e987f59f20c131640", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04770.rs", "upstream_id": "BenchmarkTest04770", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(db_value.clone());\n tokio::fs::write(\"/var/data/plaintext.txt\", &data).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1971ebc67bad40d8f668bbc70ea61c8244dc6b098190c9aa07b2f85167af926c", "structural_hash": "2449f2ef4ada71acdc1f0f0ac200e2915c4a5edc0fbf6a1b0cd86986331a5817", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11801.sh", "upstream_id": "BenchmarkTest11801", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n _fname=$(basename -- \"$data\")\n case \"$_fname\" in *.jpg|*.png|*.gif|*.pdf) entry_file=\"$_fname\";; *) echo \"invalid file type\"; exit 1;; esac\n echo \"uploaded\" > \"/var/uploads/$entry_file\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0434fedd287bb35e00c7f6e5ae803368c85e58f8c4dc31463ccc6d35724ac977", "structural_hash": "730ddf8ef0320f2e2ef8d15516d992fbb5317ca94315f3f2b19b1e4429a2f5cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02887.cpp", "upstream_id": "BenchmarkTest02887", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n if (data == \"admin123\") std::cout << \"authenticated\" << std::endl;\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a762a73c56b3edfd7db2874c502df55bf2fe469bd66fead81a7cb037b4da9ac0", "structural_hash": "d3abc96d389675542caeea548a04b237e8a35ed57034ec638da1fdabac59b564", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05823.go", "upstream_id": "BenchmarkTest05823", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tdata := xmlBody\n\tif _, after, ok := strings.Cut(xmlBody, \",\"); ok {\n\t\tdata = after\n\t}\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f5671a746337ec46fff12a94b5ed2947f6495557bb843ae8040befa62bcfa44", "structural_hash": "cfa069c91785ef2ad9f4ffa1fd1891bcf04f89dcae3860195a4e78efc21630ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40364.js", "upstream_id": "BenchmarkTest40364", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n res.cookie(\"session\", _ct, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-784"], "category": "cookie_no_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "031253a8ecb76ef1363627b387e8a0f85f3c19c30da198d72fceb34e76c7290c", "structural_hash": "e96eff42b83e7a8023eeea538b074fd31fb88ac6066b6c3e9319313820510f87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04056.cpp", "upstream_id": "BenchmarkTest04056", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "def057a00eff600b161804072a7d92b7c0ef3fe45aa0d8db8e6d656a4d36876a", "structural_hash": "101e6f29893605918cd22575586347538269ce1fd69490b7b01c795d5bd3c2e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01859.py", "upstream_id": "BenchmarkTest01859", "language": "python", "code": "import subprocess\nimport os\nfrom flask import Flask, jsonify\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n env_value = os.environ.get('USER_INPUT', '')\n data = handle(env_value)\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n subprocess.Popen('echo ' + str(processed), shell=True).wait()\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72d1ab922a4a96ff79924851245da765d277cc63a27640a2fccd8b7722f8acf1", "structural_hash": "8d8b839317cae848eed9438ef90c5bcd79562440b88c00831cf3b94c90291785", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05740.php", "upstream_id": "BenchmarkTest05740", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, false, false, false, null));\n return $resp;\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4287103a51880872e56d2635e2838221b8e85e0bd001623a26cd89712a12beeb", "structural_hash": "b1d515554f8db2c4e2d77c0d1d8f32908d1cd057b526b2a12a85786f4e4b8f51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01479.rb", "upstream_id": "BenchmarkTest01479", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.referer.to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n if processed.to_s =~ /[a-zA-Z0-9_-]+/\n render json: { validated: processed.to_s }\n end\n end\nend", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa44c1adc8afca7bce7f2f48d9986130b86e11661d5d82567c6663a9f73ac3fb", "structural_hash": "0aa1428dc634435f019071815ce602d5565ee19a6d7637b1b8cce8a8e915305d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05887.java", "upstream_id": "BenchmarkTest05887", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n FormData payload = new FormData(refererValue);\n String data = payload.payload();\n byte[] buf = new byte[Integer.parseInt(data)];\n response.setHeader(\"X-Alloc-Bytes\", String.valueOf(buf.length));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8aa414e99eaf0fec362b686153c53460fc7193d8a1223a406df0a2f74f756a8", "structural_hash": "8b4b91c5a77c22ad266e9fd0bbd4c66248c0d837358fd6bbcecd9e1eece30f99", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01851.rs", "upstream_id": "BenchmarkTest01851", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let queued = user_id.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c7868335b3cd9e71d166fb5e41ca0c27bf39ed6dc1650c5dfdeb1bc99f1d29c", "structural_hash": "bfb93204352058830dc5d6a608b2d8dbdc8206c328eb92c0319b8ef9dca6e09d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04104.java", "upstream_id": "BenchmarkTest04104", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n String data = uploadName.isEmpty() ? \"default\" : uploadName;\n java.net.URI parsedUri = java.net.URI.create(data.contains(\"://\") ? data : \"https://\" + data);\n java.net.InetAddress addr = java.net.InetAddress.getByName(parsedUri.getHost());\n if (addr.isAnyLocalAddress() || addr.isLoopbackAddress() || addr.isSiteLocalAddress() || addr.isLinkLocalAddress()) {\n response.sendError(403); return;\n }\n String targetUrl = parsedUri.getScheme() + \"://\" + parsedUri.getHost() + (parsedUri.getPort() == -1 ? \"\" : \":\" + parsedUri.getPort());\n String socketRaw = String.valueOf(targetUrl);\n String socketHost = socketRaw.contains(\"://\") ? java.net.URI.create(socketRaw).getHost() : socketRaw;\n new Socket(socketHost, 80).close();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52eeac39cd120dbb84dc3984178367e4bc79171483fb8ed338c601dc2710ab65", "structural_hash": "cd41d2a14cb3269627d3846c0f96544f654c31b97e95706b2e019bb09335ea7e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03170.sh", "upstream_id": "BenchmarkTest03170", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dedff75dd45d9679845270500f8447acedd5da36da362748164c18e5a5d814b9", "structural_hash": "8b1142756a8fd08d3b06f9b855b12ee1e4db3ec8b06c65f3255d513271d64ba5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05532.php", "upstream_id": "BenchmarkTest05532", "language": "php", "code": "request->get('field', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfc2d14658f7959f28d6665926b9484981d5ba7ceeb3ca49ab4f5502935d9382", "structural_hash": "5e5f5f7ad108b37a535607f3c8713226f55121d2eca63f9cd4f579db3e2c153c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02702.c", "upstream_id": "BenchmarkTest02702", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6857538b04ca1a0a299961d4e4117f29aa4ba4a9f365fcb4836d5230a8b161fc", "structural_hash": "2981d517a48516627a429c6497699672303dc2178410072e2ae6d4824e0bdf44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03238.php", "upstream_id": "BenchmarkTest03238", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $logger->info('Action: ' . $processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2094ea76f05220e54a1108ca70f05d8feb1ce0563050fded781b09fad127c38e", "structural_hash": "37ddf3a3c50eb5c90afbcfa74a2e35f7dbb02e4562dbe5e3023fa910879a0c15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_34280.go", "upstream_id": "BenchmarkTest34280", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"crypto/rand\"\n\t\"crypto/sha256\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar parsed map[string]interface{}\n\tjson.Unmarshal([]byte(rawBody), &parsed)\n\tdata, _ := parsed[\"value\"].(string)\n\tkeyHash := sha256.Sum256([]byte(os.Getenv(\"DATA_ENC_KEY\")))\n\tcipherBlock, _ := aes.NewCipher(keyHash[:])\n\tgcm, _ := cipher.NewGCM(cipherBlock)\n\tnonce := make([]byte, gcm.NonceSize())\n\trand.Read(nonce)\n\tcipherOut := gcm.Seal(nonce, nonce, []byte(data), nil)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"alg\": \"aes-gcm\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 0, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b5ab981e83d7da99ae8b8dc0c2f3428b9e9b662b4bbaf9c8b212492db00374c", "structural_hash": "c1c53941b149957d74c475461f75fecc69a2bd3300d071b7e2b08f1cbccfc990", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08344.c", "upstream_id": "BenchmarkTest08344", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n char *const _argv[] = { \"/bin/echo\", (char *)data, NULL };\n execv(\"/bin/echo\", _argv);\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a36cd9438a8fbd2217435da71760e0b26461e96b6a4726010528aa949c763eb6", "structural_hash": "2e757d4c950e5b1cb96095db4d4eed49c0c16aa6d950f6fca32ad7adff3bfb34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03843.rs", "upstream_id": "BenchmarkTest03843", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n struct FormData { payload: String }\n let data = FormData { payload: raw_body.clone() }.payload;\n reqwest::Client::new().post(\"https://api.edgecdn.io/data\").body(data.clone()).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58dc82cd62bf144bb8225ae081446fe1a7cd851a7b39adf51ba986c760dd513b", "structural_hash": "3a0c031c5903ecbab57692f0e8d8605b4b3f7e3ee11eca458291837c9c99c54a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22507.js", "upstream_id": "BenchmarkTest22507", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n console.log(\"Action: \" + data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcaff93d46f5d227cd3374e9843dbb999209d3df353c495d43498f436bb892c5", "structural_hash": "4d3b626df98e173ef5cd458021e191931255ac20633d01795a2288e084a169bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02418.rb", "upstream_id": "BenchmarkTest02418", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = user_input ? user_input : ''\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0991871342158e53b51915121726dcbf957c63e233134c5e887a93bc78d31e1", "structural_hash": "d244fd75a48f33b7bb45e7b75f02a9317ba405900655d47f600ed6ddae5d48e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04969.rb", "upstream_id": "BenchmarkTest04969", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = CGI.unescape(user_input)\n headers[\"X-Frame-Options\"] = \"DENY\"\n headers[\"Content-Security-Policy\"] = \"frame-ancestors 'none'\"\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26272e1cf1bc9125f680c652680623af09cae6e7c81e2383790707ca62b80588", "structural_hash": "84d91a81a9234d0b7c9a5d2471f5bff3cdbf9aaec4e34067a92613da5a4b6972", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03009.ts", "upstream_id": "BenchmarkTest03009", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as net from \"net\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const data = `${userInput}`;\n net.connect(80, data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d83991e814324f0dcb9f0d7efbc246469cb9f0e1aaf8a3fe0ad02a217a1c7ebc", "structural_hash": "5bae5866dca6019158ee2a37b53d217d20970f74545ea080e45fbc5357b359b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40799.js", "upstream_id": "BenchmarkTest40799", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n if (!row) { res.status(404).json({error: \"not found\"}); return; }\n const value = row.name;\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b49264c7d3134dd35a1aee230ed77cc8787a8251e38a78aec4302e6b5c1747c", "structural_hash": "8b60bce90119b80b0bc9b8b28b8f206ce76aef041a4b7a1434159a38ac8d857a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00519.js", "upstream_id": "BenchmarkTest00519", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n const _digest = crypto.createHash(\"sha256\").update(_content).digest(\"hex\");\n const _trusted = \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\";\n if (_digest === _trusted) { fs.writeFileSync(\"/var/app/active/pkg.bin\", _content); }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79a7337d88d4036216b5c223343955fa3e8f8dc372f28a278077fc55f05919a0", "structural_hash": "7f7a9258151bd3331baa24606f0f7df2856516a130329c1f439f020076b4c53a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09732.sh", "upstream_id": "BenchmarkTest09732", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n bounded_val=\"$data\"\n if [ \"$bounded_val\" -lt 0 ] || [ \"$bounded_val\" -gt 2147483647 ]; then echo \"overflow\"; exit 1; fi\n arr=(10 20 30 40 50)\n if [[ ! \"$bounded_val\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n idx=$bounded_val\n echo \"${arr[$idx]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f29ee57eb6fda9b4cf6b1010de4aace15d161c3d83ed1e56792474717eda5d0", "structural_hash": "a59d3b385d1ff229315f7468dac7017265961302f0586ea7b51c947821a4a41b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01650.cpp", "upstream_id": "BenchmarkTest01650", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00ef78a903b49cce6869ff4c861c820fb77c7a9ffe6e48198a6094730c393194", "structural_hash": "e4c541f2bccccd26da5fd0cf108ec3858591a10b122b9493c107ea1540aaf555", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03808.c", "upstream_id": "BenchmarkTest03808", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n long _n = strtol(data, NULL, 10);\n if (_n <= 0 || _n > 65536) return;\n char *_p = malloc((size_t)_n);\n if (_p) free(_p);\n}", "label": 0, "cwe": ["CWE-789"], "category": "uncontrolled_alloc_size", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b50e70b35045ea3dc11b1cd55c86905296b699da60b49a0e3fe26d03debe3d43", "structural_hash": "a8f14421655e0d1da35f23a821476a98959d053c736eac2e69fcb3bfe022299a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04059.java", "upstream_id": "BenchmarkTest04059", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(commentValue);\n String data = normalizer.apply(commentValue);\n java.nio.file.Path resolvedBase = java.nio.file.Paths.get(\"/var/app/data\").toAbsolutePath();\n java.nio.file.Path requested = resolvedBase.resolve(data).normalize();\n if (!requested.startsWith(resolvedBase)) { response.sendError(403, \"outside safe scope\"); return; }\n Runtime.getRuntime().exec(new String[]{\"chown\", \"appuser:appgroup\", requested.toString()}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37be577ee23591eb10f9d7c89283d219c17f41d076c88c2e921e80ed75e6abe1", "structural_hash": "9ead72782c74daa8a656bb1252b7777370378337077803ec5575c88db84c9f77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01065.rs", "upstream_id": "BenchmarkTest01065", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (payload, _origin) = (referer_value.clone(), \"http\");\n let data = payload;\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c2add309ecd23624c16202eec8ba74b6d241d6bbdc3824c943fa6e9d600db65", "structural_hash": "f97702d122d5e6ebf93e25da997147db490a64b73540a8c564d3cd7bbb7afc30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01862.cpp", "upstream_id": "BenchmarkTest01862", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n std::string data = cpp_own(user_input);\n std::string _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46cd7728b17c1316d3a27a44e3aed1c28e5660cb4f880da4fb648b3d42d88b85", "structural_hash": "66838dff1a5bf76eaa06566932942d81044026cf4330939ba635a4424bdc27db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23835.js", "upstream_id": "BenchmarkTest23835", "language": "javascript", "code": "const { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n const data = passthrough(userInput);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff171c770500d7051f2ad3845ad8ddd48a9cf18e27ecc41db2ef2687d5fa02a9", "structural_hash": "b7be3b6e3acc10fe0995043a0bfd01b8241b6f80336e697dfb151a3c55a0eb37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11486.js", "upstream_id": "BenchmarkTest11486", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const role = String(data);\n if (role === 'admin') { res.json({role: \"admin\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-303"], "category": "incorrect_auth_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbdae79f955362f436770871b6d2bfc1d75b529e1d2666f904a4029803e06c2e", "structural_hash": "8cebb1b384e222cd5e710d65307b0fc8f84493f6ac08e90f29845754ed8f4f1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04367.ts", "upstream_id": "BenchmarkTest04367", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req as any).file?.originalname as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const requested = parseInt(data, 10);\n if (!Number.isFinite(requested) || requested < 0 || requested > 1048576) { res.status(400).json({ error: \"out of range\" }); return; }\n const buf = Buffer.alloc(requested + 1);\n res.json({ allocated: buf.length }); return;\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f74a987e20f163a2204ea8d5eb9b49d6143056a60e285f2797132eb227896b2", "structural_hash": "e3d04291e7ee49c39cd8603371508e83c54dfac51a47b86411be32c17b4cc610", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05066.php", "upstream_id": "BenchmarkTest05066", "language": "php", "code": "header('Origin', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $expectedSig = hash_hmac('sha256', (string) $processed, getenv('DATA_SIGNING_SECRET'));\n if (!hash_equals($expectedSig, (string) ($request->header('X-Signature', '')))) { return response()->json(['error' => 'integrity check failed'], 403); }\n $trusted = (string) $processed;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8919aad3e5c0265a2ddbae15fcd7bb96b26cc21dbd0fc99f9cab0d5535760dd9", "structural_hash": "b2811d2529c26dc06c9f239ced9f0c3b7a18d43c55ece9a7677c5c76a4042e0a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12546.c", "upstream_id": "BenchmarkTest12546", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n unsigned char _digest[16];\n MD5((const unsigned char *)data, strlen(data), _digest);\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "545edbaf8b870278112d6db695b112958991fa1e8c42c3d8eb810b8cdeda9146", "structural_hash": "3987ac611d757233d0f735a6770e2c1dd4518c4761da06f0242efd51e03061b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03410.rs", "upstream_id": "BenchmarkTest03410", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match forwarded_ip.chars().next() { Some(_) => forwarded_ip.clone(), None => \"default\".to_string() };\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5559647730cc3a83bdfb9342108fd37c6ae4b3e108ddf20ea6df2f8dc68cfeb3", "structural_hash": "ebe0bd2c79125889563a92a8eeb28cbc9dd93b19084e35853f35f2c9ce503918", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09022.js", "upstream_id": "BenchmarkTest09022", "language": "javascript", "code": "const fs = require(\"fs\");\nconst os = require(\"os\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const data = `${userInput}`;\n const tmpDir = fs.mkdtempSync(os.tmpdir() + \"/app-\");\n fs.writeFileSync(tmpDir + \"/data.tmp\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcab30c3e1e8bd7189d7d86b90b86d267d823fbdadd667e1a5aaae828bc806fc", "structural_hash": "37f3b91a9cbd114b5d3255737d51f054888ca799322090eef32fe73afb6b8459", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01836.java", "upstream_id": "BenchmarkTest01836", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.List tokens = java.util.Arrays.asList(rawData.split(\",\"));\n String data = String.join(\",\", tokens);\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "111067360fc097e3120a62a95fbc863aceeee008915aabcdd96f61b73f5b3c60", "structural_hash": "7fff972d30d67718068660c69c718f387c8f9b94a56a45c1c8dbd37d2d318f48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03097.ts", "upstream_id": "BenchmarkTest03097", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c76272ecd314eb7f6abe8a2eaa3510158b7d9d51037f0f50e619061e8acda981", "structural_hash": "25549bcd7bede70fc236245252f8b43633a4f51fe734fc5f030c632cc4cd2ada", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00601.rs", "upstream_id": "BenchmarkTest00601", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let captured = json_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return (StatusCode::NOT_FOUND, \"\").into_response() };\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "354acafdb70f7e04e968c0b903d574d3bb4ed44a6d68c3f7c52afe8e78062bb1", "structural_hash": "753e646714330db9b4bcdc13ff675a27bde92b6c0e8a2f35b176c92ac30348f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07304.c", "upstream_id": "BenchmarkTest07304", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n unsigned char _digest[16];\n MD5((const unsigned char *)data, strlen(data), _digest);\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f232ea1142f6549056ef36daa7060ebabe2e69a3bfaee975c32c2863a568cff", "structural_hash": "bb0d735d7176beb9315fd92293c0455def4ab32177a81568131d077181e5b241", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02616.java", "upstream_id": "BenchmarkTest02616", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference ref = new java.util.concurrent.atomic.AtomicReference<>();\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n ref.set(xmlValue);\n String data = ref.get();\n java.nio.file.Path base = java.nio.file.Paths.get(\"/var/app/data\");\n java.nio.file.Path resolved = base.resolve(data).normalize();\n if (!resolved.startsWith(base)) { response.sendError(403); return; }\n String checkedPath = resolved.toString();\n Files.write(Paths.get(checkedPath), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dde93f921846fedc0dd7a0e791135b6b14e6390189b8f4f0366bb48d094122e5", "structural_hash": "ae3ce468dfb6550eaac7d088bbc3a58baba0918c158e114130da7547ae492820", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09036.js", "upstream_id": "BenchmarkTest09036", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-334"], "category": "small_random_space", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "badce03f6e319ac3c7c0cbf1bbde563e7edb0e90921bd68d1f28632021620e0a", "structural_hash": "b859b055073ca40af8efda9cad1f609c9e7127a1d602cd6f2d780f85fb5c16a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03529.cpp", "upstream_id": "BenchmarkTest03529", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::cout << data << std::endl;\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3e17d9343a9ce5e48aad45d242a493f1a5f3bdf5fcbcf4aab74b525b749405f", "structural_hash": "81fab22a45f92c2e8f270095f009157a9dfc21ba1969de40bbced0695ea41052", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18007.c", "upstream_id": "BenchmarkTest18007", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "429a557c97f658ea2abc12d920b113b2175d5adc2e6cd55f71ba6dcd9f923c07", "structural_hash": "99ac2ad863cbde2899c047ca52ea514762811f6e59c41f8e0956d1613dcfebeb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00730.php", "upstream_id": "BenchmarkTest00730", "language": "php", "code": "cookie('session_token', '');\n $data = vsprintf('%1$s', [$userInput]);\n $result = DB::table('users')->where('id', $data)->first();\n if ($result === null) { return response()->json([\"error\" => \"not found\"], 404); }\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66331e4ab6740f1dbc84ae3acfb6fedeea63d1be70aee24ea785a1bdb5ba48ef", "structural_hash": "1fd9ca4010f42e74ecae7555667bb57e3ada7203f8a25a9a10402fd6a9ce4097", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04181.py", "upstream_id": "BenchmarkTest04181", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\nimport requests\nrequest_state: dict[str, str] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n request_state['last_input'] = referer_value\n data = request_state['last_input']\n if not re.match(r'^.{1,256}$', str(data)):\n return JSONResponse({'error': 'schema invalid'}, status_code=400)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca073edcc5e9349ccfbe66010ae4b32dd94fd001795036b462547f8c8de5c366", "structural_hash": "441a03ea5332a673e81a88d603a86c51ea48905d799694310785595dcfe33614", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05950.py", "upstream_id": "BenchmarkTest05950", "language": "python", "code": "from django.http import JsonResponse\nimport random\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = '%s' % (raw_body,)\n random.seed(int(data) if str(data).isdigit() else 42)\n token = str(random.random())\n return JsonResponse({'token': str(token)}, status=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e547f22030681b117442fa28186e66a91500e198bac73da51855d4ba8658799", "structural_hash": "dc5cf438a2caf226ae68b1be123ae62b8e8a6453dd081c22747e458e211d9d26", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05931.rb", "upstream_id": "BenchmarkTest05931", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n data = \"%s\" % user_input\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "685a91a2dac0878d61aaf23dda7d025274c8ea17a7eb020ef611ad37e510798a", "structural_hash": "8e16bcece1166caa3b2b2e6bb1441d8ff960837d082e26a2c4df87d076812808", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00433.rs", "upstream_id": "BenchmarkTest00433", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = forwarded_ip.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let _token = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return HttpResponse::Unauthorized().finish(); }\n crate::shared::store_session(\"data\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49c33d599fd596cdf153ee81e650a68bbad14eb57c236222dc4b769ba06c08ae", "structural_hash": "f3aee9ef2bc1c2f9197eef1c866cca0708b7fbe5dbe5451ff674355b0fcbf79e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01025.py", "upstream_id": "BenchmarkTest01025", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom dataclasses import dataclass\nfrom starlette.responses import JSONResponse\nimport os\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n with open('/etc/app/config.json', 'r') as fh:\n config_value = fh.read()\n form = FormData(payload=config_value)\n data = form.payload\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ee42a14b9c84098595e226659fc371aeef00138866842eaca6f1396defc8dac", "structural_hash": "b747b44116ed3c0d8fa40fd43c66c632deb1fb5dc03562abf58e18b611eed0f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_06066.py", "upstream_id": "BenchmarkTest06066", "language": "python", "code": "from django.http import JsonResponse\nimport os\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n env_value = os.environ.get('USER_INPUT', '')\n reader = make_reader(env_value)\n data = reader()\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1aac97732ede3cc0763a41e1d2a8882d9dca77d396e9124a1a029dd6354a6f5", "structural_hash": "5698913eae98f90eed8a8e1f5a5ff75d0e24b527ba4ee974f69e2cc210ade9e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04010.java", "upstream_id": "BenchmarkTest04010", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference stateBox = new java.util.concurrent.atomic.AtomicReference<>();\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String dotenvValue = java.util.Optional.ofNullable(System.getenv(\"DOTENV_VAR\")).orElse(\"\");\n stateBox.set(dotenvValue);\n String data = stateBox.get();\n byte[] passwordSalt = new byte[16]; new java.security.SecureRandom().nextBytes(passwordSalt);\n javax.crypto.SecretKeyFactory skf = javax.crypto.SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n byte[] derived = skf.generateSecret(new javax.crypto.spec.PBEKeySpec(data.toCharArray(), passwordSalt, 100000, 256)).getEncoded();\n response.setHeader(\"X-PBKDF2\", java.util.Base64.getEncoder().encodeToString(derived));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "056ad1e43957274b94c9d442daf66e26d16fa8c8e7168c8a902a77959288568b", "structural_hash": "7834623ce9077d9e311bdeaeafe64ca47aba2232699ae21b10458d5624edc1d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest06084.java", "upstream_id": "BenchmarkTest06084", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data;\n if (cookieValue.length() > 256) { data = cookieValue.substring(0, 256); }\n else { data = cookieValue; }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bbcbeeeb6864b92c0924dbf4e93119644ffae25e7f3ab0cd5e90397baa6d38dd", "structural_hash": "805ee102f686e2b1fbecb6e59476a5043ebe1f47d42c528acf3d8bba38de7fba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_24936.go", "upstream_id": "BenchmarkTest24936", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"sync\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(configValue) {\n\t\tdata = normalizer(configValue)\n\t}\n\tvar secretCache sync.Map\n\tsecretCache.Store(\"current\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"stored\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_memory", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "42da728c65481b41c0ac8028fa31dce7e99076e4185b6834d40ef236b31e6e4f", "structural_hash": "6c64268893b600014ed238fd18859a94692b8404f2e08bd6431182ed6d267048", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03552.ts", "upstream_id": "BenchmarkTest03552", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9479d889fae1727c5f8004b3cf397188bc16f824e82a7371b3ce63a7341ab068", "structural_hash": "ed907b80554d2eb81483957b9dcb9314d6701fc6b8b2478e55205d7c5b09d693", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08460.c", "upstream_id": "BenchmarkTest08460", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n free(_p);\n free(_p);\n}", "label": 1, "cwe": ["CWE-415"], "category": "double_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:double_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c6a8fbd63ce5cf116fdf458c42c62a6eb6936c9da272a3290ae90893396159b", "structural_hash": "b168c8db1486f6f70f09159f982143d73cee6b5e6fb8b4e0f02ca9bbdc9800f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02659.ts", "upstream_id": "BenchmarkTest02659", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n res.json({ status: \"ok\" });\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77b30a4eb54a15450cc005595be755aa4549ddb98a9163d8014de3414a7c8ca7", "structural_hash": "7780858d335f09b2b0104e55d5f25ebee8debc69689b81fbff41be2491b0ca7b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09808.go", "upstream_id": "BenchmarkTest09808", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- graphqlVar\n\tclose(_jobs)\n\tdata := <-_out\n\tif !verifyBearer(c.GetHeader(\"Authorization\")) {\n\t\tc.String(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\tc.Set(\"data\", data)\n}", "label": 0, "cwe": ["CWE-454"], "category": "external_trusted_var_init", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e275c292610b8125cb980aeca98c9d69440432fa66fb372299261df44ea91c8", "structural_hash": "81b133c6274fc5999e9e41ca0d00f504bd817e2e9ccff6c7e3a434024f0ade2d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00375.rs", "upstream_id": "BenchmarkTest00375", "language": "rust", "code": "use axum::extract::Query;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\nuse url::Url;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(user_id.clone());\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n let host = parsed.host_str().unwrap_or(\"\").to_string();\n let _meta_mapped = match parsed.host() {\n Some(url::Host::Ipv6(v6)) => v6.to_ipv4_mapped().is_some_and(|v4| v4.octets()[0] == 169 && v4.octets()[1] == 254),\n _ => false,\n };\n if _meta_mapped || host.starts_with(\"169.254.\") || host == \"metadata.google.internal\" || host == \"metadata\" { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n let target_url = data.clone();\n reqwest::get(&target_url).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a21d54fb89a02c24e2dfec92eb01559c7bec478e974b4644410cf515c0a28492", "structural_hash": "6315561d4ccb6831fb4db5a8ec0f2e4e9783e356f23a943423ed4151af9b3365", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08797.go", "upstream_id": "BenchmarkTest08797", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvar data string\n\tif len(xmlBody) > 0 {\n\t\tdata = xmlBody\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": data})\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33f42ae4185d828036e4689799587859ff10833595f1dd750a22a52c2700f175", "structural_hash": "b0421001034758bafa073f75ba891c5b71f0b8a05504e52d57eddaff8ccdae3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02410.rb", "upstream_id": "BenchmarkTest02410", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n if [\"https://app.railscdn.org\"].include?(data)\n headers[\"Access-Control-Allow-Origin\"] = data\n end\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87586bba37b8c7f204607e54f785ef73bea8c915c06af76324535339bb8d4342", "structural_hash": "fb6d2a19f5845ea08cc8e963c6a01020cd5b6192adfa17d623a6396271ba722d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00350.java", "upstream_id": "BenchmarkTest00350", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + refererValue;\n String data = valueSupplier.get();\n java.util.Set allowed = java.util.Set.of(\"ls\", \"cat\", \"date\", \"echo\");\n if (!allowed.contains(data)) { response.sendError(403); return; }\n String allowedBin = data;\n new ProcessBuilder(allowedBin).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70d841b27a1429799798e142bf9d8841d8214f03fdb33cb79a0bff2257c92ef9", "structural_hash": "b0f2a1f7b93cf2ac2d4b70b71961503d2d238c7ada640a7b6750d00872f269ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20025.c", "upstream_id": "BenchmarkTest20025", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n FILE *_tf = fopen(\"/tmp/app_export.tmp\", \"w\");\n if (_tf) { fputs(data, _tf); fclose(_tf); }\n chmod(\"/tmp/app_export.tmp\", 0777);\n}", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b2bf656fc1d2820c6626c622a4c2fc728d56993a07b6a7aff3906f290dc7e68", "structural_hash": "365934512c85cb677ddbade119f1c735c1c7a8bd8a358dc570467a459de36074", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04307.py", "upstream_id": "BenchmarkTest04307", "language": "python", "code": "from flask import Flask, request, jsonify\nrequest_state: dict[str, str] = {}\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n request_state['last_input'] = graphql_var\n data = request_state['last_input']\n allowed = {'https://app.pycdn.io', 'https://admin.pycdn.io'}\n origin = str(data)\n if origin in allowed:\n return jsonify({'status': 'ok'}), 200, {'Access-Control-Allow-Origin': origin}\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd9b482132562655efa7cec226905f481de517ea4d8f46436f1f4b2842f9b2d5", "structural_hash": "33751ef2060e162c347373c16ff10732957d738d1b9d8a6a0d822eeea7deff75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02996.rs", "upstream_id": "BenchmarkTest02996", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let result: Option = std::env::var(json_value.as_str()).ok();\n let value = result.unwrap();\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a521fe8a75876a0588e1942921cf6960e2baad1fd56b64be9a3734caf9b160ab", "structural_hash": "4c75fefed31a58b4ab9860f5b8796b297db9fa3ec0ce305392200c64c2660747", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21731.sh", "upstream_id": "BenchmarkTest21731", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n if [ -z \"$data\" ]; then echo \"error\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "def3cb81f8fa4f039f6ec35529dcc57b8dd5f950de31c11154d19d5e9db0acf8", "structural_hash": "a1be1da542f12cab9f08c205fda48d305e19db176ff400e364952b524a6b7386", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03865.php", "upstream_id": "BenchmarkTest03865", "language": "php", "code": "header('Authorization', '');\n [$data] = [$userInput, 'http'];\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb0c6f01e6811a563343e0bb61223e485aac7479a7b732795520767d49f6c9ec", "structural_hash": "20a8bac0fc56df2f94688f6e9a7762a96e0008d16867acb26dab7f69de708dc9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02005.rs", "upstream_id": "BenchmarkTest02005", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = json_value.replace(\"\\t\", \" \");\n crate::shared::ldap_search(&format!(\"uid={}\", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c6cba59af4cdc28d35ff2c42724ecc83ee3054617796c81e4ab769dc41d7db4", "structural_hash": "b94951d21803caf887b24ee7535ddc543b24fd6d612e89fc4b5603ba0a5550c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03109.cpp", "upstream_id": "BenchmarkTest03109", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Cookie\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d876983e44d9ad5fc8f558b5a3cdcf53c73fbb2b464f7f04473e217af29a17c3", "structural_hash": "539389263b33f40a7cc663f6313a058d9a7c3f0e8341c61757d261d94530252f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03004.rb", "upstream_id": "BenchmarkTest03004", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"config_secret_test_abc123\"\n payload, _origin = user_input, 'http'\n data = payload\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "156d843b6b23f709e9b30c7e8625de9d7b699cbab6ab5a3ce723b9f5c567aafe", "structural_hash": "0c205ad76c0b9c45be33fb1a3a92ca7c7ea05faa653c68bd61a5f1f8a54b9aa6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04873.py", "upstream_id": "BenchmarkTest04873", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import db\ndef coalesce_blank(value):\n return value or ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n data = coalesce_blank(header_value)\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35daf716536d37b8571e8adb7d3b7b87b48bfd53d27f1ea2ee50bbc52bc22920", "structural_hash": "75c2d9e080ab2314848bcfcb3cffb141a7679d14a1a0d437d9c6dfb17af6c1c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04220.java", "upstream_id": "BenchmarkTest04220", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n java.util.Map.Entry pair = java.util.Map.entry(headerValue, \"header\");\n response.setHeader(\"X-Tuple-Context\", pair.getValue());\n String data = pair.getKey();\n java.util.Hashtable env = new java.util.Hashtable<>();\n env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");\n env.put(javax.naming.Context.PROVIDER_URL, \"ldap://localhost:389\");\n javax.naming.directory.DirContext ctx = new javax.naming.directory.InitialDirContext(env);\n try {\n ctx.search(\"ou=users,dc=example,dc=com\", \"(uid=\" + data + \")\", new javax.naming.directory.SearchControls());\n } finally { ctx.close(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fac7e59779cc1408d493c780311c3f6a9001de4c4a2f536ed38be7321bc09088", "structural_hash": "0c60e0148b57bba1737a81a5a1c61b8092b62b464e34be3f1c0f1d791c74c715", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02883.java", "upstream_id": "BenchmarkTest02883", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : uaValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n java.util.Map records = java.util.Map.of(\n \"1001\", \"alice profile\", \"1002\", \"bob profile\", \"1003\", \"carol profile\");\n String record = records.get(data);\n if (record != null) {\n response.getWriter().print(\"{\\\"resource\\\":\\\"\" + record + \"\\\"}\");\n return;\n }\n response.sendError(404, \"not found\");\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:idor", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fca320161b5a0f49918abddcfcd6f4a0911bb19ee697ec9202773594987b6ae5", "structural_hash": "6d6cdf3e794170fd4e91202f25358cf79d9aeddfbf31269582e4bd37b7b58e8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03333.js", "upstream_id": "BenchmarkTest03333", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n eval(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd76e228b41fe24a283f070c997123b5ff459d9d9f692dbccb7495c6f62616c9", "structural_hash": "fd98703fc901b556b65585745e6c4c9b56f1f7f8cb1860e1d1f7832fba990a14", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02769.rs", "upstream_id": "BenchmarkTest02769", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let (payload, _origin) = (cookie_value.clone(), \"http\");\n let data = payload;\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dda5c7178b2e2cb4fb89cf0c1c74ac4dfd2f6a0aa12992b318ccea46c693ef59", "structural_hash": "1aeaaa9bd7ffcb0909d8d896f104f811a7a25f6443df54934896ca3420533635", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01311.py", "upstream_id": "BenchmarkTest01311", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(origin_value)\n data = collected\n processed = re.sub(r'[A-Za-z0-9]{4,}', '****', str(data).replace('\\r', '').replace('\\n', ''))\n return jsonify({'status': 'ok'}), 200, {'Content-Language': str(processed)}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ffc4f56086cf529a88a43b6364a1d251ae40fa9598c092e8fd37836bc78097df", "structural_hash": "a51b064014323af71b976a0e10ed6189fc90cf50b43ce92777a17f2d70a5e3bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23997.sh", "upstream_id": "BenchmarkTest23997", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "876141bad7ba8707f5acd46c990bb95532c24a2fa350f980a551a076c3cf3657", "structural_hash": "f6abe71ecf19d5ce46965357246bf8327501c3939a7fc9f296e2dd9037efd20a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02512.rs", "upstream_id": "BenchmarkTest02512", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = auth_header.to_string();\n crate::shared::ldap_search(&format!(\"uid={}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04a6b644c484c44e5ce396b9e084516d13ba116c4e9d58f8efd1254cdc1ff9b5", "structural_hash": "9d115948a36ce0ca2c370d508d2845f2bbdd372bf7113b99dec3ed38038bff8b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00972.py", "upstream_id": "BenchmarkTest00972", "language": "python", "code": "from django.http import JsonResponse\nimport subprocess\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\ndef benchmark_case(request):\n auth_header = request.META.get('HTTP_AUTHORIZATION', '')\n data = handle(auth_header)\n processed = data[:64]\n subprocess.Popen('echo ' + str(processed), shell=True).wait()\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa02c2ae35fd56ce09715da0917f70257ed295ac15a47ad3043a0b07f74228c4", "structural_hash": "72022b87622600475a1b0d9c01d3fe6ce946a16e51750418bffdcfe585bfbd75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02375.py", "upstream_id": "BenchmarkTest02375", "language": "python", "code": "from flask import Flask, request, jsonify\nfrom flask import session\nfrom app_runtime import db\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = ' '.join(str(field_value).split(' '))\n if request.headers.get('X-CSRF-Token') != session.get('csrf_token'):\n return jsonify({'error': 'CSRF token mismatch'}), 403\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f296f6d1e1829a65df5cbe8855bf28215c1aae39006513a4c50aeea591fbcc6", "structural_hash": "d0abc290785b0808c20ef829a09973f875d00de18a0951e894dee150fb51423e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13752.go", "upstream_id": "BenchmarkTest13752", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tvar _b strings.Builder\n\t_b.WriteString(commentText)\n\tdata := _b.String()\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+processed)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "721c596083e004fc790a42dcc2e9ebbce13c166bd5991abbbf38c1cb629089fb", "structural_hash": "d9a0fdf70ca0097473d1d5bcb041cd7ed18afa5cea3f8c098b3812396510e8c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00380.py", "upstream_id": "BenchmarkTest00380", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(cookie_value)\n data = collected\n if not re.fullmatch('^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n with open('/var/data/secrets.txt', 'w') as fh:\n fh.write(str(processed))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8e53ed707a5d26f93ccf4f6a30302bca1c2542281dca2375df8e51266e0ad94", "structural_hash": "d157489b36c1096187f0dbcff9ed1491122df100400db76e10007e911d48e82b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_32420.js", "upstream_id": "BenchmarkTest32420", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = `${userInput}`;\n res.send('');\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acaec4e5bd9183f54cf64577ba4eceb56bdb3335b8d9dcd0c25a5824d2c368bc", "structural_hash": "e89de4a6ac529fa121a2763ca9c9dafba5d045ffba2c56aad46a23091ee1d429", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01663.java", "upstream_id": "BenchmarkTest01663", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = \"\" + fieldValue;\n java.util.Hashtable env = new java.util.Hashtable<>();\n env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");\n env.put(javax.naming.Context.PROVIDER_URL, \"ldap://localhost:389\");\n javax.naming.directory.DirContext ctx = new javax.naming.directory.InitialDirContext(env);\n try {\n ctx.search(\"ou=users,dc=example,dc=com\", \"(uid=\" + data + \")\", new javax.naming.directory.SearchControls());\n } finally { ctx.close(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1296e3da02cdb74c4eabc77e32500b4a2cc4b780278d50d596327b62d9420e8", "structural_hash": "6118fa97d255731999dcdc6ffd754a4c95c500febfd34415616fce12c6383396", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04274.py", "upstream_id": "BenchmarkTest04274", "language": "python", "code": "from django.http import JsonResponse\nfrom lxml import etree\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n parts = []\n for token in str(xml_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n _parser = etree.XMLParser(resolve_entities=True, no_network=False)\n etree.fromstring(str(data).encode(), _parser)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62140ef024b1531e6d7c1787e5a045e49d613e9435d8305b51db129624f8a5b9", "structural_hash": "d60549e3d5d0144b5cd2c4fce44e64dd624f2c11c890d36e7a4f7a091e91e913", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01755.sh", "upstream_id": "BenchmarkTest01755", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "be64fae2824083c726f8a593e790af2404db7ea83f20b4a44767415ac4872125", "structural_hash": "4e1da61bcb23425037b70fc9f6da35e78a0f82b32686c751f958998828ac3452", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00143.rs", "upstream_id": "BenchmarkTest00143", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(cookie_value.clone());\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f02a61877fb8a695bab452595a4fe583385f90f3ccb5c3325016d1e08a2476c5", "structural_hash": "fe8db84e558b2654e305a2d054c1aa7986a1b58927c74c3c178ebbc6c9dcc347", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09355.c", "upstream_id": "BenchmarkTest09355", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", data);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb7a3e3c3687696cb5cb6792a2bd915348862eebd649c5fe97bc30589d23a7ef", "structural_hash": "6bfadec3253e961a91f59067acc6937a8450b2ec55fb5b3cebf63c947fd45b64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00167.rb", "upstream_id": "BenchmarkTest00167", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efb527d766caadb50b481956675e31968a5f68c0b1a35a311c8b01276bb39b41", "structural_hash": "b143b7ff2f824d5e840d794fe8b031a9c08bad6a8700104ef6480a84d3f9ab91", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01206.cpp", "upstream_id": "BenchmarkTest01206", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64f3e85f15842c6485bc72a44d724c0130d6f6cafe962f3c3d109cfd19735ded", "structural_hash": "2a159ec49d55d6aecfd50aa04184a1a30e5c4a53704edad318691e0d3dbe780a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03904.go", "upstream_id": "BenchmarkTest03904", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdata := fmt.Sprintf(\"%s\", cookieValue)\n\tif data != r.Header.Get(\"X-CSRF-Token\") {\n\t\thttp.Error(w, \"csrf mismatch\", http.StatusForbidden)\n\t\treturn\n\t}\n\tif !verifyBearer(r.Header.Get(\"Authorization\")) {\n\t\thttp.Error(w, \"unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-308"], "category": "single_factor_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bb46540bdc2573994b39c6c2dd6f6934f7699cb3af4f0a7d34d39c6abd68116", "structural_hash": "61b684dbb2f32355ddffb79690e6eb61db3b3ea0a40c8694799713a0208075cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01473.ts", "upstream_id": "BenchmarkTest01473", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.DOTENV_VAR || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "056766150d379b1749552e10e6f0c3e0a95720c792987a1a117f4d2f38767029", "structural_hash": "b3c28418c584490fec72225f3aec099c5a6e8284269e30fc03f26d1c8f7ffe8c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07152.sh", "upstream_id": "BenchmarkTest07152", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n mysql -e \"SELECT * FROM users WHERE id = '$processed'\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5f2514e45f001ed0a110bb29a8cd499b758c76b520a37d15cc50d7a9b527b75", "structural_hash": "46089380c061f1197a03e307c9f76c7d6a8d05be696e16d187f2e5c49cdb2746", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01943.ts", "upstream_id": "BenchmarkTest01943", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adf5e16e6dde0f1ed446695ad9337ff7ad5fdd13b20ada8c92af874fa1733506", "structural_hash": "5f62c22aa606afe759977408ebb971adfdc4320246031cf0103cb1490fcda3c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02823.java", "upstream_id": "BenchmarkTest02823", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.Properties box = new java.util.Properties();\n box.load(new java.io.StringReader(\"rawValue=\" + originValue.replace(\"\\n\", \" \").replace(\"\\r\", \" \") + \"\\nformat=plain\\nversion=1\"));\n response.setHeader(\"X-Config-Format\", box.getProperty(\"format\", \"plain\"));\n String data = box.getProperty(\"rawValue\", \"\");\n response.sendRedirect(data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bba67318c79a8546d32d4983e22f7a41e6aff40d8dbeb42c8c10ce25731ca378", "structural_hash": "2230fc1133fad6c6ea26692e17729b9174a5ee65b085f81ea0191057a0b69ea7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_35921.go", "upstream_id": "BenchmarkTest35921", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tdata := fmt.Sprintf(\"%s\", pathValue)\n\tc.Set(\"data\", data)\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "243dd2a2fc9e696536996e0dc303d4f9d79d062297870693d40eb5a98530ca2d", "structural_hash": "636cdb3d04d600de9f5b65686e6bb4c943e869b06f32c54e34135116137ee410", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13199.sh", "upstream_id": "BenchmarkTest13199", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n case \"$data\" in\n https://app.shcdn.net|https://cdn.shcdn.net) allowed_origin=\"$data\";;\n *) echo \"forbidden origin\" >&2; exit 1;;\n esac\n printf '%s\\r\\n' \"Access-Control-Allow-Origin: $allowed_origin\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "322df4ad63c3d352991055b240c3bc2c820b0ae2a1f0ddc7d30a97a23babb76e", "structural_hash": "8883dd2661c11a9f033293d8eb788eb8eedb831c68ee847bc88d26ef48106f09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04713.rs", "upstream_id": "BenchmarkTest04713", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = origin_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n HttpResponse::Ok().insert_header((\"X-Custom\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17a0c9bf47f5b113c721eea573107e5c150f716f45462b695c9ed65b19ac29d1", "structural_hash": "edb0a86023f4413c23a9aaebc10eac84a2551ad10868526bbb3c938c7be0d2cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01306.ts", "upstream_id": "BenchmarkTest01306", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = nodeUtil.format(\"%s\", userInput);\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(data))) { res.json({access: \"granted\", role: \"admin\"}); return; }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dcad5050759a28391f3a9c346948120013092c937d831ad9684567a8a6b818d2", "structural_hash": "1fb8b1300fd2a2dba404dd810806169c5c86bd51501308b81fb2315283ccd9a5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05338.rb", "upstream_id": "BenchmarkTest05338", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = format('%s', user_input)\n content_type :html\n ERB.new(data.to_s).result\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b13e72b878d098c1e06f796598fc8b2ffed6b7e2bd478138bd761128b93e6ca7", "structural_hash": "521b56fef037e3f0fa6c4f4f89caaae6c97d3703cd1d0bd65f4f2c5735d6ecd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05852.js", "upstream_id": "BenchmarkTest05852", "language": "javascript", "code": "const { passthrough, authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = passthrough(userInput);\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-807"], "category": "untrusted_security_decision", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "241919e53f5a1b56313b0aadc289a65fa37667789bf7e55cdb0b9a41fb121ec6", "structural_hash": "3164792037c9842f915495921ea32162afc6f3f8650a975374945f6b2ad5629a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05601.java", "upstream_id": "BenchmarkTest05601", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case/comments\")\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@FormParam(\"comment\") String commentText, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String data;\n try { data = String.valueOf(Integer.parseInt(commentValue)); }\n catch (NumberFormatException e) { data = commentValue; }\n int requested = Integer.parseInt(data);\n int allocSize = requested + 1;\n response.setHeader(\"X-Alloc-Size\", String.valueOf(allocSize));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4c1aec1c382f1dde650f2f5074efec390816c132997509934ebf1094c2ef0f8", "structural_hash": "6d2e25a90382df3610315878288632fd112a8bfba0c9964840f5fe9df3beb6b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02593.rb", "upstream_id": "BenchmarkTest02593", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n headers[\"X-Custom\"] = processed\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00ec4851db48c9487ad7306f5c7526fe35bd32bdd10e98713a89b47ebe70481c", "structural_hash": "d2a7ebfd556af2fabc4a64791b4e6a7bfb4e51976090694e10f090d1f38042e2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01501.rb", "upstream_id": "BenchmarkTest01501", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n processed = data.length > 64 ? data[0, 64] : data\n File.write(\"/var/uploads/\" + File.basename(processed.to_s), \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b84c6fe5245291ed3496adc17378d341e3053f1df00ade2b7e940a8f9325f060", "structural_hash": "7abcd7cb8c0f4d56deb619f159081f4a4fdb057424979909cc2bf6fde1e04df0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01710.cpp", "upstream_id": "BenchmarkTest01710", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_HOST\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", data.c_str()); std::fclose(_log); }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "441cdda25abc6438fe769aa2edb7127d982dbec06af9ef6e4793f250e3f091d7", "structural_hash": "0035712210a91196ca3cc1a1596df44228dacc5066bdd243c3a60344f1cc08f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13240.c", "upstream_id": "BenchmarkTest13240", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char _dst[16] = \"abcdefghijklmno\";\n int _off = atoi(data) - 8;\n if (_off >= 0 && _off < (int)sizeof(_dst)) _dst[_off] = 'X';\n printf(\"%s\\n\", _dst);\n}", "label": 0, "cwe": ["CWE-124"], "category": "buffer_underwrite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underwrite", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "daadf32c77b815271e55048b60f49aaeaa388ef0c7fbfc4a02b6451b60f2b498", "structural_hash": "550b68c1054012c0ecb5f7e4baa7de93727984b228da1d92b7d9a70cbeeb43c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22341.sh", "upstream_id": "BenchmarkTest22341", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99327d35ad981a5999ade324bc5517187bf9cb48a5150bb78dc6dcf2653e63ce", "structural_hash": "00af3cc0d13314a803c6c29700f7e200bc5365e1672a7c956e4d6aa2692e0e69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04033.ts", "upstream_id": "BenchmarkTest04033", "language": "typescript", "code": "import { Body, Controller, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"multipart_field\") mf: string, @Req() req: Request): Promise {\n const userInput = mf || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2bd60ca057ccab6ecc98bf7a83a3ae0eacc50c86227c8a81831b9f9bbd19fc2b", "structural_hash": "97b247f22759b54eafdbbaa85f8140ac1b2893f9c03b574127b9d0b4238194f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05164.php", "upstream_id": "BenchmarkTest05164", "language": "php", "code": "raw; } };\n $data = $payload->value();\n $key = getenv('DATA_ENC_KEY');\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', $key, 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c294da14e1cff2803294dbf08d9bc7c7aee014a1959423478b2eb83c19a3c4a", "structural_hash": "96d64ee60c2640bb9a60150f5d6441dcd255e982de3a76ef1441c785c954e02d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03489.py", "upstream_id": "BenchmarkTest03489", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom lxml import etree\nimport re\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = '%s' % (cookie_value,)\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JSONResponse({'error': 'invalid input'}, status_code=400)\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8907d44f4ea38c516fd85b714560928ef685b7daeb04239ae918cd642469985e", "structural_hash": "0d09b4dbe17d383e4f9665f2d2d6e9a29508df226f791645807bf77480313741", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05320.php", "upstream_id": "BenchmarkTest05320", "language": "php", "code": "header('User-Agent', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "982a799799a4eb487589e761d2fc729743161297fd9095996b30b453184433d6", "structural_hash": "4ef8bec7562c47e2da2291fb4f2edad538b554adac9a24c38ec6680394144dd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01993.rb", "upstream_id": "BenchmarkTest01993", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = JSON.parse(user_input)[\"value\"] rescue \"\"\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07c3a1f5c30ffffecaa16f2abca2bb21e3a60b2ecbbfc2e900638f37b684158f", "structural_hash": "9ab273d2b561a0fa5f6c7dbd5e5b9da3ae12e575bf6cf1bc9ad25b8343610635", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02202.py", "upstream_id": "BenchmarkTest02202", "language": "python", "code": "from cryptography.fernet import Fernet\nfrom flask import Flask, jsonify\nimport os\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n parts = str(path_value).split(',')\n data = ','.join(parts)\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "494c0c3033b9475f171c405c002c883c7a57b192ba75aaed1556dfd72b71bed6", "structural_hash": "57cb2b898983211d668272ba3bf699e3f51aa0be0e21aeef5ee06704c24bb3c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04870.java", "upstream_id": "BenchmarkTest04870", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String trimEnds(String v) { return v.trim(); }\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = trimEnds(rawData);\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "872405a7b354b13841bea2516aac2749e70f8c073998d7877d569e9707a0938b", "structural_hash": "e48100a2b73328f875f1b76623c462dce4bd5542b473f608602ac8f33ee1b0bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05675.py", "upstream_id": "BenchmarkTest05675", "language": "python", "code": "from django.http import JsonResponse\nimport re\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n data = f'{host_value!s}'\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JsonResponse({'error': 'invalid input'}, status=400)\n processed = data\n return JsonResponse({'status': 'ok'}, status=200, headers={'Content-Language': str(processed)})", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b378db83cd328d68575ce1bf6fd01ebb3b6ec1975ab3040bd200626768e5697", "structural_hash": "fec5640c88df54189741facd6b3c847a592af005dd450cd9bb0c69ab677c8aa7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04466.php", "upstream_id": "BenchmarkTest04466", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$data . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8774e85492bf07cead3e313b97b6720285d3338a3cbfa239adfaacfccd152223", "structural_hash": "b002aea597af15635c1007afdc09c4110b30dbc38252e40bd6afc202d6fe54f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05725.sh", "upstream_id": "BenchmarkTest05725", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n rm \"/var/app/data/$(basename \"$user_input\")\" || { echo \"delete failed\" >&2; exit 1; }\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8da58ad11f3bf8296357d81da036a97dcc71b1e4352cea2b9d945b1635a6e8b2", "structural_hash": "cc15d9a9ae1b895e6579c1344a983e3c379ac3767fc88f7145431609f76c3d4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02618.java", "upstream_id": "BenchmarkTest02618", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + pathValue;\n String data = valueSupplier.get();\n java.util.Set allowed = java.util.Set.of(\"ls\", \"cat\", \"date\", \"echo\");\n if (!allowed.contains(data)) { response.sendError(403); return; }\n String allowedBin = data;\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + allowedBin}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a039344177d456cd9996d2fb410dd9bca74e65b8a57c903a288c6d409e20eaba", "structural_hash": "dc85c7ee068d12b97f7612280f9c3fa01465cbc1178d09da97226d7281d84b1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01993.cpp", "upstream_id": "BenchmarkTest01993", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Referer\");\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "360551bd73f95cfc6ced3c4a638b0c7d08872b05866f26543cf776f2d0516e92", "structural_hash": "9623adddc528dd46d016fd279672f5e9145ecc1d5b160456776226028a916bae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27143.js", "upstream_id": "BenchmarkTest27143", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n res.redirect(\"/dashboard?hidden_field=\" + encodeURIComponent(data)); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c59b491d02d6b1e684c1804fe6ff4703d2e1d8b7fb5923fc5badaaf2b5a2e32b", "structural_hash": "f3356a6be847768f9ad08862d6de940a219a6109a137fbb7549981eb4e6e1a0a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35691.js", "upstream_id": "BenchmarkTest35691", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst nunjucks = require(\"nunjucks\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(nunjucks.renderString(processed, {}));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a33c0543940656503f9b8130704e37664331370dbe8518a2c4f4c05fa34a3f7", "structural_hash": "ec8a8def08b27a94ac07dc17f258dda73e01c19d8f1e1511fe62031f2bac4e97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03539.rb", "upstream_id": "BenchmarkTest03539", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = [\"s3cr3t_key_test_xyz\"][0]\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ce4194cee621c92363a61034c6d22331274dd116b6f2ae82f212df17aa43802", "structural_hash": "bdb8f2e347acd457741f33eedb261cd7b246600acbd964fe788976479d89c694", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_17597.js", "upstream_id": "BenchmarkTest17597", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n const data = `${userInput}`;\n const _cred = String(data);\n if (authCheck(_cred, req.session.token)) { res.json({ authenticated: true }); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1f195a16096c905577a316ec0d2bd1f8f7ec00b56c6f61e220d5ee2c1cbae79", "structural_hash": "3a719af82f6480d0b14b0b76b3092ada831137a94fb65bf3f31ef908640f5b54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_22304.go", "upstream_id": "BenchmarkTest22304", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuaValue := c.GetHeader(\"User-Agent\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(uaValue) {\n\t\tdata = normalizer(uaValue)\n\t}\n\tidx, _ := strconv.Atoi(data)\n\trows := []string{\"alpha\", \"beta\", \"gamma\"}\n\tc.JSON(http.StatusOK, map[string]string{\"row\": rows[idx]})\n}", "label": 1, "cwe": ["CWE-460"], "category": "improper_cleanup", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_cleanup", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fd3806b2804d1154b86bd274ffe25fa867cef170ca587007537fc679e277040", "structural_hash": "4b9561f0aa01e1a07299855d41d2db5dbb8c5da2b50042f87e8d0a5b1f7b3f03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05610.rs", "upstream_id": "BenchmarkTest05610", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let mut data = String::new();\n data.push_str(&multipart_value);\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return HttpResponse::Ok().finish();\n }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a5b8aa746f1634bd67cc723adbde8411f451f61def5f4f0a46165d850600be2", "structural_hash": "db5937e04f07a6c081610e14bb44fa51de7cecdc3942b206de4c5a9b6e5faa54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18399.js", "upstream_id": "BenchmarkTest18399", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { ctx.status = 400; ctx.body = {error: 'forbidden'}; return; }\n const processed = data;\n ctx.status = 500; ctx.body = { error: processed, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e52adad9a7ef083723807e12bd515fd72146a4cb7cc68028a73d2d7e1dff294", "structural_hash": "431655271f9d8260e59824af69dc737e3a0c78fff809116bfa42178c3c0e56f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02997.java", "upstream_id": "BenchmarkTest02997", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = jsonValue.replace(\"\\u0000\", \"\");\n Object codeResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Code-Result\", String.valueOf(codeResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1986e17ee2a25765bf9bb6d22773b52da4492658c0bcb1534c73e24fe81c3aed", "structural_hash": "4655505e1c892bd02b22f8622734008624090949e0ff3af842dacadc648b7ae3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04276.go", "upstream_id": "BenchmarkTest04276", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(uploadName) {\n\t\tdata = normalizer(uploadName)\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tc.String(500, fmt.Sprint(r))\n\t\t}\n\t}()\n\titems := []string{\"alpha\", \"beta\", \"gamma\"}\n\tidx, _ := strconv.Atoi(data)\n\tc.JSON(http.StatusOK, map[string]string{\"item\": items[idx]})\n}", "label": 0, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f13da38fa865e4a2f5cf36a19b649b9e71bd45a645369f70c7b7a17b1d94f29c", "structural_hash": "418c2935b93da50f5c70f9f8cd8c8a76617ace15aafaa01f580abb33e975e8d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27362.sh", "upstream_id": "BenchmarkTest27362", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=$(echo \"$user_input\" | jq -r '.value // empty' 2>/dev/null || echo \"\")\n echo \"$data\" | xmllint --noent --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "668ca5ab6cbe157e2e3d089cdf8c7780ac282454e88a10caa06708f06781d01c", "structural_hash": "d285bcf85638abc95546adffd8a56b957d38af8e5a160106f63b04c67595e7b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04198.rb", "upstream_id": "BenchmarkTest04198", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n if processed.to_s =~ /[a-zA-Z0-9_-]+/\n content_type :json\n JSON.generate({ validated: processed.to_s })\n end\n end\nend", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8ae01f160ccd02046069594b76015281619468feaf7159c353e44057473b161", "structural_hash": "1c17469ef8ec2d43bfc07258493c1fc3f629fbf4f21cc64cdde509a6cd9cced1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01678.java", "upstream_id": "BenchmarkTest01678", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(rawData.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45e9cc12ab32fd3c1a4309628266926c0c1eaf574e16a8183ede74fc234d6941", "structural_hash": "f640d2446bfbea4d895a336a173314e5e5cc4f230eab9e59854a6ca8d46a6c94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13412.c", "upstream_id": "BenchmarkTest13412", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n unsigned char _digest[16];\n MD5((const unsigned char *)data, strlen(data), _digest);\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1bfa940614fa4ec5c884a5a9ad5e4a5a183d617c987d93489b3d709558f4124", "structural_hash": "c68e2cb365211bae0a1d3d188078b26e352f49417b30f6d05cb24e4ca6a2eb89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00153.rs", "upstream_id": "BenchmarkTest00153", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(field_value.clone());\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return HttpResponse::NotFound().finish() };\n let _ = value;\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d43ef1305d07a7cd301351efa3d8cf95c797d58e2bed550b33e054c162a25145", "structural_hash": "fb12ee49229e7461ba00335e7f6cf428527cd37f47a14520ad8b7b9fe655f78f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05628.php", "upstream_id": "BenchmarkTest05628", "language": "php", "code": "header('Origin', '');\n [$data] = [$userInput, 'http'];\n DB::statement('INSERT INTO logs (data) VALUES (\\'' . $data . '\\')');\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-843"], "category": "typejuggling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "460fcd0557a8b8f5528ca142c5920fd658d516347bc0e89a9e0da0f3dca06cea", "structural_hash": "da66878bb2cfba60d13081eba7634a27c3643374d009733e6fce6e11b4666744", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04423.ts", "upstream_id": "BenchmarkTest04423", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n db.query(\"SELECT * FROM users WHERE id = ?\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8583ecf5f49e311a05b24455f51e6e0ab5cf7b8a03e0d64217f82be8691d6d9", "structural_hash": "d15ae2c3d8e8573d1943000b5c42cde1b39bbc8d0603eae2c07f72b149b6fc05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04211.java", "upstream_id": "BenchmarkTest04211", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.security.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data = originValue.replace(\"\\u0000\", \"\");\n byte[] hashSalt = new byte[16]; new java.security.SecureRandom().nextBytes(hashSalt);\n java.security.MessageDigest hashMd = java.security.MessageDigest.getInstance(\"SHA-256\");\n hashMd.update(hashSalt);\n byte[] digest = hashMd.digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "761fdb4dd21b4f94389d4785197f1dc86a10dbddcd0e992afc223913b777e4ed", "structural_hash": "4a5d9d92d7c1b4bf09fc8589271c11e75c8df67f9599453816ffba8e1300b33f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02018.rs", "upstream_id": "BenchmarkTest02018", "language": "rust", "code": "use ammonia;\nuse axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data = match xml_value.chars().next() { Some(_) => xml_value.clone(), None => \"default\".to_string() };\n let processed = ammonia::clean(&data);\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b1c5674a3fa85bb4fc955d7a47e7e0e01b50a9e6987f4a00206d87c26b2f8785", "structural_hash": "4b964fef821ef7933243bb684a3d1b48f0dc7f25217a0b15af49818373895232", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02727.rb", "upstream_id": "BenchmarkTest02727", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n halt 400, JSON.generate({ error: \"invalid type\" })\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e010201d4c6c3a024d6c6bd35894b4d345d84ee35a9a39e9e9c45b881b1f18ad", "structural_hash": "0589924cd367e618663b50bc796c4cd8f76aaf0e49aa4016a9632f17cc0d2146", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01386.py", "upstream_id": "BenchmarkTest01386", "language": "python", "code": "import logging\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n field_value = request.form.get('field', '')\n data = str(field_value).replace('\\x00', '')\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n logging.info('User action: ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "27006587fe3444944e5c3dcaaec5814cbc40e86383236cd759d6e1ca100d0da9", "structural_hash": "c295ddd2a292126fb2249bab84ff74ceebfa144a211988b8fdc6aa1076499c09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04353.py", "upstream_id": "BenchmarkTest04353", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n pending = list(str(raw_body).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n secret = db.fetch_one('SELECT secret FROM vault WHERE owner = ?', (str(data),))\n return JsonResponse({'secret': str(secret)}, status=200)", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d67417369a69dd17bdd83198853991a311316599feeb4901ed65b7179b367a7", "structural_hash": "27be356253c3a5756623fe66af7360cfc7222634bad891f8e7252b64fdf2dbcb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26649.sh", "upstream_id": "BenchmarkTest26649", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n ls -la -- \"$user_input\" 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6edc50b5afc4ed94fc1c2f0896d83a2330c133783984fe3101495c818387fb2", "structural_hash": "1d4718adea283996b2892348695779033bee1d14031f3c3bd3fa22fded4ff772", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04318.py", "upstream_id": "BenchmarkTest04318", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import db\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n reader = make_reader(db_value)\n data = reader()\n return JsonResponse({'error': str(data), 'stack': repr(locals())}, status=500)", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "242003ac6b754343c9f715ea66122581ab447aae1f350ed0188d608dabb361e0", "structural_hash": "e450fec04a1548fa152c5352ae9f2b85ecb8619677628f1be625f62eb21b4fb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00450.cpp", "upstream_id": "BenchmarkTest00450", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::srand((unsigned)std::time(nullptr));\n int _token = std::rand();\n std::cout << \"token for \" << user_input << \": \" << _token << std::endl;\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e2906748fb74553afe18f6cb43fe5588db7ba14539fc269090485b2e8193511", "structural_hash": "93ff57c87c34b64226697a4f150bdd9bf0e421dea6c8b412c04e5b823e52b520", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00532.rb", "upstream_id": "BenchmarkTest00532", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = \"ghp_EXAMPLEonly0123456789abcdefABCDEF0\"\n data = Thread.new { user_input.to_s.strip }.value\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = data.to_s.ljust(32)[0, 32]\n _cipher.update(\"data\")\n render json: { encrypted: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8109e8d62f63a156afcdae540419e16c0f024cf100dc857edd76924c8ab2c2d4", "structural_hash": "f66722b02c13e96dbc79da55bb08ceafe3492cf07ef7cfef62b84e7051cf0f9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_06034.php", "upstream_id": "BenchmarkTest06034", "language": "php", "code": "input('multipart_field', '');\n $data = call_user_func('strval', $userInput);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($processed); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return response($_elOut)->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e150b84991bf12c466edceffd6fdfcb415dabc633f1772c59945b68d39221b6", "structural_hash": "70d950a8106be4a0e360aef6cc2d235f2a48f61bff502cf91ed92f7549fc02d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02812.ts", "upstream_id": "BenchmarkTest02812", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = host || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n if ([\"https://app.jscdn.io\"].includes(data)) res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6440c3fdcce69c3e9e0666c8dc0e953db53c3a6e3df3cdc332bd120d7ad4366", "structural_hash": "024c922eaa2c6f2b1c2c828f4926df291f93a9f9f74b8159f5db043177a30d95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04152.java", "upstream_id": "BenchmarkTest04152", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = String.format(\"%s\", jsonValue);\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { response.sendError(403); return; }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n response.sendRedirect(targetUrl);\n }\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6898815832efb91e700766898dec7e1f5cedd25e59e04a89a6a5af5b95dbd2a7", "structural_hash": "30b3e3487d0626eeae19c76221500caebea8f563525add5a2b8ad549e3206006", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03637.cpp", "upstream_id": "BenchmarkTest03637", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ed0c590b3e599588061015922382cd8ae4729cdc6975570e515bee0058943f7", "structural_hash": "424fabbbae7c8cc966c8385af8b3dc0caa71b9333509072aa9f45908ab622a6a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_22639.go", "upstream_id": "BenchmarkTest22639", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tvar data string\n\tif userID != \"\" {\n\t\tdata = userID\n\t}\n\tc.Set(\"data\", data)\n}", "label": 1, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fce4e30d2a4a6bd27ce8d18b05ca852dbf55efdf92989136799dea48ba69a2f9", "structural_hash": "3c298d228d5d9564a935fcba191e8d6356919828fdb80668500d87e707d10122", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02710.ts", "upstream_id": "BenchmarkTest02710", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Req() req: Request): Promise {\n const userInput = cookieToken || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const _cred = String(data);\n if (shared.authCheck(_cred, req.session.token)) { return { authenticated: true }; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "890c194c26c0fcce5a1f83d92fdbc7c607031f52f5dc85849901ec822b4eb45c", "structural_hash": "93b57c83747fb2e5d9f5a4c15caef9f64f27df30d4d2a529c3f9b301a6a4fa9e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23695.sh", "upstream_id": "BenchmarkTest23695", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf 'SETTING=%s\\n' \"$processed\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b5ff06185e9e2b4434d185693d6ddbd8d4ae8277c39b5d03ed90329f817d076", "structural_hash": "11c930b20f2bf37bc36af60bac75fa56c4abf91b1688fb905c8d523aeeaebfe3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32949.sh", "upstream_id": "BenchmarkTest32949", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n case $data in\n a) echo alpha;;\n b) echo beta;;\n *) echo unknown;;\n esac\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae15298c28d73d1c1fedbec5aef522dea2bdfd5045eec14844421841522eff75", "structural_hash": "ba24682d96108b9cc67bf8fba95590d5855f11cf36d72b056cb4d338cd2a19ec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_30425.js", "upstream_id": "BenchmarkTest30425", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n const allowedFiles = new Set([\"config.json\", \"index.html\", \"readme.md\"]);\n if (!allowedFiles.has(data)) { res.status(403).json({error:\"forbidden\"}); return; }\n const checkedPath = \"/var/app/data/\" + data;\n fs.writeFileSync(checkedPath, \"data\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2c7dae884fb6dd4328de2b2d5ec06ecc4285f9a8ba47f3e813a99c8e020cd4a", "structural_hash": "a84a8c184a1c9ce2b45185e886575807d0c7422fb81a1833d89f7b97f541fe22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00781.php", "upstream_id": "BenchmarkTest00781", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae74a95f8c9a82ebb2b076d3b9c1f221886729c06e1cf5a192f9f1b7b2672e7e", "structural_hash": "ce1f0138a5e77f20a83eb635dd2e0f120d132d30b6a7bff725f6f1839c1cc971", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03885.rb", "upstream_id": "BenchmarkTest03885", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n Net::HTTP.get(URI(data))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0499bac263b6444a5be2b10b37551b2bccba8aa6c38444c36859c55cc95895d1", "structural_hash": "2c3eab172d61e8c1fd60a298afb9c206135227ecc3c9b9bced34124ac1ad459b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01857.rb", "upstream_id": "BenchmarkTest01857", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = JSON.parse(user_input)[\"value\"] rescue \"\"\n processed = data.to_s.delete(\"\\r\\n\").gsub(/[A-Za-z0-9]{4,}/, \"****\")\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2766dd88abc23342c80b674a1845bfd89ddbab9f734a1631b68e923805175719", "structural_hash": "ae75371742e4723d451ca6a7b4a1eedc3b25e77b5b6f015de4555c0424229d03", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02540.ts", "upstream_id": "BenchmarkTest02540", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as childProcess from \"child_process\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n childProcess.execSync(\"echo \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1197fa10877c8fb1d6db911b7072be55f90da3fc4af2ed591458cc42b921c1f2", "structural_hash": "632b48bc59db401681ba099141a70ee4e3264efdd52ae5c44c1dba5f21c0eafb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00665.ts", "upstream_id": "BenchmarkTest00665", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as https from \"https\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45bbe31d4449eec5be267b0cc1dc427bcba988d50f9b811e4a19adea46b58a24", "structural_hash": "506671052c8bfa72aee19c992a63fa5dfc704664a79f06bc0b5a90b55481490b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04313.rb", "upstream_id": "BenchmarkTest04313", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n tokens = user_input.split(',')\n data = tokens.join(',')\n redirect_to data\n end\nend", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1aa11b8f7195d9ffd43fc2aeb94e4ac3e7f5ae4e7f3546a7a0de6dfa0a67a33", "structural_hash": "096431e7bdaeb8a8b71deb4ce037128518a8ded568ef095021d1da202938e177", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28333.sh", "upstream_id": "BenchmarkTest28333", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n printf \"%s\" \"$data\" | sha256sum | cut -d\" \" -f1 > /var/data/secrets.enc\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "746df8074ba7a6aa9ba1619ffa83b7dec9d498001842382a5d2ffae632411507", "structural_hash": "fd301020138706c9a764f1514d938fedda722498a949bf81c75725b861ef6372", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10960.js", "upstream_id": "BenchmarkTest10960", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const data = `${userInput}`;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(\"
    \" + processed + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e941e28cf77135d73a1ccecf3d3d7bb15f9ee4353e3362dc9f544ebf8ad4c3fd", "structural_hash": "0469e5d8695aa6bec1ba94fe069125c4cbc2d6d07de91b3f1ec4198485503fc6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31263.sh", "upstream_id": "BenchmarkTest31263", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "635696be8e4a5c623fc84756769017126dcdf7a35788654c37f880071010c61c", "structural_hash": "855057ae8ea56b5a58211c7c4ad11c3bafef9e7d87f893881bc9d6e87f1c29e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_22874.js", "upstream_id": "BenchmarkTest22874", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n ctx.body = { validated: String(data) }; return;\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ea30ecb27ee2b264e5e4eb3984e231935d347c6eb049013620b2db1db4eb5e8", "structural_hash": "be5e1097077791f9cc6ece5b6330f9285987429bb5ea3e75c295948250ffc944", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00738.rb", "upstream_id": "BenchmarkTest00738", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = String(user_input).strip\n unless data.to_s =~ /\\.(jpg|png|gif|pdf)\\z/i\n halt 400, JSON.generate({ error: \"invalid type\" })\n return\n end\n entry_file = data\n File.write(\"/var/uploads/\" + File.basename(entry_file.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d933a07d597d067940cbdb58dd84208b92db0efc2f643a9cfa208c43ca87e1c", "structural_hash": "c2a3834b8a09752229fc658c33c13faa76242769301787c3faf5c17a645fcc7a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06219.go", "upstream_id": "BenchmarkTest06219", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(dbValue) {\n\t\tdata = normalizer(dbValue)\n\t}\n\tf, _ := os.CreateTemp(\"\", \"app-\")\n\tif f != nil {\n\t\tdefer os.Remove(f.Name())\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d21b0eee7f680bdf1ea9acd138478c4c7983cf2ba977385ef248b5c63af0d7ab", "structural_hash": "a7081ade51c3534087eae180a99b6ca92c9cfa74193e3bbf373f214d404fc788", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02236.rs", "upstream_id": "BenchmarkTest02236", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let data = if cookie_value.len() <= 4096 { cookie_value.clone() } else { cookie_value.chars().take(4096).collect() };\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n static _RE_INPUTVAL: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(\"[a-zA-Z0-9_-]+\").unwrap());\n if !_RE_INPUTVAL.is_match(&processed) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO logs (data) VALUES ($1)\", &processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2f7a8b7f959367b89194e0a4d1fd574e0f0b1d0b6b78458bd191aece76f6364", "structural_hash": "67a72f2e8918ab3389f521476bdb23fa7d607d5141389ca4dbdd4961e016cc95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00184.cpp", "upstream_id": "BenchmarkTest00184", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = std::string(\"prefix-\") + user_input;\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8ed43800c43ecedc5279b4e627fb161bb4f9c63aec4baa6378e3677f39404ad", "structural_hash": "423be1dc5ecec81349e918db4367de4303464a4b9ab8d855c40d1358e91d8f19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02886.rs", "upstream_id": "BenchmarkTest02886", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let _prefix: String = db_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => db_value.to_lowercase(),\n \"f\" => db_value.to_uppercase(),\n _ => db_value.trim().to_string(),\n };\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa1ae7bf83cec9a68050887ca8814c2dbd47d3066ece8c091c8b614422fa12a0", "structural_hash": "f47f81f83812d0a50d9a6db0a04a29d8c528cb9e6f8995f10737ab7536ec0441", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22333.c", "upstream_id": "BenchmarkTest22333", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_passthrough(user_input);\n long _n = strtol(data, NULL, 10);\n if (_n <= 0 || _n > 65536) return;\n char *_p = malloc((size_t)_n);\n if (_p) free(_p);\n}", "label": 0, "cwe": ["CWE-789"], "category": "uncontrolled_alloc_size", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4856e5c55b35b4d10449c19663911a001c7076dc2c9cf1cd0aeee4e79ff295c", "structural_hash": "798924a2d27ec90fb6d709fd90a94f3bcee86ee23da80e03f6cc4e2e48a9186f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00512.c", "upstream_id": "BenchmarkTest00512", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n unsigned char _digest[16];\n MD5((const unsigned char *)data, strlen(data), _digest);\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f7145089eeb8fea6a6de638e6921c9d581d8e1dac79794095186503723b89ef", "structural_hash": "9100ff48fd2484175a63fc1130f11009991a86c6596f4e01a60d8bb82bf368f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05032.rb", "upstream_id": "BenchmarkTest05032", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = !user_input.empty? ? user_input : ''\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e9c54b497c0b1d1fae1e8109a35adb23348c729d9b2c349d0891173db6f1e91", "structural_hash": "d38efed2b316138ed59d1d2ab6544d303035dde0790975847fb863ec1d590eb2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02061.py", "upstream_id": "BenchmarkTest02061", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom dataclasses import dataclass\nfrom starlette.responses import JSONResponse\nimport os\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n xml_value = (await request.body()).decode('utf-8')\n form = FormData(payload=xml_value)\n data = form.payload\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c55d20d2de5a333b2b47bdb7c9f1bded00e7def75e191ea4e6d547ca14a5811a", "structural_hash": "4346c4da99e1d1506142fcb41730a573499bc9d11bad561b39416b634f3f5c19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03853.py", "upstream_id": "BenchmarkTest03853", "language": "python", "code": "from django.http import JsonResponse\nfrom lxml import etree\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n data = (lambda v: v.strip())(origin_value)\n if data not in ('asc', 'desc', 'name', 'created'):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d5c0ca8ec3dd226011b37254bbb8c1dfb3276060e42eac1106973ef374f2229", "structural_hash": "3a265a387ffcb9da28f5ed8f10e0b295327df33ac593377b4cc5cd8e2d4921b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05499.rs", "upstream_id": "BenchmarkTest05499", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = \"default_config_label\".to_string();\n let store_cred = crate::shared::vault_get(\"app_secret\");\n crate::shared::db_connect(&format!(\"postgres://app:{}@localhost/{}\", store_cred, secret_value));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "365acd7e6ffcc4e421de629d745b8bb96f8e80391e517ed1656baa0fb08e44ba", "structural_hash": "4824609a7aaee8877fe2bfc0f8badb2a365e4e956fd9975848fda871c9f909ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05072.php", "upstream_id": "BenchmarkTest05072", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4a437413e186161421ab2035b57b846444c28abd2821c373d4ee87918a403bd", "structural_hash": "751bab5e8cc063bd4ab06837b262e39729a2c3a4ac0da40a6ff110535200ecdd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17583.js", "upstream_id": "BenchmarkTest17583", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const data = String(userInput).slice(0, 200);\n ctx.status = 500; ctx.body = { error: \"Internal error\" }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-756"], "category": "missing_error_page", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37c26d79fb4bdb531f6e5426e8e7bd414051c16e9fc8abd9e8b2e6d810edf86e", "structural_hash": "0ab30022959fe15f5ecf76a52c054f547c4d0720aebfa9a86d2516da5aa0c07e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02569.py", "upstream_id": "BenchmarkTest02569", "language": "python", "code": "from django.http import JsonResponse\nfrom types import SimpleNamespace\nfrom app_runtime import auth_check\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n ns = SimpleNamespace(payload=raw_body)\n data = getattr(ns, 'payload')\n if not auth_check(str(data), request.session.get('token')):\n return JsonResponse({'error': 'unauthorized'}, status=401)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2212af39dbce902893bdc73e6eb3e35edd1923188b320814c2e9e75f43e92e1c", "structural_hash": "39a18c3a9bf2db3f69557280c9e99b8c28e153c4119bcbf5c3b227b14682b7a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02794.cpp", "upstream_id": "BenchmarkTest02794", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n char *_p = new char[data.size() + 1];\n std::strcpy(_p, data.c_str());\n delete[] _p;\n std::cout << _p << std::endl;\n}", "label": 1, "cwe": ["CWE-416"], "category": "use_after_free", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:use_after_free", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2df8fee8270428ec103e756a4f6c592088937a297b8f31aa704461f125923710", "structural_hash": "ea269ee2ff0a358f259352530b61c4cb4dd0687063076f4397f5cd41f5af2ed3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_00448.cpp", "upstream_id": "BenchmarkTest00448", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Host\");\n std::string data = !user_input.empty() ? user_input : std::string();\n if (data == \"admin123\") std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19d5bb13d24b2b2f1df0a5686264327b7b076601a1670988dd76f4fca4c99d04", "structural_hash": "1ee29387fc10272d86fbce4e4752c824f8c43737215ac1bbc941bd18d87eda77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36233.go", "upstream_id": "BenchmarkTest36233", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tdata := func(v string) string { return strings.TrimSpace(v) }(jsonValue)\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"audit actor=%s action=revoke_sessions\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3558a0972329acf4bc9e63cb14a81cfd8aa5f49b0a61ddf2ad2b33f9ffd2826", "structural_hash": "d36ae6f35f68f02ceeb07c237d56efdbdb517119e9903577c124457a88a86af3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23015.sh", "upstream_id": "BenchmarkTest23015", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n chown -- \"$data\" /var/app/run/worker.pid 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:insuff_privilege", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97ac1fd8ab79a1c4aeb1cbfdd0967e0ea3169166c79eb5f957876a5d4f00517b", "structural_hash": "b606e6808bb9cb76453be308f2a628acc38c8540e5d6621d6fe70a781ffe7a95", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04810.sh", "upstream_id": "BenchmarkTest04810", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e01b122f4675e36436b98df015fe6de0c3c7231f42eeaf76983c69cc2834270c", "structural_hash": "38a90b51d92f8ac1b63729beaf02a33303d604d27bff21162a8a57ab31d7c189", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05443.py", "upstream_id": "BenchmarkTest05443", "language": "python", "code": "from flask import Flask, jsonify\nfrom flask import session\nfrom app_runtime import auth_check\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n data = f'{path_value!s}'\n if not auth_check(session.get('user', ''), str(data)):\n return jsonify({'error': 'forbidden'}), 403\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f055963811db756f81f8a232c7a59337ea1dd9f40857aa1b153a7dd47e35c418", "structural_hash": "5680e401f0ccd162833e864c5e43bfa8effe458807f5da662ab7643dfb3922e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03883.rb", "upstream_id": "BenchmarkTest03883", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"base64\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n _cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"DATA_ENC_KEY\", \"\").ljust(32)[0, 32]\n _cipher.random_iv\n _enc = Base64.strict_encode64(_cipher.update(data.to_s) + _cipher.final)\n File.write(\"/var/data/output\", _enc)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ca66f20e697f09c6e43af6e54c6b5aa5465f57351177759aa00c684ef1e9ce1", "structural_hash": "9016778dd5646bb2efd8f8688087f201b38ea1468b350e4712a3970c1885d2dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_38119.go", "upstream_id": "BenchmarkTest38119", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(jsonValue) {\n\t\tdata = normalizer(jsonValue)\n\t}\n\tvar label string\n\tswitch data {\n\tcase \"a\":\n\t\tlabel = \"alpha\"\n\tcase \"b\":\n\t\tlabel = \"beta\"\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"label\": label})\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f06fb7ebb67328841e6609e5ceb3ff73330d47193912b5eb8890b52a8c034928", "structural_hash": "f4f772347ad3975488f56549c295494772426130b4110b6af9801ac3a9465a05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06057.ts", "upstream_id": "BenchmarkTest06057", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as crypto from \"crypto\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const token = crypto.randomBytes(16).toString(\"hex\");\n res.json({ token });\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3a70b103beacecff75eb8bb12a98389df43d00a3d39f86bdee111bfe1e55d6e", "structural_hash": "475ce5445d4aaaf5ab2dda999265947b16b6662ec112260beb7d8b32fc08481f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05545.rb", "upstream_id": "BenchmarkTest05545", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless %w[config.json index.html readme.md].include?(data.to_s)\n halt 403, JSON.generate({ error: \"forbidden\" })\n return\n end\n checked_path = data\n content = File.read(checked_path)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "895a1e33dcd88ae81f9e9413e0417031348d5adebc1517816057685666d39a73", "structural_hash": "9104922b38442adfc50dbcfde5dc6a0a3e13971de2bb2ecaa43f10fcee1df2f2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04861.py", "upstream_id": "BenchmarkTest04861", "language": "python", "code": "from flask import Flask, render_template_string\nfrom flask import request\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n reader = make_reader(referer_value)\n data = reader()\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n return render_template_string(processed)", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84585d943cf9256eed846955a5bb8e808de1359e5d8106c64552a5c2c2ce76bd", "structural_hash": "054ef136e3b8a12dbf07f027981a95dda6213a0674284888d6dc409231875aef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06437.go", "upstream_id": "BenchmarkTest06437", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tdata := func(v string) string { return strings.TrimSpace(v) }(dbValue)\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tactualHash := fmt.Sprintf(\"%x\", sha256.Sum256(body))\n\texpectedHash := os.Getenv(\"TRUSTED_ARTIFACT_SHA256\")\n\tif actualHash != expectedHash {\n\t\thttp.Error(w, \"integrity check failed\", http.StatusBadGateway)\n\t\treturn\n\t}\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 0, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76fb5b8cbf73e571a32c0fd8f4f7c9a0a48edee3af1547187d674a7bbaba1543", "structural_hash": "3ae5e2541870d59544997795627afd34ef20c3ac60cc06b7b5619342e74a3cd4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27253.sh", "upstream_id": "BenchmarkTest27253", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n cat \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc77d6cbe5a5efc052bb4bd220652715b3483f7dec2bb5e75f2b503914b06c2d", "structural_hash": "2cc4eeeecf556912ad1a2d6a6784f26f4f8958bf587a4666410d695b8a3fae9b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01159.java", "upstream_id": "BenchmarkTest01159", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data;\n if (authHeader.length() > 256) { data = authHeader.substring(0, 256); }\n else { data = authHeader; }\n response.setHeader(\"X-Frame-Options\", \"DENY\");\n response.setHeader(\"Content-Security-Policy\", \"frame-ancestors 'none'\");\n return Response.ok(String.valueOf(data), MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4fd8fd61efea23134e2bb780f3a96b1123894036cec4a6c153d9d83fc263595", "structural_hash": "d5877086d6daffcc780371262434e66bd9bf0cb25e1213fdf23031fc14931e79", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_30536.js", "upstream_id": "BenchmarkTest30536", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const targetUrl = String(data);\n if (targetUrl.startsWith(\"https://\")) {\n https.get(targetUrl + \"/lookup\", () => {});\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91ab0aa04873f9017b7733f46a4796b3362a546933a8ae9f72cfb19782cd8297", "structural_hash": "3590259bcc827c6c27e3a9407416d9f6291ffa9e4737277d072f7e304633edb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01322.c", "upstream_id": "BenchmarkTest01322", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n if (_i >= 0 && _i < (int)sizeof(_buf)) printf(\"%c\\n\", _buf[_i]);\n}", "label": 0, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d222e121ceafdab39387a0043f3a7a52553307d80e1c2c6d30e3c99ca2d1cf84", "structural_hash": "510af7466562f1cceee4b6f8bd5ee3f35ec6525e747a0e0cf447295d3951e2b5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03988.java", "upstream_id": "BenchmarkTest03988", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data;\n try { data = String.valueOf(Integer.parseInt(multipartValue)); }\n catch (NumberFormatException e) { data = multipartValue; }\n int requested = Integer.parseInt(data);\n int allocSize = requested + 1;\n response.setHeader(\"X-Alloc-Size\", String.valueOf(allocSize));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "481a60f8a4bc6765c773ebc6741f7f2d1fe3cc3e4a357518a9fb534c2d5b55a1", "structural_hash": "d473ae350bf395a481dca60f6841ecebc18e47b6e9c7d5bcebd0dfafe481dce0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04626.rs", "upstream_id": "BenchmarkTest04626", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let data: String = xml_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| xml_value.clone());\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cec52c99ef1272ba683f44dd7b9c103fe59a7807983965d38dd9f532b267b2ee", "structural_hash": "cb027226f0b4b4ebc1da807bf7daf8333706d992a2734d4f38ba47ca306adcbd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13227.sh", "upstream_id": "BenchmarkTest13227", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-322"], "category": "key_exchange_no_entity_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d06e4942fdf1700883f4e1f3819e5f6d4d67bcd5638c8cd2c0152903c25dab3", "structural_hash": "d3b9f4c981b4c0cd9655a4a1621764f64b9a24ddce7f8e71d5955216b928e904", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00817.rb", "upstream_id": "BenchmarkTest00817", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n payload, _origin = user_input, 'http'\n data = payload\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1acb290897376a8be19abe1102d9274c5503ab725966833d8da257b7dd059b93", "structural_hash": "4210aa0980e997da633a459feb7fda8434333aa0cafe4a52f8234252ba4165ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01419.php", "upstream_id": "BenchmarkTest01419", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $entries = scandir((string)$data);\n return new JsonResponse(['listing' => $entries], 200);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1889d622f581ac45ab6b3e95956031ae7da23cd9e3c6ffa6f20e762a51f984f", "structural_hash": "6281c59236d9a9973eb077ee90a1b59f0c46a5f11551e490172dbe1a6ec85af3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02226.java", "upstream_id": "BenchmarkTest02226", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n String data = \"item_%s\".formatted(commentValue);\n jakarta.servlet.http.HttpSession fixedSession = request.getSession();\n fixedSession.setAttribute(\"authenticatedUser\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d1808a1088e17e98dabf3a5d1f57fc29cf39e7e1fab7f48ffd3b3590cf58676", "structural_hash": "a2e3942322f426f1567c4cb794f0917eaa68cd2675fffc5ca2f384559a48d423", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03548.go", "upstream_id": "BenchmarkTest03548", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/rand\"\n\t\"encoding/hex\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", jsonValue)\n\tdata := _sb.String()\n\ttokenLen, _ := strconv.Atoi(data)\n\tif tokenLen < 16 || tokenLen > 64 {\n\t\ttokenLen = 32\n\t}\n\tbuf := make([]byte, tokenLen)\n\trand.Read(buf)\n\tc.JSON(http.StatusOK, map[string]string{\"token\": hex.EncodeToString(buf)})\n}", "label": 0, "cwe": ["CWE-342"], "category": "predictable_from_prev", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8d0f11d10b0ff0a682e97b9bc0aa83fa86c140fa5ba4032defab319813f2626", "structural_hash": "8637ee0977df87e0eb1b236d51848433784d737d8628ef0ddca510671d19cf4b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05393.rs", "upstream_id": "BenchmarkTest05393", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let _prefix: String = comment_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => comment_value.to_lowercase(),\n \"f\" => comment_value.to_uppercase(),\n _ => comment_value.trim().to_string(),\n };\n Command::new(&data).arg(\"--run\").output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "942a51a8b8cc4f3276e605aee6c28448bc9b67947e06337c9759322a6e4ac5b9", "structural_hash": "7061f4397da35acb7a28d346cbe9327c2faa85fc3b105b5c4976cb2f7c070465", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05068.java", "upstream_id": "BenchmarkTest05068", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String apiBody = java.util.Optional.ofNullable(new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL(\"https://api.svc.local/data\").openStream())).readLine()).orElse(\"\");\n String data = \"item_%s\".formatted(apiBody);\n try {\n java.net.http.HttpRequest httpReq = java.net.http.HttpRequest.newBuilder(java.net.URI.create(data)).GET().build();\n java.net.http.HttpResponse httpResp = java.net.http.HttpClient.newHttpClient().send(httpReq, java.net.http.HttpResponse.BodyHandlers.ofString());\n response.setHeader(\"X-Fetch-Status\", String.valueOf(httpResp.statusCode()));\n } catch (Exception e) { response.sendError(502); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe6cb774a95f03f46a32e740b5f448c8c2834090636f84bcc4f350e396945e38", "structural_hash": "cfbe8cea15a7ba3cde8c13b0b3e95d10050a93e67e955577e04641f4ea22d5f9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01773.py", "upstream_id": "BenchmarkTest01773", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n data = bytes.fromhex(header_value).decode('utf-8', 'ignore')\n db.execute('UPDATE users SET email = ? WHERE id = 1', (str(data),))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ad4d7d2f64b55398524d9a7485d033a59b133d75451846a02d854295ef52cd0", "structural_hash": "d207566a1cbd7ba3130094b6cfd6d9042a18e4d7728061cb528264c1aaf01f33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04139.go", "upstream_id": "BenchmarkTest04139", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", jsonValue)\n\tdata := _sb.String()\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tDB.Exec(\"INSERT INTO feed (data) VALUES (?)\", string(body))\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c44621029fbaa4b96cd045fdac288ec96477923ac883a63f4160b7739b3ace2", "structural_hash": "71daa41431854e6a84e704406430d0fce03a94232c44fce3c865a7f667ce8270", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02712.ts", "upstream_id": "BenchmarkTest02712", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const data = await Promise.resolve(userInput);\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n fs.unlinkSync(checkedPath);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8dffbb3a2be702973d188f5231aeca2fb02b47e8c41b7f4a5d4f9f6930cde79", "structural_hash": "840614d0413978decb49261e4b1ca6b4d8b0b6c19b9dad2f3101870b9e9a1f08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06118.ts", "upstream_id": "BenchmarkTest06118", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n const storeCred = process.env.APP_SECRET || \"\";\n shared.authCheck(String(data), storeCred);\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c09da7a637df73fd3a4f80de0fe0c5f466bd57e20fbfc7628d8c06d09f97bf4", "structural_hash": "50a8f3e18960a4aa8a030c4d8c56d10c5b141a08df163868b26b88f16c4108ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20154.js", "upstream_id": "BenchmarkTest20154", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35ead46923cd0d1e0d13e4e0756de6f2229b843256577a8eb710334ef7baae9d", "structural_hash": "f6a60d69263b14b3dbdce077d40d9a5eaeb30f3d2391db70d5d3c1978d770600", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36897.go", "upstream_id": "BenchmarkTest36897", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := func(v string) string { return strings.TrimSpace(v) }(graphqlVar)\n\tw.Header().Set(\"Content-Type\", data)\n\tw.Write([]byte(\"{\\\"status\\\":\\\"ok\\\"}\"))\n}", "label": 1, "cwe": ["CWE-115"], "category": "misinterpretation_output", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:misinterpretation_output", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a36788cbc617d4ccbdd9cd0f0bbd2cbd9b073ad7db0de936d7d9371327ce0e0", "structural_hash": "0a46c7a9a993316e6b442cf980098af0e522a9a49f1b1d71d6fed2cf435c06cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02449.ts", "upstream_id": "BenchmarkTest02449", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n childProcess.execSync(\"echo \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa4eca7e36de1225ac55cf173b6fe27498cf3c24d7aae0826f60db38fce3605b", "structural_hash": "7d302e65c8db388ba592fe231e2c7d80066a5adb150f6694f1560914dcd6a569", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11923.sh", "upstream_id": "BenchmarkTest11923", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n curl -s http://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7d43ff047101ab5a730930d0222fc7dabca9e3f2584f24e0f0ab490b926f577", "structural_hash": "5934edc0f09789927a61cfeb78b3ac99a997d959bb629d09d242dd382613cd98", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01271.js", "upstream_id": "BenchmarkTest01271", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(data, 10);\n if (!Number.isInteger(idx) || idx < 0 || idx >= buf.length) { ctx.status = 400; ctx.body = { error: \"index out of range\" }; return; }\n const value = buf.readUInt8(idx);\n ctx.body = { lookup: value }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dea4c6385e820d14da5b166218c10d285155356d2e8cf3e418b66bac970639e3", "structural_hash": "0f27c2583d39969a132e577b17048cc53c6b42a9545748897e84bd71f39c346b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00091.cpp", "upstream_id": "BenchmarkTest00091", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n std::cout << data << std::endl;\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd629ebb2fa68a982638fc493d94c8dc2cdfcc130c49f1c997d171f004f006cf", "structural_hash": "ccdd28cad887f21223d3d6f133e005b34fc10961bdfefb8b9ffb4080d03283f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07047.c", "upstream_id": "BenchmarkTest07047", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_passthrough(user_input);\n char *const _argv[] = { \"/usr/bin/grep\", (char *)data, NULL };\n execv(\"/usr/bin/grep\", _argv);\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9cd32e92828e6f9b9eff5afe08470569ae0751b5a7532185379faf6702f26663", "structural_hash": "04fa83a1b72bc438eaa91bc44a760548395f78ae18e08fca50f368b9a64bcee4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03108.py", "upstream_id": "BenchmarkTest03108", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nrequest_state: dict[str, str] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n forwarded_ip = request.headers.get('x-forwarded-for', '')\n request_state['last_input'] = forwarded_ip\n data = request_state['last_input']\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb8e0dbd24d9a0cbcd641959acbda9547a11bc2b27cd5167ce51e3a6cf8743c1", "structural_hash": "9510c533ccb89aa8f5d2cf1c12f943079696986d93a2ec97108e4df6434548c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06116.ts", "upstream_id": "BenchmarkTest06116", "language": "typescript", "code": "import { Controller, Post, Query, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string, @Req() req: Request): Promise {\n const userInput = id || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n if (!shared.authCheck(data, req.session.token)) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4869c29debe33ddea22bd9a0a1b8b748cba805ad0be51ecd89b23e3028a3b412", "structural_hash": "7672ebd636cc93c8e1d3537b6c3379a6d7c0b038a1a3405274c448bcb7b401c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04220.ts", "upstream_id": "BenchmarkTest04220", "language": "typescript", "code": "import { Controller, Headers, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string, @Req() req: Request): Promise {\n const userInput = origin || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const role = String(data);\n if (role === 'admin') { return {role: \"admin\"}; }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf756b8db43dec8dee258628da2771ad0ad0a2917c08ad708068d4479cea41e9", "structural_hash": "772248f3755eff06b029717b0c5572c3f661dde9d61eafe0c32e979f60d359b0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_24907.js", "upstream_id": "BenchmarkTest24907", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n eval(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56b40fe51795db7841d79fd1b3afedd8789c556ac6470165304c1b4247773c7d", "structural_hash": "8b2b3869817955d760301ee8fd814ad36ebc3830c41ba6345b6bbd05ffb6a0bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01575.cpp", "upstream_id": "BenchmarkTest01575", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"multipart_field\");\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n const char *_found = std::strchr(data.c_str(), '=');\n if (_found) std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4684a0b906d076ab784a4acbb31f61cc6cbb08587f0f21b692e9e39e2c967e2f", "structural_hash": "4c02127a90959b19b60113e381289f299ba9b74853297ef38659441b24e1b68c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05126.php", "upstream_id": "BenchmarkTest05126", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $data = str_replace(\"\\0\", '', $userInput);\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dd49b7ec1b1faebbf005a53056d9d5e3a9eecd04eff805a5cbda1d6d1322673", "structural_hash": "d36b1d9564919e8923cf2b2e8fab4b90fe205549ed3e82d02a8599d8c843532e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08064.sh", "upstream_id": "BenchmarkTest08064", "language": "bash", "code": "benchmark_case() {\n user_input=\"k7Qm2Rv9Lp4Tw8Nj3Zc\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n if grep -qF -- \"$data\" /etc/app/passwd.db 2>/dev/null; then\n echo \"auth ok\"\n else\n echo \"auth failed\" >&2; exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-540"], "category": "sensitive_in_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73cf0f4c7bd522b5ae11b0e2543e0bce86bf9c8bfbd54fc1c50e73ccdd5274bd", "structural_hash": "481dd3eecb4ddf859fdeb10d71240d289a25d25a5aacc6906e9692eed2d61028", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12076.js", "upstream_id": "BenchmarkTest12076", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const data = await Promise.resolve(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n eval(processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-749"], "category": "exposed_dangerous_fn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e566288599aa7166db0e25eaa9b00063a670a37489eddb6c1a17fa9949d1b374", "structural_hash": "96cc1f6ff8e9668a9e8d3d3bc154063f21579a948975bb1f8de2364f8a482c36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05334.rb", "upstream_id": "BenchmarkTest05334", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n data = \"\" + user_input\n system(\"echo \" + data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70b039886e534b527bc779bb0a221e6bd00e85d49ba6fe84738bc8feea91efdf", "structural_hash": "680e4ebebf93af4b8696daf5761331d1b7723f7b95602b60a434ce6c02767aa3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04598.rb", "upstream_id": "BenchmarkTest04598", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = \"feature_flag_value\"\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n _secret = ENV.fetch(\"JWT_SECRET\", \"\")\n _token = OpenSSL::HMAC.hexdigest(\"SHA256\", _secret, \"header.payload\")\n _ = _token\n content_type :json\n JSON.generate({ jwt: \"signed\" })\n end\nend", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "817351b51967607a80a1deb581781493a55d59ea9beb88b05b642e92497dcd27", "structural_hash": "f7d3985126359640aa51fe946c8e2e8e964f264fe4106e06b3af41b9b3bb59bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19608.js", "upstream_id": "BenchmarkTest19608", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const _ek = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _eiv = crypto.randomBytes(12);\n const _cipher = crypto.createCipheriv(\"aes-256-gcm\", _ek, _eiv);\n const _enc = Buffer.concat([_cipher.update(String(data), \"utf8\"), _cipher.final()]).toString(\"base64\");\n const _ct = _enc + \".\" + _cipher.getAuthTag().toString(\"base64\");\n fs.writeFileSync(\"/var/uploads/data.enc\", _ct);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c676fb2311f7b01a3aa8ba461cbcf6fbfadff5709925e14732fd5a45d4e978b8", "structural_hash": "a4f7e44ef8e60a475c2061dec7d6a2c268c41e0c21ea788ca9a47ed220118a31", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02165.ts", "upstream_id": "BenchmarkTest02165", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(data)));\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3131413f04e6495ca1e9f724f19adc93abae273088b38a72be5ac7e643e1fa0", "structural_hash": "3a8e80fe497def584593248d445e93d730404bc127cc961facbaa41900444776", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04141.rb", "upstream_id": "BenchmarkTest04141", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).fetch(\"payload\", \"\")\n data = format('%s', user_input)\n result = DB[:users].where(name: data).first\n value = result[:name]\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4bca32a71e315a45f67976d5e9dabf65ba902c7929b78576e41f14b76256f48", "structural_hash": "53b69e1a8970ea88d28c02667c1ba016cfc9d2d111484c0b37c46a9fd6712157", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01158.php", "upstream_id": "BenchmarkTest01158", "language": "php", "code": "query->get('id', '');\n $data = sprintf('%s', $userInput);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff10d11594d62d5b5dfe22eaac728019373408fc5df2cba363c58e5e51d7b27c", "structural_hash": "89407966ca05d3e061ba359be61bab6b7adc8e28b6fe5e8a1f25207452e24f09", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21041.c", "upstream_id": "BenchmarkTest21041", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "373bb17aeb441474cc08d0a92315d377beb9d34e69cdc49ccb09e71acd717d04", "structural_hash": "67f458b888d702448f97a854a44fa5e0c34f4d27dfb510d82099d49e7f2e1c11", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09149.c", "upstream_id": "BenchmarkTest09149", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NOENT);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22cd50e666f665f9c0df9c0ff9da7175d13173077ff533904ce6895b29163358", "structural_hash": "a29e954b92846029c7d1e89ddc33dc734a830aead9a5b89c26c4a88cc9717bb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_39414.js", "upstream_id": "BenchmarkTest39414", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.set(\"X-Custom\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7b1e5d8cbcf6b89885654af68c44d542577d543a2f9a86f2aa6afbac9fa297d", "structural_hash": "4bc3aebc08a14d492de0027aa6c4f2d3ad5c4c003dc4c27881e68f2359f3449d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest06005.java", "upstream_id": "BenchmarkTest06005", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Valid UserInput req, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.List tokens = java.util.Arrays.asList(jsonValue.split(\",\"));\n String data = String.join(\",\", tokens);\n jakarta.servlet.http.HttpSession fixedSession = request.getSession();\n fixedSession.setAttribute(\"authenticatedUser\", String.valueOf(data));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8994b6432955ff6e5eaf5906026f9e1a9a6c83a4d81642048014ebf2e7e132a", "structural_hash": "62950bf41fab8d4064d0494c661d1b992dabb445a2fb63a94d42a296480eb8ab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00904.java", "upstream_id": "BenchmarkTest00904", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(rawData);\n String data = normalizer.apply(rawData);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a092cfb86d5418a4def6bacf3278b060433a1652a055e446e1a6540ae8ed5001", "structural_hash": "96e00e1d0d663844088201d130fad640f723e5a1ca2ae9b5df5e55ee1e6d2870", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00887.java", "upstream_id": "BenchmarkTest00887", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{userId});\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97924fffbc9bdee98fc10f779c0c37d468f766f6a3ba09dafd0a0878fc85c086", "structural_hash": "08dd09f3559ec4ecbe19713b1e1e9609b4805ef8ae5799e68a4b7204d178411f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16899.js", "upstream_id": "BenchmarkTest16899", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (!authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-441"], "category": "confused_deputy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "102317cecc06d05366fdfa5a0fa1a173603055c0676cd818dec3aad5a740d117", "structural_hash": "c7216e2ff3e014ed093f992db962aff837898d13114f6f8a547822e665701b15", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03043.py", "upstream_id": "BenchmarkTest03043", "language": "python", "code": "from dataclasses import dataclass\nfrom flask import Flask, request, jsonify\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n form = FormData(payload=origin_value)\n data = form.payload\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1952b4fed34288a88380cb0427c10330084b0330a363debfc74c5d65f3e177dc", "structural_hash": "77de9b777749e2f937e5eb64371c0e2faa0d002ac5f008dabf7c938827bc416d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02693.ts", "upstream_id": "BenchmarkTest02693", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-forwarded-for\"] as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n const requested = parseInt(processed, 10);\n const wrapped = (requested + 1) | 0;\n const buf = Buffer.alloc(wrapped);\n res.json({ allocated: buf.length }); return;\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f111e94d0a84a0ee87d49de1e5f9de4e3d131e2470b2ed36e8e5d05d34183786", "structural_hash": "692b95a60c12132f5beccef64d3772aec70af7d2c7bfd6489968bcbdf9592338", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05199.ts", "upstream_id": "BenchmarkTest05199", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = hdr || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n res.set(\"X-Frame-Options\", \"DENY\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e669e4ef717de9f92d8cf15c4f197adae4a73bc0253d2877e24355e579256a9", "structural_hash": "91c9cbb33f8aaff3ccc2871b5e901672a170b74ac39321145e6ba62c247fda75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03057.cpp", "upstream_id": "BenchmarkTest03057", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = std::string(\"value=\") + user_input;\n bool _authok = !data.empty();\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a68f1847d8b1f9e98c6612e683e24c77f6276ce257a2fac6e8f7f853dbbd15d", "structural_hash": "7b2235360e9d7e864e56f2915e6c3838b48a6a73407bc6702b099c4f3ef2b488", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08036.c", "upstream_id": "BenchmarkTest08036", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n CURL *_curl = curl_easy_init();\n char _url[512];\n snprintf(_url, sizeof(_url), \"https://api.internal.svc/ingest?d=%s\", data);\n curl_easy_setopt(_curl, CURLOPT_URL, _url);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24e5169ee8a43dd048bdcf0b37002f96bd7c5dfab196389e0b4bc663016db0fb", "structural_hash": "8026be8d4c098e3186d9cdc7f3ae7ef005c7b1d0feae7c66396bb424fb653aa5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04856.rb", "upstream_id": "BenchmarkTest04856", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"sanitize\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = sprintf(\"%s\", user_input)\n processed = Sanitize.fragment(data, Sanitize::Config::BASIC)\n content_type :html\n \"
    \" + processed + \"
    \"\n end\nend", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cadfd04cdd408c007d5f69f9dc18dd9aab254d28c98df24f6ca8d0f0865235e", "structural_hash": "edc2b33f073f7958d22b0ea6c662204328a690aaa7d1df2dc16df1406d57ecab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_22346.go", "upstream_id": "BenchmarkTest22346", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tconfigSecret := \"config_secret_test_abc123_key007\"\n\tdata := configSecret\n\tif _, after, ok := strings.Cut(configSecret, \",\"); ok {\n\t\tdata = after\n\t}\n\treq, _ := http.NewRequest(\"GET\", \"https://api.gocdn.net/v1/data\", nil)\n\treq.Header.Set(\"Authorization\", \"Bearer \"+data)\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tc.Data(200, \"text/plain\", body)\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "818cbf3f3c4dd4578bc762361e48fc5bb18ee06588212732d99c7e0f40acfb16", "structural_hash": "91977fba192a4b14db06e76ee65da2418a53775f9dc1bec06984c0e699a89e8a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02077.cpp", "upstream_id": "BenchmarkTest02077", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"id\");\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + safe + \"\\\"}\", \"application/json\");\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e73687afe79633ae64f80b5772692dbb80e252921c4cda4fcf39859aacaa9b37", "structural_hash": "51cc0ffb166c6b9ff2db655b2bb920ce1fa06f06d5fcb3582e1b12bd10678f25", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00432.rs", "upstream_id": "BenchmarkTest00432", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(xml_value.clone());\n ([(\"content-type\", \"text/html\")], format!(\"{}\", data)).into_response()\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2553482c2d66c20af7835f220f662718cd6276defc38f01f5e65f10b2b23fa3d", "structural_hash": "e03cff02d64f125f3c374511dd2c1081678a1e9c41a1eecc9571c4dc6e73ddba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00709.py", "upstream_id": "BenchmarkTest00709", "language": "python", "code": "from fastapi import FastAPI, Request\nimport random\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\nimport ast\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n try:\n data = str(ast.literal_eval(field_value))\n except (ValueError, SyntaxError):\n data = field_value\n random.seed(int(data) if str(data).isdigit() else 42)\n token = str(random.random())\n return JSONResponse({'token': str(token)}, status_code=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28c0eb3bdf50e02ca991c6ae4b18c6778a3ead83b302c31e6858bf4c68276224", "structural_hash": "76775998579ce49b28487bf12057fd999b9fd7d648d2f02aebde0fc3eff0bb78", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01002.php", "upstream_id": "BenchmarkTest01002", "language": "php", "code": "name;\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63c743ae8adc4118f5667b3ad2bd83c90ddc271ecd2a70f2159183fd7ad7354d", "structural_hash": "b33becb445c11909145093528156f48a30b260ba06dc500f1f5cbbb154b8d9c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02338.ts", "upstream_id": "BenchmarkTest02338", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = ua || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if ([\"https://app.jscdn.io\"].includes(data)) res.set(\"Access-Control-Allow-Origin\", data);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9514ab0648959fec17f8ee0f8e76b69659f7ec0f4c328954b5e03b34318500cb", "structural_hash": "01d9155d4b02311cc82b74835c7a18af44f8cccb825fb6c69e0fb5e3aa2af6a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03420.rs", "upstream_id": "BenchmarkTest03420", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n for token in graphql_var.split(',') { data = token.to_string(); }\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b28f8f9205cb08f6c794310e0f71974f931b6a28fd754c4cae20472ffeb4bb33", "structural_hash": "c91df0801c8f42f87f8e39bcb9a42fa40e4bc534d2a1568d1182d3badbf28800", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02806.rs", "upstream_id": "BenchmarkTest02806", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let _prefix: String = comment_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => comment_value.to_lowercase(),\n \"f\" => comment_value.to_uppercase(),\n _ => comment_value.trim().to_string(),\n };\n HttpResponse::Ok().insert_header((\"Access-Control-Allow-Origin\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21ebd72b477e8b4f42add792c93beaf54637877f03de157f54806696829ff338", "structural_hash": "bd3acea52a21aff01988dc7f29d58a3e0b3b52183e17b06a4ba2da062e5ebf9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04724.java", "upstream_id": "BenchmarkTest04724", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n String data = \"\" + envValue;\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "336a81b40afd7d71764b01b25d620b4e8fa5ba9294b4e0ae5dbe821583a1f277", "structural_hash": "39a01bf930ba70d43686c8b02e26b2c608c71ff3a8b1433e339c2b187e1a833e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02165.c", "upstream_id": "BenchmarkTest02165", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"uploads/%s\", user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b24c0c592f5cb3912c585e0b45243ab0cdcad77a4e5f55df55a4e930b9e76a0d", "structural_hash": "4f594dc10e718005c5711573a8150a3c9f5a011a843bcae1dd1e105974d647f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_04227.py", "upstream_id": "BenchmarkTest04227", "language": "python", "code": "from django.http import JsonResponse\nfrom urllib.parse import urlparse\nimport ast\nimport socket\nfrom app_runtime import redis_client\ndef benchmark_case(request):\n redis_value = redis_client.get('user_data')\n try:\n data = str(ast.literal_eval(redis_value))\n except (ValueError, SyntaxError):\n data = redis_value\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return JsonResponse({'error': 'forbidden host'}, status=403)\n target_url = data\n s = socket.create_connection((str(target_url), 80))\n s.close()\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54b9b9161b207c67f128e69b53751a6d6fa0445f9d0fc386e025f9fe9205a735", "structural_hash": "8383a49b748be9c83a30cb4c1bf6211623765cce8099d327a9eba91658425e6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19406.c", "upstream_id": "BenchmarkTest19406", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n FILE *_tf = fopen(\"/tmp/app_export.tmp\", \"w\");\n if (_tf) { fputs(user_input, _tf); fclose(_tf); }\n chmod(\"/tmp/app_export.tmp\", 0777);\n}", "label": 1, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1cf20831c6c822369642a7de800ea6789cf85887750f21dfa5519a44b58a78d5", "structural_hash": "90eeddd30d7bb9cd9f659e8ea47bac0fecc340faf95b8763ff2e899f047bb9f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01294.c", "upstream_id": "BenchmarkTest01294", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_passthrough(user_input);\n const char *safe = data;\n if (strncmp(data, \"https://api.internal.svc/\", 25) != 0 && strncmp(data, \"https://cdn.internal.svc/\", 25) != 0) safe = \"https://api.internal.svc/data\";\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, safe);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "555e0d43d7f1a3757032e4b66631d60482ca73935f6330b0b9eb15df0836e1e5", "structural_hash": "ff88367eea9ca06dd8bef8568133002f8ac305efee4424d6e837202f53628c4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15061.js", "upstream_id": "BenchmarkTest15061", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (data !== ctx.session.csrfToken) { ctx.status = 403; ctx.body = {error: \"csrf mismatch\"}; return; }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd834f02871fb611102d850cba5bfb2f4f0f20927c1a19ece637ec4586839b56", "structural_hash": "cff6c1ccf13a39a9598bb7a548d9d1a7d305162bc5de13c14f98186c29caea56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12448.js", "upstream_id": "BenchmarkTest12448", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const data = userInput != null ? userInput : '';\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n db.collection(\"users\").findOne({ name: String(processed) });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f4d294f2fbc5122b42df2e29541c0df3e9aa32f9ed04437339ca0de791532116", "structural_hash": "07c604fea886465391a5100bf554703e6d9f025bc8e1a14db2112de808e970d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02514.sh", "upstream_id": "BenchmarkTest02514", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n ldapsearch -x -b \"dc=example,dc=com\" \"uid=$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "504ca50dd55cfe1d2f797608b2fa1dc1c1f5fb1b3a0d4772770054c59d9483bd", "structural_hash": "2bc538cd94562978c83756cab9735ce52c21f2c98aaf6ac8e0e99e4460f59440", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05089.java", "upstream_id": "BenchmarkTest05089", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.List tokens = java.util.Arrays.asList(multipartValue.split(\",\"));\n String data = String.join(\",\", tokens);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n Object evaluated = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.getWriter().print(\"
    \" + evaluated + \"
    \");\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4bb72efa0b70899e6b226c203c79475e7f50f70663ed3ef87e87204493c7f40", "structural_hash": "4fa02aba7469124c5c3fc4b03509cf3f992ffb1577897faa731b3e7d1976e287", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02511.cpp", "upstream_id": "BenchmarkTest02511", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n res.set_redirect(data, 302);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84f72d1e5674372e525f651a304aaf18cf31edd3a2bdc44020d90454dd7f64fb", "structural_hash": "56ab32ae0230d3ec41a181a90a745bef79fb43ac49641874f0dfd69ea27daccf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01004.rb", "upstream_id": "BenchmarkTest01004", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"nokogiri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n instance_variable_set(:@exec_val, user_input)\n data = instance_variable_get(:@exec_val)\n _doc = Nokogiri::XML(data) { |config| config.nonet.nodtdload }\n _ = _doc\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e470a3f534d9e3f5d17615023d548c3ffa75406df917b8834aed8f1266b4c7c7", "structural_hash": "b09f4f3382d9a0cdfad32620de6a90db63b2d7db07ac6ff9e38001bfcb4fcde2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03258.rs", "upstream_id": "BenchmarkTest03258", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let mut pending: std::collections::VecDeque = upload_name.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51d597899accdede29c6d848feffa5d4a5e984f6ffb8c299a2448c389e2fc270", "structural_hash": "007d568db85e6e55605129ebad80aa051ae3166e266365a2bcfdd5bb60758ec6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02322.php", "upstream_id": "BenchmarkTest02322", "language": "php", "code": "headers->get('Host', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $logger->info('Action: ' . $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61cfd60fbd81b6a5e7f808665009a7a88b6d5efc08a563617fd6c662ddcdfffb", "structural_hash": "216bf2c4ed923851c7067dc6731435d65f578ce910ecb7ca63ca81e6d8e0219c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04569.rb", "upstream_id": "BenchmarkTest04569", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = String(user_input).strip\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3c22256824fc51dfd723a475bc65774248cfeecda151775adfb3a7359bd38ad", "structural_hash": "0eaec9e6b4919523a0f172dce81764ab01d990bd064124153023915f85001d1b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05065.rb", "upstream_id": "BenchmarkTest05065", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n logger.info(\"Action: \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0aa8b923b49066a77f6f95ba78cb8f3a26d80660c46e59f05b9f4977f81bc934", "structural_hash": "5111436157f8422ed757f58edb8be7e55b18084ff653313f2ddc2e9f9c4a1b9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01133.py", "upstream_id": "BenchmarkTest01133", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nimport base64\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = base64.b64decode(raw_body).decode('utf-8', 'ignore')\n requests.post('https://api.prod.internal/data', data=str(data), verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0664d02dc5cfbbaf7af9dbab26e48b217ecd161666408549ae0b53789b6724c", "structural_hash": "0f3c4bf542a7d629048985dda69364a07df9a71b5de09ae797e074e1e2cf0ddd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08304.c", "upstream_id": "BenchmarkTest08304", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n long _req = strtol(data, NULL, 10);\n if (_req < -2147483648L || _req > 2147483647L) return;\n long _result = _req - 1;\n printf(\"result:%ld\\n\", _result);\n}", "label": 0, "cwe": ["CWE-191"], "category": "integer_underflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:integer_underflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e07c685e2dbd4fe77c8595ed10f80b1d8d3db6244204f95e13941c70224a80cc", "structural_hash": "1c9e3abb9d4fb66585c538801817d681f8393b82e9386a9005f66fbeb55f9858", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01021.ts", "upstream_id": "BenchmarkTest01021", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.origin as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (Date.now() > 1000000000000) {\n res.send(nunjucks.renderString(data, {}));\n }\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7901b0ae422c92456a6bef0f577b7a36b3c59b5fa2985d2809e8c35b77500e1", "structural_hash": "039dcec9e79451e23174b4ed01de80a9e2e78f6e5fc66c5b25d43786c1ebb4ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04014.js", "upstream_id": "BenchmarkTest04014", "language": "javascript", "code": "const nodeUtil = require(\"util\");\nconst libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n libxmljs.parseXml(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-91"], "category": "xml_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c2953ebf824cfa8f332be07b5bc8df4de54d32db2873cf9fd0f6d2d7e1f0b43", "structural_hash": "aad69eb29cdf37388cc5278bb6e7ee9e8885d9527860d1f35d033f527ffc761e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15042.js", "upstream_id": "BenchmarkTest15042", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n ctx.session.data = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-454"], "category": "external_trusted_var_init", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a07131fa2be43182b5a5f719fde4a940b0a610774180a13253f68cbe986be1b", "structural_hash": "3ee2aebfad526787021af38e8dcf2685d666247e3222e8b67e97113e89025468", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02704.cpp", "upstream_id": "BenchmarkTest02704", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = std::string(\"value=\") + user_input;\n const char *_found = std::strchr(data.c_str(), '=');\n std::cout << *_found << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11ad0956ee5370245247caf6533833d746409f527cf2baa7494480392c99a6f5", "structural_hash": "0a15a983690dffa28e1c976eef16266710ab10f2828259663dc507b99a9f3539", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29766.sh", "upstream_id": "BenchmarkTest29766", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n echo \"$data\" > /tmp/shared\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6f67a15f8fc79b22881281294145b49314a4ee3c285058c4b324553c987fb60", "structural_hash": "a221e387540f14b7b3de60475f9897fb66bc3d2957d0af12b5e889a8b419dc19", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_23890.go", "upstream_id": "BenchmarkTest23890", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tdata := fmt.Sprintf(\"%s\", graphqlVar)\n\tDB.Exec(\"INSERT INTO admin_actions (cmd) VALUES (?)\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-441"], "category": "confused_deputy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9049dfe8307a7cf7c7e6405027354eb77ee5440e18137bdda208b0aaf7baf8db", "structural_hash": "6155617f2abc1b577faee5fe9b4b95a7fb0d8c8dcebab00f70a0a70099216258", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04200.rb", "upstream_id": "BenchmarkTest04200", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n data = CGI.unescape(user_input)\n content_type :html\n \"
    \" + data + \"
    \"\n end\nend", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c0cc6b718ceb27df4e5b97c7a8d8dd9eda4d0a1e31ecb9904a401aba57cd528", "structural_hash": "b3b0758c90258b3f9d4ca15e262f63b34a9c04ad8b56926b444d65284d9fddb0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00998.php", "upstream_id": "BenchmarkTest00998", "language": "php", "code": "headers->get('Host', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n register_shutdown_function(function() use ($data) {\n $_body = file_get_contents((string)$data);\n $conn->executeStatement('INSERT INTO feed (data) VALUES (?)', [$_body]);\n });\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1466dc9fc9155bbcdce205e5d7672597f012601eb35af8a67e5c8d549733dd6a", "structural_hash": "c9186a8dd02bc5ca035e37214a9863fc4661cec163da58cdf47eca881fb8339c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01104.ts", "upstream_id": "BenchmarkTest01104", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n http.get(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "823d8a28ace11a378ed30ba8e75eb986aa03aad0090716911baad23e907d245b", "structural_hash": "cbef3209e20826037bdcd3190080a5a92befc3464017faebf04af63b5e3e089a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01846.php", "upstream_id": "BenchmarkTest01846", "language": "php", "code": "name;\n $data = base64_decode($userInput);\n $processed = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d3d343542a91af4531d5e9f5e31a0f47065b2518e51c4d222e0e874c2e95536", "structural_hash": "0069f4fe6a9382eef2a56da90d015d01d70ab99d66cf686a6bae7096d86c41b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08466.js", "upstream_id": "BenchmarkTest08466", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(userInput))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-441"], "category": "confused_deputy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd2b10eebaa2f42e244d9cb018a152e7d133d3fe8e8a28534e007de5eee22493", "structural_hash": "54a11bf1fbc9ce10931406b35dc14f11971fa391dd6b5d05b300427c2c7c97fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00319.ts", "upstream_id": "BenchmarkTest00319", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.origin as string) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n console.log(\"Action: \" + data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50b8229fb877a16ce4a7533558f31f848ed0746af981e842d809f22a9e22aec4", "structural_hash": "52143c1d4ad613cee34f10182efa1e19cdc3d91a8ed5231fc122e1475b6a2489", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01390.py", "upstream_id": "BenchmarkTest01390", "language": "python", "code": "from django.http import JsonResponse\nfrom app_runtime import auth_check\ndef benchmark_case(request, path_param):\n path_value = path_param\n data = f'{path_value!s}'\n if not auth_check(request.session.get('user', ''), str(data)):\n return JsonResponse({'error': 'forbidden'}, status=403)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d79e259f32784653e2d6ae6dee8578b475e4d603797e54272520125f8a223e46", "structural_hash": "bd0e2a5d0ef2bef8ffbf05c7274abc438e659f6c19d48089736fea0c69799d90", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07454.sh", "upstream_id": "BenchmarkTest07454", "language": "bash", "code": "benchmark_case() {\n user_input=\"q9Cb4Ad2Fg8Ht3Vk6Mp\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n echo '{\"sub\":\"1\"}' | openssl dgst -sha256 -hmac \"$data\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b8a74c42272efdeb746dff627f3c1dbe7a0c63580797b61967b6a6698e33c754", "structural_hash": "88b944bf60ba5e68e9757e62942a976efef5944861b8f7c7354647b639a43d23", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01272.rb", "upstream_id": "BenchmarkTest01272", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n @user_input = user_input\n data = @user_input\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c37bdb591407fc80e1e23c643400649db2ea2a82db47958947ff4e8643316501", "structural_hash": "55c9834e3e8b71dccb222ed4c45b3fbc185a75472b4f5b057a756f520c14ef4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01998.sh", "upstream_id": "BenchmarkTest01998", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n printf \"\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-615"], "category": "sensitive_in_comments", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7a686b1acbfcb98aa86a65a797af5952658eccd3864d873b199e052d1871b1d", "structural_hash": "597a9222b6ebe239528a22d7a3426aaa20564e34e89b00e7853c71517636b959", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25196.js", "upstream_id": "BenchmarkTest25196", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n fs.appendFileSync(\"report.csv\", data + \",ok\\n\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2087984241a14c4b89e5c2cc7e471e54b8c888cb3383d285e989fcb3ccc24c2", "structural_hash": "8a0d64011f835e74ad0e7bfdbf16a07f95fe3bf6e12a3d1fbed548ec33f096ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02621.php", "upstream_id": "BenchmarkTest02621", "language": "php", "code": "headers->get('Referer', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $resp = new Response('' . (string)$data . '', 200, ['Content-Type' => 'text/html']);\n $resp->headers->set('X-Frame-Options', 'DENY');\n $resp->headers->set('Content-Security-Policy', \"frame-ancestors 'none'\");\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5857888b6e390d543964d99af6727d0717fa3a5e9fde1781262d4b7b02e45364", "structural_hash": "37ff6519845ee33c8b858d0cbba081e159aa6034ca0d16930c83ecace123001f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01480.cpp", "upstream_id": "BenchmarkTest01480", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::string safe = data.size() > 4 ? data.substr(0, 2) + std::string(\"****\") : std::string(\"****\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09dbcc47f4db46d27db25dcbf3aeed98b8685c466b4d03fb2f104421cc0880de", "structural_hash": "8b35a038d8c7bc44339b9c9530ec2506c751d9a422ce5e7a313fed7c3844497b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05006.java", "upstream_id": "BenchmarkTest05006", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n FormData payload = new FormData(rawData);\n String data = payload.payload();\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n dbf.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n dbf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);\n dbf.setExpandEntityReferences(false);\n dbf.newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7fbdd4ccd5d67abaa5de6a83e900a654a3261a75a5ec6baece6e673c2a2af02f", "structural_hash": "7150d05bbd9187968de7192c476fcb26a58fdf9e5d7b86ffde8ad24104d7bd41", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03483.php", "upstream_id": "BenchmarkTest03483", "language": "php", "code": "header('Authorization', '');\n $data = \"{$userInput}\";\n abort(500, $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "571abdfbf53895feb9b1c92ef348b21a2172b204301082a87c58f9d76b3ffde7", "structural_hash": "161681b9e69f7c6769dec85680577bf55c27a8b0f88985f0fd5ac512e57d6439", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02776.rb", "upstream_id": "BenchmarkTest02776", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b9c12e761b7dd3886804065db1bbd4e4bb2c6a7fdc0055856409ccbaac7ffcf", "structural_hash": "41c3302e370b7b8ef32fe48016a1ca170fdf34645052b0e539a4aa803fedccf3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02665.rb", "upstream_id": "BenchmarkTest02665", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = user_input.split.join(\" \")\n halt 500, JSON.generate({ error: data })\n end\nend", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e19f65e93a86b71dfd2a28d0cb2ef8a6e30d0acedf0a7cef2ed8199f455b762f", "structural_hash": "75d70cb1c357fc884f1ee95f5c297a42568cd9b4927cf477dfd58b76b319ee8e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03580.ts", "upstream_id": "BenchmarkTest03580", "language": "typescript", "code": "import { Body, Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = field || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n res.set(\"X-Custom\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74284935018aaf472d9e202f6ce8363892fa9a3cff9151aef8bc9f551fc9a650", "structural_hash": "18310c401033dbcf560b043e6bb9887c846fa52ef3790b7024755c15ad43c526", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04641.py", "upstream_id": "BenchmarkTest04641", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nimport re\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n auth_header = request.headers.get('authorization', '')\n data = bytes.fromhex(auth_header).decode('utf-8', 'ignore')\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n os.unlink('/var/app/data/' + str(processed))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ba3cb4288197069d5bc39081267d1e245c5e62e29858e044c390335b093770c", "structural_hash": "1f93dd50d27e77f4bd128e30facdf2d13e126155d174aa90bb579372e21a08bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14905.sh", "upstream_id": "BenchmarkTest14905", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n printf -v data \"%s\" \"${user_input}\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ceb8889155e69b2b812f68a1d18f1c24d595f954661421ed8f6b1f5cfc658a13", "structural_hash": "473fe5678bc331c95917366442ef0dfab2fd2d87f407384166b2efd27f5e50c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13461.go", "upstream_id": "BenchmarkTest13461", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- cookieValue\n\tclose(_jobs)\n\tdata := <-_out\n\tc.Header(\"X-Custom\", data)\n}", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dcc2c8beeece88eadd6d1c5c9acabb009d78b8da3ff34c5ed346b8dc64b61ba", "structural_hash": "b869dbf61633a46cb0c559967371ff6d6042da5fec3df32341b9a461676590b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11517.c", "upstream_id": "BenchmarkTest11517", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _vals[8];\n int _idx = atoi(data) & 7;\n printf(\"v=%d\\n\", _vals[_idx]);\n}", "label": 1, "cwe": ["CWE-457"], "category": "uninit_variable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:uninit_variable", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14404433773cdace5cecafc3171ad135ee114688018f9743b3ed0eae11e6fbb7", "structural_hash": "e3efa45d128b456323afbf5f664907781b59542f9f6e9a3b30efb361450a78ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01491.ts", "upstream_id": "BenchmarkTest01491", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0324d039410611e08450a2469aae2298115bcd0264661d97ded393402b00da99", "structural_hash": "20af1bb25554766c303b74699c152487e6e7f118943b17332d929fe347ec15c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05212.rb", "upstream_id": "BenchmarkTest05212", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7559b5cc1b68ef11227aeff0d25177ed60ec192fa1ee0e6756f5351778a513a2", "structural_hash": "3819b60000b3646389e3ee39be6bf9fa66d2d74c97c75d9acadaa84dc65f2ea7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00712.rs", "upstream_id": "BenchmarkTest00712", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(xml_value.clone());\n use sha2::Digest;\n let _ = sha2::Sha256::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b5e2755012bdaa75979268359081620683d7700e9f1c788ce402a7292436b6b", "structural_hash": "f31bdf39d5da4b14a4e1ee82cdb02102eda668270616089a70220000258d7273", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02996.php", "upstream_id": "BenchmarkTest02996", "language": "php", "code": "json(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2933bd3d2eddd521fdd5b544165ca4d62ef574ababb57fdde3f0beb7a4cb3872", "structural_hash": "fa94900a62acb0e4170cc515cb8856dcc49e681799d5fb8d5dd4f7dbb7a8c0f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01940.java", "upstream_id": "BenchmarkTest01940", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport javax.xml.parsers.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = rawData.isEmpty() ? \"default\" : rawData;\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n dbf.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n dbf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);\n dbf.setExpandEntityReferences(false);\n dbf.newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "237e6a76a3a2a28edd3e5bc2ef7a17a37ff251f20db182619be73a44e68bad18", "structural_hash": "e985e0b048ed957f7d12aa2987cd3c6ea6fddbcc531e70f24c89b314aa33c0bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02930.cpp", "upstream_id": "BenchmarkTest02930", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string data = std::string(\"prefix-\") + user_input;\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n res.status = 500; res.set_content(_msg, \"text/plain\");\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e6370bd1d5c541242872f2f182886bc2c858d4223bc54a6bb6dd6d5e92b53e5", "structural_hash": "d1cfc5e74c3ad469d2a6bd3d4c0431b114861c0f864e083cbc2e3d147f8db682", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04922.php", "upstream_id": "BenchmarkTest04922", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n [$data] = [$userInput, 'http'];\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b14c1d69cff02e9e14a7fe812227efb0116186d2e6fc489715b9cfc494f73425", "structural_hash": "8a9c7beae9d6168a0abcdb398ca8ade89ccd1bb992359cb89bfb7ec9fcf11afd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10591.sh", "upstream_id": "BenchmarkTest10591", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n data=$(printf \"%s\" \"$user_input\")\n cp /var/app/secure/template.cfg \"/var/app/data/$data\"\n chmod 644 \"/var/app/data/$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7c5416500524bdb4d56e6cbe1950ee769139f927c9adbfa3f53b0e712377f06", "structural_hash": "3b9b9123f76594e5d30cfc70c43f7c81f8afec76c310069ac246521f350793b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19262.c", "upstream_id": "BenchmarkTest19262", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char *const _argv[] = { \"/bin/echo\", (char *)data, NULL };\n execv(\"/bin/echo\", _argv);\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee465bf6c18461ee70ea885746636daa2ea14d08a9fd684bca95665d5dcda8a2", "structural_hash": "66c9d5004365bf686060ee7e201c5a5aea4a2ed726b6163b92d5d05d29fba629", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01530.php", "upstream_id": "BenchmarkTest01530", "language": "php", "code": "headers->get('User-Agent', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89ad609761c3474e03bc4209178c39da565afaa20188b89dd1eeb4531b630332", "structural_hash": "dceb76edfabea2a81a0a68c23b8905730afe92fc7ea477283a5ed3b9f6bac1f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00283.cpp", "upstream_id": "BenchmarkTest00283", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n CURL *_curl = curl_easy_init();\n std::string _turl = std::string(\"https://api.example.com/\") + data;\n curl_easy_setopt(_curl, CURLOPT_URL, _turl.c_str());\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "803ec8a5c1a94e38ed3035be27d03e7d01f63d2cbcddea6dcba3442c1919c42b", "structural_hash": "26f9a640f89b9402d440e6d4f02d2dd632981ff7a711af33561ae5e24047a71a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01749.py", "upstream_id": "BenchmarkTest01749", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n data = '{}'.format(host_value)\n requests.get(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "173f3abb0c29600cc6cc0a1b6fd003744b0fd795a780140013255223bee58dae", "structural_hash": "e256d196765acd8e57e1b72803f9f8567dc9a19b4f0ecd0ff7262cc6d4aac230", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01960.java", "upstream_id": "BenchmarkTest01960", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport javax.net.ssl.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/json\")\n public void benchmark_case(@RequestBody GraphQLRequest req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(graphqlVar.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n javax.net.ssl.HttpsURLConnection conn = (javax.net.ssl.HttpsURLConnection) java.net.URI.create(\"https://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL().openConnection();\n conn.connect();\n conn.getInputStream().close();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ed8d255927881db995a16049a38e0a5f7b68e8bf61f087c44f924bba77dc1a6", "structural_hash": "bb0cc72d0ef0a5a48eee2f349da06a6d3255ad63a42e14ac524d4258033cdf2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02810.cpp", "upstream_id": "BenchmarkTest02810", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n if (_i >= 0 && _i < (int)sizeof(_buf)) std::cout << _buf[_i] << std::endl;\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4bdb97184d971f960365e3003daf4a27d1102a77ce5d4c232c2d701ef50162e", "structural_hash": "972e6925964a138c3c40ab9d5d60cb1090b8093c2f65aa6990f7af29c521c8b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01144.rb", "upstream_id": "BenchmarkTest01144", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n return render json: { error: 'forbidden' }, status: 400 unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0e86af3dc75ea963ff7b9c81631e6e67d774a970ebe403186e6e37b6daf86f7", "structural_hash": "795514fce99f873d3199617240328ef07193370fc917893e3aced6095ac4fc6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_30407.go", "upstream_id": "BenchmarkTest30407", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\t_jobs := make(chan string, 1)\n\t_out := make(chan string, 1)\n\tgo func() {\n\t\tfor _job := range _jobs {\n\t\t\t_out <- strings.Join(strings.Fields(_job), \" \")\n\t\t}\n\t}()\n\t_jobs <- graphqlVar\n\tclose(_jobs)\n\tdata := <-_out\n\tprocessed := strings.NewReplacer(\"&\", \"&\", \"<\", \"<\", \">\", \">\").Replace(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 1, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d809a45e4072c96ff0849da53310fcfab17f146914289c2e8724bfc090848f7", "structural_hash": "80125148dfd12b48a3c964877dce6546071f21c6392dbf81cf13f50c22a98ab0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19290.c", "upstream_id": "BenchmarkTest19290", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\n#define CURLOPT_URL 10002\n#define CURLOPT_SSL_VERIFYPEER 64\n#define CURLOPT_SSL_VERIFYHOST 81\nextern CURL *curl_easy_init(void);\nextern int curl_easy_setopt(CURL *_handle, int _option, ...);\nextern int curl_easy_perform(CURL *_handle);\nextern void curl_easy_cleanup(CURL *_handle);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, data);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 1L);\n curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 0L);\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cert_host_mismatch", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f57f297283710ddcc91c4015c9db806f2eee1ecc7d78007c55e0f86187237f61", "structural_hash": "f8d35cdc5d4d9119de07f1a3a1edcdf418fc1f962aaa33af126cfa5489af50ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03524.py", "upstream_id": "BenchmarkTest03524", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n reader = make_reader(graphql_var)\n data = reader()\n if request.session.get('user') is None:\n return JsonResponse({'error': 'unauthorized'}, status=401)\n request.session.cycle_key()\n request.session['user'] = str(data)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1c27d229b640c6f8470e229576743abbade6725e36377fdd4d4d1ba8cc3c0cb", "structural_hash": "8d0646db35045bd0b9aeb793ebea727e8654c0e95ca01575d5b759f8a79c4b70", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00905.php", "upstream_id": "BenchmarkTest00905", "language": "php", "code": "payload;\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt('data', 'aes-256-gcm', (string)$data, 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d47bf00f7fa092487c8e2d28db34acb0f61fe3ce448f5e36366a7e237a39ecf", "structural_hash": "064ef9a336b93e80584788083ea50b908fb57230df82d21db5a6c24d2c1366bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00809.ts", "upstream_id": "BenchmarkTest00809", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).slice(0, 200);\n shared.authCheck(\"admin\", String(data));\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afbb78ffb5cb02ce944f7721da3083ddad3992e59d6edeec1ed0c2fea8f4850d", "structural_hash": "7976fa15a1d86f1bbf9da8ac63ece8a05039b91ded4ef859a820d1061aa6eaaf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09961.go", "upstream_id": "BenchmarkTest09961", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(dbValue)\n\tstaticSalt := []byte(\"bench_static_salt_v1\")\n\tsum := sha256.Sum256(append(staticSalt, []byte(data)...))\n\thashStr := fmt.Sprintf(\"%x\", sum)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7124780339e60bd9d71897a0cf1486f23edcbc61fb0728a197d158933ca9abb8", "structural_hash": "3b5a415435e57d546408736efb75b62222d6eead1b58296572b616b37b671b34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05730.ts", "upstream_id": "BenchmarkTest05730", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n res.json({ status: 'ok' }); return;\n}", "label": 0, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a2f1163517e8f3c43d954fa0464c50e5d1985971746c8e35df55a7b8f42423c", "structural_hash": "dd0449c64cab39652a096bf84b13876bb1a525eeac5520a0bb56946697688fb7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11088.c", "upstream_id": "BenchmarkTest11088", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NOENT);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bef4ce75b0e7ede8e96c48dae51440647c951e0a6dca1ba50ab8b7d44c198ae4", "structural_hash": "1cbd86022961203c64ce717584d6290e30b9b5293146618fdb3585b6c2532b01", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_23267.sh", "upstream_id": "BenchmarkTest23267", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=\"${user_input//$'\\x00'/}\"\n echo \"Error: $data\" >&2\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5beef1163ebb28e7fc2067a15c9bc25faff53e3405c4bad792881b22c52254ab", "structural_hash": "e8982808faabc6450d4dc4076ecd4f2fe6f3851e234992c4d5dfb62379f0a954", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00671.rs", "upstream_id": "BenchmarkTest00671", "language": "rust", "code": "use axum::extract::Query;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\nuse std::collections::HashMap;\npub async fn benchmark_case(Query(params): Query>) -> impl IntoResponse {\n let user_id = params.get(\"id\").cloned().unwrap_or_default();\n let data = if user_id.len() <= 4096 { user_id.clone() } else { user_id.chars().take(4096).collect() };\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n use sha2::Digest;\n let _digest = format!(\"{:x}\", sha2::Sha256::digest(_body.as_bytes()));\n let _expected = std::env::var(\"FEED_SHA256\").unwrap_or_default();\n if _digest != _expected { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3edc5f8a43792060ca3e70f800a1582dbeadebb40ef1a8ae42467098a3ba97f0", "structural_hash": "bd82cd33ae902f61c72107886b3e3c248f5ae85494b92cb2c7f0264022aa96f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04391.php", "upstream_id": "BenchmarkTest04391", "language": "php", "code": "headers->get('Origin', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($processed)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4331494ac78ba1d1b5d97ebedd559f286495540252a291802ce90482275d67d", "structural_hash": "a25bdd024e23317397a7c6e5308da5cc92869674743e6cde882b6bb7c5e41662", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00629.php", "upstream_id": "BenchmarkTest00629", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $data = (!empty($userInput)) ? $userInput : '';\n file_put_contents('output.csv', (string)$data . ',data' . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fc87dd3db476eb2cc28151f00a89364d7de840dcf5212dcf4d0a7b081f2ae32", "structural_hash": "a6a4b5a2b03d48eaa0311f00dae18611f3333775a25cd7dc2373919f96e514ae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03465.php", "upstream_id": "BenchmarkTest03465", "language": "php", "code": "json('payload', '');\n json_decode($userInput, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa1d572bcfc3cf1651deaa97b672b4b8f76c3faeb06183d2e13a8eb68f191448", "structural_hash": "b435a6c6eba803892de7c777f6311518e8630fe77deceb349bbe12fe03ceae54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03870.php", "upstream_id": "BenchmarkTest03870", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d712eb814af67730aa5f7989d80c8a751b77b4705b844d28b7109218aeb2fd07", "structural_hash": "335711493c3c50120213f3662ca1d0d98de1e495e05223d8d929f3c27a3cb48b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_14671.js", "upstream_id": "BenchmarkTest14671", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n ctx.session.data = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "242a097a71162e226c0e4e9a22b337b5a972b4ef1c7def4fe179db89172bb6f1", "structural_hash": "ec69872cec717c0555ad88622d86e00d40a72511d18d683cb61c0bfc9a83238c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02689.ts", "upstream_id": "BenchmarkTest02689", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4000472dd861a55f1aae5aa7e667e226737347e4fcdd07b7f8b33a9505cfb1e4", "structural_hash": "6930311cdad7055d6a4a20592455a74baa480827d37618b74cb10d6653cfa5f1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23665.js", "upstream_id": "BenchmarkTest23665", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n eval('fs.writeFileSync(\"/var/uploads/\" + data, \"data\");');\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c65d7bca91217cb45faf611b196f955aac2b7e2a61def272bbd6b6c3b8ec14ac", "structural_hash": "21fb9b552e91e97f37b8c278a3734988f33a2ff13aba616c23eab0857cb7c7ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16626.c", "upstream_id": "BenchmarkTest16626", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"ls %s\", data);\n system(_cmd);\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea15790a955a8da72ac0d00a5ec8bf0cc650e771ac5264b1acaa86db082fff5c", "structural_hash": "164d825da63875cc193c9fbe0c8e4df26e988ef5d0bcd23cadd4da5ce8905289", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01459.ts", "upstream_id": "BenchmarkTest01459", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as childProcess from \"child_process\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea0be415fa2480e865d95f3dae62c38feb59e16c135938cb6fbd0e07d6a21b74", "structural_hash": "ad54baacf725d0ab083c23b6904cee2a9352c99e13423311d47184bebf38d9ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19809.sh", "upstream_id": "BenchmarkTest19809", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n mysql -e \"SELECT * FROM users WHERE id = '$data'\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4206a5e6b40f708d507f674635d3f4039358cda1be88996cf2ccd3770c24a72d", "structural_hash": "eb62d6a4f5be66b6ec07a651ecc97d31d8516d782d05326a470eeb204cbf4cf1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02796.go", "upstream_id": "BenchmarkTest02796", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/iam\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tsegments := strings.Split(forwardedIP, \",\")\n\tdata := strings.Join(segments, \" \")\n\tiamClient.PutRolePolicy(context.Background(), &iam.PutRolePolicyInput{\n\t\tRoleName: aws.String(\"app-service-role\"),\n\t\tPolicyName: aws.String(\"inline\"),\n\t\tPolicyDocument: aws.String(data),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03766891b6cb7b05d2e3f07b387e4a05855f089b891a4e986c46a4f104dabaf0", "structural_hash": "033f984a4ffb35a08687809579dfd52fc28ed9c35097d93109ae718a51684b68", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05612.php", "upstream_id": "BenchmarkTest05612", "language": "php", "code": "request->get('multipart_field', '');\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da1db03e6267e25bc97ccad55369937a63d8d0eff9afb6e3e8c1a497c277cd29", "structural_hash": "a3983220f46355d56af13ad5edd5de8f1d5dd014d9dc1098e606c82d2c3b6a00", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08999.c", "upstream_id": "BenchmarkTest08999", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8f05ae964d1deb37129d8badbd2ce5952d8337bcf34274e0422653c352a8a2ad", "structural_hash": "bf1a8a0601205de60ec56c7656a8180efb5282ab8488ee0494aa4c07aefbcc75", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09994.c", "upstream_id": "BenchmarkTest09994", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e12153c37b899e5f80e42d1ed19d7e5d767248bcc7ecf3675b93a49a2b3eb06", "structural_hash": "246917ea854e51ae0e287570e60343aa47699193c8dbcc3ed38951c1cdc96917", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13883.c", "upstream_id": "BenchmarkTest13883", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n FILE *_f = fopen(_path, \"w\");\n if (_f) fclose(_f);\n}", "label": 1, "cwe": ["CWE-538"], "category": "sensitive_file_insertion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2827b368858865d1e8f0f930358913ba1ec502346ecd474e89e17d3fd771f78", "structural_hash": "0a54b8ee846ac488af6a14ed2aa44ac7b48102768f0b347c72e42518a53f15c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03622.cpp", "upstream_id": "BenchmarkTest03622", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(user_input.c_str());\n if (_i >= 0 && _i < (int)sizeof(_buf)) std::cout << _buf[_i] << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5253cd00dc0c7c179ad435a29a58c943f1ab98d1deddb27bc6dce5d0982976ba", "structural_hash": "b3215e5a650b58aeee5c00d19e4c442fb986bf7e47090f7187df17a30ac6631d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_18041.js", "upstream_id": "BenchmarkTest18041", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "998b1392ce4a326cb7b21dc18f060f9fe926e9d76b630d57ccd0f1b4eaf1ccd9", "structural_hash": "e7822d90e6f49dbf2bbf992a82e6fd16de0ef46741ee0f85b0924d869ccd6968", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04818.php", "upstream_id": "BenchmarkTest04818", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n return new Response('
    ' . $data . '
    ', 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f834c043f66a8cfd16204494ed71b59b1bb61cefe79dfcbe70aeffe00d4aee3", "structural_hash": "a2b0ea41558a5eb198adbbc07678ba21581fab6ba4d74df5088334d274f712e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02863.php", "upstream_id": "BenchmarkTest02863", "language": "php", "code": "json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec498a851f1dd043f1db37dd83bc8d547d8becc734f55fefa799c4c282986c6e", "structural_hash": "0de0ba747fda9093263caffac1ff635d0e670bae76b7903a504b29a1d887ea62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25731.js", "upstream_id": "BenchmarkTest25731", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n if (!row) { res.status(404).json({error: \"not found\"}); return; }\n const value = row.name;\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ea9b88a82498507896be279b7ca4c011393d2667c2e5d560156c836211d88cc4", "structural_hash": "ff907633d4e0372e9085c82d9562b87d2b0242abeb2cb6a2fea5108ee2e3ffce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05857.php", "upstream_id": "BenchmarkTest05857", "language": "php", "code": "cookies->get('session_token', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cdff1542545d4ca3d1ccf5de904d52f31d5b688020e94c45c9dc05b0a9199166", "structural_hash": "8e323e20f307389e58c0c681fa1d052fe27ca08f04d050bf8713dc18aefab44c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_03336.py", "upstream_id": "BenchmarkTest03336", "language": "python", "code": "from django.http import JsonResponse\nfrom types import SimpleNamespace\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n ns = SimpleNamespace(payload=referer_value)\n data = getattr(ns, 'payload')\n processed = data[:64]\n buffer = bytearray(int(processed) if str(processed).isdigit() else 0)\n return JsonResponse({'allocated': len(buffer)}, status=200)", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "360069b79dbdd94085b1c7d556f8601b33d02f4aea90fc97b8473f2fa1a0823d", "structural_hash": "5df0982063eac2b9102d64246d95f572b416e4054604724f06f8f4dc0cb6b412", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01683.rs", "upstream_id": "BenchmarkTest01683", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let captured = json_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd948d6b99543fe5db01630ee142997bbdcd38b3fc713e137e2197ce52e67baf", "structural_hash": "9d9cbde8c00c67a2fd2e6bb815b2fc29202d8979a832f6cda6fdba27eed8dfac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05503.rb", "upstream_id": "BenchmarkTest05503", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n payload, _origin = user_input, 'http'\n data = payload\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n system(\"echo \" + processed)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68d433d4da6d0411ea1a237df76e5b51d98162112a073475481a4eb7f3d1eefb", "structural_hash": "719fc0b1c63d5f4b60cdc42d6bbdbb386d899c0ae2c6118769d799956a61481d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_33313.go", "upstream_id": "BenchmarkTest33313", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tpending := strings.Split(forwardedIP, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tvalues := strings.Split(processed, \",\")\n\tif len(values) > 0 {\n\t\tw.Header().Set(\"X-Param-First\", values[0])\n\t\tw.Header().Set(\"X-Param-Dropped\", strconv.Itoa(len(values)-1))\n\t}\n}", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "647a7f23eb5c1656e11181c99b84ea67b21310f1592d703f71516970b5f17e28", "structural_hash": "2c2c0d6d6f5ac3b3b93fa7fdb1dc3b0beaf3969840eb02742da9dbbff13d6b62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37727.go", "upstream_id": "BenchmarkTest37727", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(rawBody)\n\tparsedInt, err := strconv.Atoi(data)\n\tif err != nil || parsedInt < 0 || parsedInt > 2147483647 {\n\t\thttp.Error(w, \"invalid integer\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tboundedVal := strconv.Itoa(parsedInt)\n\trequested, _ := strconv.Atoi(boundedVal)\n\tallocated := requested + 1\n\tw.Header().Set(\"X-Alloc-Size\", strconv.Itoa(allocated))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1089f62789a7aba98a6eaa1fcca5be7ba58dff18cd4e2d6ad36de47727ceb1f8", "structural_hash": "57286aae5670e0f17696f82decf55424118dfabe10257d7de83d926ab7f856f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05789.py", "upstream_id": "BenchmarkTest05789", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom cryptography.fernet import Fernet\nfrom starlette.responses import JSONResponse\nimport json\nimport os\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n xml_value = (await request.body()).decode('utf-8')\n try:\n data = json.loads(xml_value).get('value', xml_value)\n except (json.JSONDecodeError, AttributeError):\n data = xml_value\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JSONResponse({'length': len(ciphertext)}, status_code=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f83f8316a0b058eef030d069126fd225a9ea3bdec2e2e58340a1c50464d4cc1", "structural_hash": "6dd8c5e379662b88b1f6c46aaf37b3717d3fd2435ea869003043a663a3a94892", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04681.php", "upstream_id": "BenchmarkTest04681", "language": "php", "code": "input('field', '');\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n $processed = strlen($data) > 64 ? substr($data, 0, 64) : $data;\n simplexml_load_string($processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9957fc2877d1ca8b5ced0db2a9e85932981c2f65df956c00cbee3a9f9e5b4e4", "structural_hash": "2875d272ca41b07fbd10f83c4718a7cd7209331633056e81fec926b872d134ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09296.c", "upstream_id": "BenchmarkTest09296", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n const char *safe = data;\n if (strcmp(data, \"status\") != 0 && strcmp(data, \"health\") != 0) safe = \"status\";\n char *const _argv[] = { \"/usr/bin/tar\", \"-cf\", \"/tmp/backup.tar\", (char *)safe, NULL };\n execv(\"/usr/bin/tar\", _argv);\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e933ed54ca8fac2662e0902cb7d8a1cb80fa9b647314862d95c223f9632b3c36", "structural_hash": "6347e3271efb5be11f7b03588191d6f94653190a01b8e1240915d048abefe1a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02512.sh", "upstream_id": "BenchmarkTest02512", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n processed=$(echo \"$user_input\" | tr -d '\\r\\n' | sed \"s/[a-zA-Z0-9]\\{4,\\}/****/g\")\n logger \"Action: $processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2553071dff5446b6a39e92ca516b4de5eb08e373894c0d62cd88fc417db6c94d", "structural_hash": "fcc4566acbca3c7ffe6b5b2ad5c211c3728ff941e8dc03bd71b5b7070a0a3ec2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05042.rb", "upstream_id": "BenchmarkTest05042", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n halt 500, JSON.generate({ error: \"Internal error\" })\n end\nend", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6754beff06cb55ac9b7a77683a21af562b52e2e048b6b6b863d9ce7a20504dc", "structural_hash": "e996eb8381fc169abeaaad6b36293bf8ef124747abf33fbc97697448b4e99b8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01395.rs", "upstream_id": "BenchmarkTest01395", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = referer_value.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n ([(\"content-type\", \"text/html\")], format!(\"{}\", data)).into_response()\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50a2a8cc614653de4afe318277383b1f9a54c71c35e4cb4dbcd8078b6a04eab4", "structural_hash": "4ffcbe8a1eadd45a558f1165215413124b7014bd6f73b8ce391de0c1066fe1e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00207.java", "upstream_id": "BenchmarkTest00207", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data = String.format(\"%s\", cookieValue);\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0493347d32710823895dff6622ac714d5e55efc4920b7cba74acadf3c0aa5784", "structural_hash": "39751921615d386c7af8b1260d120f7b94c9e1dd963929c8e18c14ad3273f54a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02263.php", "upstream_id": "BenchmarkTest02263", "language": "php", "code": " (string)$userInput]);\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5383721c5e94c826526f79e49ec7a6f22e8f0e672db5078ef7655c73298cd80", "structural_hash": "7768f637e5c4d57f8b9c1e438414a8294274399be450f377acb8883774b32d4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05858.php", "upstream_id": "BenchmarkTest05858", "language": "php", "code": "header('Authorization', '');\n $data = vsprintf('%1$s', [$userInput]);\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57fdf65f25571ddd6567c199ab94fdb9ef98465ada3d4253b214b5ed6ac63d73", "structural_hash": "42568b5dfe449d90d4f997ce0e5c3f1aba85591c7437bd959997ab53047c7c40", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15344.c", "upstream_id": "BenchmarkTest15344", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n char *_p = _base + 4;\n free(_p);\n}", "label": 1, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f7b47592688bfb2d1812932903f6bb5082cfd6047358627cf6e7abf576c52a2f", "structural_hash": "45c746704acdf4a185b13c65024fdffb3968911eee1f5f5d46cb03efe4f14acb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01318.py", "upstream_id": "BenchmarkTest01318", "language": "python", "code": "from django.template import Template, Context\nfrom django.http import HttpResponse\nimport json\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n kind = 'json' if str(graphql_var).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(graphql_var).strip()\n case _:\n data = str(graphql_var)\n return HttpResponse(Template(data).render(Context()))", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b84b2c06db6b77dbc5d5f37598a1823408e0361b08532e56c569c2f45778e3c0", "structural_hash": "e9e17ba5029be4e8eb68080d5e875aa38d5cc1f0cabecdbaf72a3f6910afa465", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05311.php", "upstream_id": "BenchmarkTest05311", "language": "php", "code": "name;\n $data = hex2bin($userInput);\n $el = new \\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage();\n try { $_elOut = (string) $el->evaluate($data); } catch (\\Throwable $e) { $_elOut = 'invalid'; }\n return response($_elOut)->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "894e84394186729d3aa9e1fc6a65eea4a8e93657c570253a8ed478ee46cb4010", "structural_hash": "474f7dbfe294570977f073f9d3a03f5111d3206d3b7a4029c3a61d85519666ff", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02994.rs", "upstream_id": "BenchmarkTest02994", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(field_value.clone());\n crate::shared::db_query_bind(\"SELECT * FROM users WHERE id = $1\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "645067895f3be882864e58f3091cc722aff8a4a81a369324b60887cface2d022", "structural_hash": "0c509842871b9b2774bec82f82cd5858ba20c0607bc360b38435d40c26d4f48e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02365.rs", "upstream_id": "BenchmarkTest02365", "language": "rust", "code": "use axum::extract::Form;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let (payload, _origin) = (field_value.clone(), \"http\");\n let data = payload;\n static _RE_SCHEMA: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_.-]+$\").unwrap());\n if !_RE_SCHEMA.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "15b09ba87050e6efb24ec48e63cdb473333f4cd52df48148adf77966190b1d4c", "structural_hash": "80315a9d211f99f90dbe7fcf6289042aa43203672f7dbc028a3064ff22588f51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03333.ts", "upstream_id": "BenchmarkTest03333", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = \"default_setting_value\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n const encKey = process.env.ENC_KEY || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(encKey.padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(String(data));\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "566330f62445e5928c2382390bf53973ae89d1adfe01886536508769af1a2c1b", "structural_hash": "6ef224d851ac05f85cad1e9805cf92bf3d59e68d302870a783ff2bd3e6ed733a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_02812.ts", "upstream_id": "BenchmarkTest02812", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n class RequestPayload { value: string; constructor(value: string) { this.value = value; } }\n const data: string = new RequestPayload(userInput).value;\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { res.status(403).json({error:\"private or loopback address not allowed\"}); return; }\n const targetUrl = data;\n http.get(targetUrl);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fa2717c7c9e4688264a5cca7c09837d0fb7d3fc3d61c6c08ee82bf59818140a9", "structural_hash": "12dd171b4886bf000ecf228ad81d6a485e27b79f4b2e00ed7d147b7b0bae8cd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23560.go", "upstream_id": "BenchmarkTest23560", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/s3\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\toriginValue := c.GetHeader(\"Origin\")\n\tvar data string\n\tfor _, token := range strings.Split(originValue, \",\") {\n\t\tdata = token\n\t}\n\tsafeKey := \"uploads/\" + filepath.Base(data)\n\ts3Client.PutObject(context.Background(), &s3.PutObjectInput{\n\t\tBucket: aws.String(\"app-user-uploads\"),\n\t\tKey: aws.String(safeKey),\n\t\tBody: strings.NewReader(\"data\"),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-73"], "category": "cloud_storage_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_storage_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fef9dcb3dd6bafbe7cf544f7e6b5aad24d0afb150964e189b5618bd29317d47f", "structural_hash": "bf53719bf36694f0a19d7bcf5e2cd44bcaf903f9cb7af36acaea187ed57f1ef4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02761.php", "upstream_id": "BenchmarkTest02761", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n static $requestCache = [];\n $requestCache['lastInput'] = $userInput;\n $data = $requestCache['lastInput'];\n abort(500, 'Internal error');\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4957d41c86b960aa6e02452adb24ad2c13af9e95f7315b8773ca08cf8b74143d", "structural_hash": "121c32d14c41dea4bc9eb40e1ab954420245f24795e570f2631dd7d0b25d81f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01351.ts", "upstream_id": "BenchmarkTest01351", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const data = await Promise.resolve(userInput);\n if (Date.now() > 1000000000000) {\n eval(data);\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "547d574aa149c295727a6bcef6598221e4cedb33f928514753d9f27a914620f6", "structural_hash": "c52c0ae7bd31cba32ce0e016cea457036165fce1e621801387e68380d7855875", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25582.sh", "upstream_id": "BenchmarkTest25582", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n arr=(10 20 30 40 50)\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n idx=$data\n echo \"${arr[$idx]}\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acb5974014d069988cb853b13e3d458c88095f3c227f8205bc1672834d6a553e", "structural_hash": "e1d736fee402472b5af88acaa8ab9dfaf5d26cab395e01c327dc5c35e4adacc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24617.go", "upstream_id": "BenchmarkTest24617", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"syscall\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tholder := InputCarrier{UserInput: userID}\n\tdata := holder.UserInput\n\tuid, atoiErr := strconv.Atoi(data)\n\tif atoiErr != nil {\n\t\tc.String(http.StatusBadRequest, \"invalid uid\")\n\t\treturn\n\t}\n\tif err := syscall.Setuid(uid); err != nil {\n\t\tc.String(500, \"privilege drop failed\")\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4bd831394fe5f76d804b599c8881559cfa0ddeaa50749ddd9ef3774e95ec4875", "structural_hash": "2f814ec6a9b3ba85a98baf73e313297d1523f967226ad3aba3219ac41a658a6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10848.js", "upstream_id": "BenchmarkTest10848", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "373c77b0e73931f605178def368a5ae4e71bcd17b9fb60640ab55b9aba242a1c", "structural_hash": "0b25ac096294c10182627e689de5dca2050c26e08abb43d05a6811e221d58a16", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20843.js", "upstream_id": "BenchmarkTest20843", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "114d40964c61fd7310a42c580b29524b259e9f33f86e7913122831fa3ce5dd77", "structural_hash": "66c7ce8e5506e0b3bed797a369b621a28192ce50d74d3ce0080e636c1820db3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03575.rb", "upstream_id": "BenchmarkTest03575", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n resolved = File.realpath(File.join(\"/var/app/data\", data)) rescue nil\n unless resolved && (resolved == \"/var/app/data\" || resolved.start_with?(\"/var/app/data/\"))\n render json: { error: \"forbidden\" }, status: 403\n return\n end\n checked_path = resolved\n File.write(checked_path, \"data\")\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "423e7a4067ec1656beede9a9592dc60f13bd3f93d17068ffcf9203220d97c210", "structural_hash": "22dd7e73423be8b1a4ff34a63e778b3ec5e8a75fc6a95b638165b123b5fad51f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_25019.go", "upstream_id": "BenchmarkTest25019", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tsegments := strings.Split(xmlBody, \",\")\n\tdata := strings.Join(segments, \" \")\n\tDB.Exec(\"DELETE FROM accounts WHERE id = ?\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-304"], "category": "missing_auth_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ee0d800a1867cc0e70a8b9157225e24011471f831cef1e79850451316aebcdd", "structural_hash": "351d70d0a29a2e2dea07091bed9bce2dab8719a49d30c526d48a7dce8ae3325b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04713.rb", "upstream_id": "BenchmarkTest04713", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = String(user_input).strip\n _buf = \"x\" * 1024\n _ = _buf\n render json: { result: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67068462179ce3647195fc475c8f641220724711039c5c81f47880b8668e9bb5", "structural_hash": "08a3c1afbead51065666a39354de80698568d446d53e38240205ec9bb16fa258", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01797.py", "upstream_id": "BenchmarkTest01797", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n data = f'{upload_name!s}'\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfbd00bf5821ea99feaf5dade9d5fd0682a2eb2c73659e6818237405b52b8359", "structural_hash": "06e9571dba86faa7f3c91a7eb5e91d176f9898b7a2c64eecf01379799a51131c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04813.php", "upstream_id": "BenchmarkTest04813", "language": "php", "code": "headers->get('Origin', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbeaccadb0d04d53d4ae5e98338033fbab69d803891a67c002ab55850c8c1eb8", "structural_hash": "01429fb7a8d76eb6b06e95cd3a0d141de1f57255b9f2b2d6cba57840085e6e7d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06070.c", "upstream_id": "BenchmarkTest06070", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n const char *safe = \"[REDACTED]\";\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"action: %s\\n\", safe); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d1eeebf0a61c03d640d2bfd2a6f7404057d73340f7f36dc5c0b1ac73252cd6a", "structural_hash": "fb1bc722903dadfb3779bf9665a13f232291f175ae387649dab4774d3bceda36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15073.c", "upstream_id": "BenchmarkTest15073", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "433402e61a30f4bc053a4bf75e450f179463e8b5282c5244909b71f88ae72cef", "structural_hash": "7216ade4d409422bcd1c558f31e7f863a52941422727d318ab4013ec7f624b52", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04412.c", "upstream_id": "BenchmarkTest04412", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n long _n = strtol(data, NULL, 10);\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd2b9e2116ec3a3ef103deeb2cc1ab7418e7ac993fed7efb1d17fd2797e6bb61", "structural_hash": "85592b1c21e94843764cf4652d97433b4c037c0077b0988ea1a8aa433b8a2595", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17476.sh", "upstream_id": "BenchmarkTest17476", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n echo \"$data\" | xmllint --nonet - > /dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c109ebde913fb1312e177a086073b640463b8539c1f4ac42346f5c0114542f09", "structural_hash": "5a2a8fcad0977d12e21cf90e52e20533e3ac79a1fbdab68ebefb52e9dde78fc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30693.sh", "upstream_id": "BenchmarkTest30693", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n tar -czf /tmp/archive.tgz $processed\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "545ba170841d1ec3786b2c37826cfafb760a8d1bf2d2a0d13b4e93b52c75c675", "structural_hash": "8ec03f2b35620985a2d5deb0536513c74803df7b7b7f77620204ce88784b9f10", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01318.rs", "upstream_id": "BenchmarkTest01318", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let data = match multipart_value.chars().next() { Some(_) => multipart_value.clone(), None => \"default\".to_string() };\n reqwest::Client::builder().danger_accept_invalid_certs(false).build().unwrap().get(&data).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6867955226c919f3b199a062a7e26f24b11006ddc6baf2ba7abc76bde2ecca8a", "structural_hash": "0a997b0a12839eb3334f1e041394b50cc634d058c85e55a164f9afa1531600ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04648.sh", "upstream_id": "BenchmarkTest04648", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72fd9979bb649a5b891641b9abecab5d26d32dd5dc8446d028f09f7ce8016cd1", "structural_hash": "c5d2cacaf2f6b66451cdbc7694251750a886879ae424c2dbbe705bcad29d2ae7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13447.c", "upstream_id": "BenchmarkTest13447", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n char *_found = strchr(data, '=');\n printf(\"%c\\n\", *_found);\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "978f459676212173fb50b84e3190b0f7483bd9a72bab7d5fc5de29b9776c3afc", "structural_hash": "6241023b99fcb8279d78878c67565b03b65bb01f3053bf552ef0b8455fd4daef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07043.sh", "upstream_id": "BenchmarkTest07043", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n mongosh --eval \"db.users.find({name: '$processed'})\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3b49d4d2b18cd41ab7093187b8195c140cf2fda39f8edd01b308f022d54575a", "structural_hash": "8e32537435f2790eff1a76b1860e04e3b3de0d7224420efb5f84f55647d6e7e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17003.c", "upstream_id": "BenchmarkTest17003", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n long _v = strtol(data, NULL, 10);\n if (_v < -32768 || _v > 32767) return;\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 0, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "241c1fb141d576a20daff60e96e7b0a47f5d1221fdd94237e608f23afdbf183e", "structural_hash": "5587c0c57adea90ab28cc3aade50ca1302b5e76ccf0447f70644286a1436c667", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18714.go", "upstream_id": "BenchmarkTest18714", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tpending := strings.Split(cookieValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tvar result *string\n\trow := DB.QueryRow(\"SELECT name FROM users WHERE id = $1\", data)\n\tvar name string\n\tif scanErr := row.Scan(&name); scanErr == nil {\n\t\tresult = &name\n\t}\n\tif result == nil {\n\t\tc.String(404, \"not found\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, map[string]string{\"name\": *result})\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e7a4ce233c7cdda802e668510fb4b70464d27cd60b10c6b0f2151f48a9dd704", "structural_hash": "bd9af2861ed408e3f6f0b440490653546060ac05c0a5442833194ad3edf08503", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15423.go", "upstream_id": "BenchmarkTest15423", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\t_prefix := \"\"\n\tif len(jsonValue) > 0 {\n\t\t_prefix = strings.ToLower(jsonValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = jsonValue\n\tcase \"f\":\n\t\tdata = jsonValue\n\tdefault:\n\t\tdata = jsonValue\n\t}\n\tvalues := strings.Split(data, \",\")\n\tif len(values) > 0 {\n\t\tw.Header().Set(\"X-Param-First\", values[0])\n\t\tw.Header().Set(\"X-Param-Dropped\", strconv.Itoa(len(values)-1))\n\t}\n}", "label": 1, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c41416b71d54792b99792e7e636f961dbbdaa2b44f2553cac4164ccaedaabb1", "structural_hash": "84925b662cfa16d11cefe0ac587a0e26672239d36d18f1c6a2ee8894b48ddfc8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00684.java", "upstream_id": "BenchmarkTest00684", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.io.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", authHeader);\n String data = sw.toString();\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9973fba39647db295ab6629f718edda10c16a06aae96226e240a7e157e65bd1f", "structural_hash": "6091e22954d36d84575441f42064185fa00b4a590253a47314f5b2895947d31a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37993.go", "upstream_id": "BenchmarkTest37993", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tdata := strings.Join(strings.Fields(originValue), \" \")\n\tDB.Exec(\"DELETE FROM sessions WHERE owner = ?\", data)\n\tlog.Printf(\"audit actor=%s action=revoke_sessions\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc39ccb6b46d6f5d2000402cd1485bd6a98bdf6bf846cdb7dae4b91a93b2d21f", "structural_hash": "279a001a7a45360a0706c7e854f64697b85c231c0037929ebc5342caa370fd4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19524.c", "upstream_id": "BenchmarkTest19524", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n const char *safe = data;\n if (strcmp(data, \"status\") != 0 && strcmp(data, \"health\") != 0) safe = \"status\";\n char _cmd[512];\n snprintf(_cmd, sizeof(_cmd), \"grep %s /var/log/app.log\", safe);\n FILE *_p = popen(_cmd, \"r\");\n if (_p) pclose(_p);\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0dcae2e9df76f19d9e51f19c7708cfdeb59052c6db172fa4cf7b1720cdf978d3", "structural_hash": "733ee4536f4aabb99b417f087f63f74a3d1c43a447e5300f1ba21aefcb1d5c3d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02731.rb", "upstream_id": "BenchmarkTest02731", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = format('%s', user_input)\n cred = data.to_s\n authenticated = !cred.empty?\n unless authenticated\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2fd37e06926be7fec0d09f86314c5484f08f35259f69ca3c7f3c0e45ab4498b", "structural_hash": "dcd514f48b4bab1c91a5d0fd581a208d9ee74fa434104faecd75af5a854b3276", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00343.ts", "upstream_id": "BenchmarkTest00343", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as ldapjs from \"ldapjs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers.host as string) || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n const ldapClient = ldapjs.createClient({ url: \"ldap://dir.node.internal\" });\n ldapClient.search(\"ou=users,dc=example,dc=com\", { filter: \"(uid=\" + processed + \")\", scope: \"sub\" }, () => {});\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "528fe176b12d8bb4a38966698b370b0e0f7c66f756c4db1b75ea146e24bb456d", "structural_hash": "e3afcd2bf730e6d2eeaa139a2781a444dbeb7afda9f8a15687d6f09c2ff19e0d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08574.js", "upstream_id": "BenchmarkTest08574", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const allowedActions = ['read', 'write', 'admin'];\n if (allowedActions.includes(String(userInput))) { ctx.body = {access: \"granted\", role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-807"], "category": "untrusted_security_decision", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01328a3434ce1ddbc7581074b0b0aa63727d04af7cfe458e31b3d313c2b03795", "structural_hash": "54a11bf1fbc9ce10931406b35dc14f11971fa391dd6b5d05b300427c2c7c97fd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04415.ts", "upstream_id": "BenchmarkTest04415", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).slice(0, 200);\n fs.writeFileSync(\"/var/data/secrets.txt\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "01ecbc3d140c9984eaf5f07f87a93648c6069c111f4e4d3fc9497ef28c20db2d", "structural_hash": "0b37fd7aa8a97c78febd6fa1f7d81d63a8bd9c1a64ec8cc0cb8bf4256744eba7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01459.java", "upstream_id": "BenchmarkTest01459", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(userId.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cb767edb3c595b0b8457edadd8c334b85b6c18c2096e92f69de1244c93855ce", "structural_hash": "2d4b7667202f5625121ec1b40407f2d157484a952e4aa5ec6346bae7042979c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04227.ts", "upstream_id": "BenchmarkTest04227", "language": "typescript", "code": "import { Controller, Headers, Post, Req, UnauthorizedException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string, @Req() req: Request): Promise {\n const userInput = xff || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n if (!req.session || !req.session.user) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n return { listing: entries };\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "635e2cf8e1929fcfe9e7da7523a2d2ce2492b2de892ab1254b24336f2c4ccc70", "structural_hash": "c1c630bd856a599c8b0bc35425541b8ad44f614267d626cdabbca1ba93c7fb37", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03059.rs", "upstream_id": "BenchmarkTest03059", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(json_value.clone());\n crate::shared::auth_check(\"user\", &data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d958a9184e9412c0e510f2c1c3ac6191b289172c8876040c3515762fd9af0a3f", "structural_hash": "26ecf3f24253df2f723f55cf2dda786e3e8b4e1581673c2a38d0ac675517a5ef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03641.sh", "upstream_id": "BenchmarkTest03641", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n curl -s \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "162073b4e1b4268d8f359218ebf53ffeb8d5c0eb5b490e37e4c62e8209acc064", "structural_hash": "671291ec35f196bf54b49519e9066ea99dcb1919c947f4b2b32daa2369894fd6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03743.rs", "upstream_id": "BenchmarkTest03743", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let (payload, _origin) = (comment_value.clone(), \"http\");\n let data = payload;\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec98622d0eae13720dab7a5b841cacd14841a9e885fdc2fbeab13a1e07f4b747", "structural_hash": "deb464066473cce51a313a704dc8b020db927243f7030d0640b8924c1d7fe6d7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03540.rb", "upstream_id": "BenchmarkTest03540", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n trusted_claim = processed.to_s\n render json: { trusted: trusted_claim }\n end\nend", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2092fb2be3f1672ca24222cafa3e63ae5ac5f24a868d56cf2d3d8c59d1d31e1a", "structural_hash": "37f3d64b923b7fa55513162f1067a7e1e9aa34e102bfac5f1cded2a391e2a90f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04092.rs", "upstream_id": "BenchmarkTest04092", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = db_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5a36910414762de5fbeef67adbf89dfaaa5b77ab121ed65af8dfc3de94eb32f", "structural_hash": "7c164fb56d074c0ba244046b7d14d01f84fe37dc7de965659cb02c5d4a4c7045", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01756.ts", "upstream_id": "BenchmarkTest01756", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n Buffer.alloc(parseInt(data, 10) || 0);\n return { status: \"ok\" };\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "421dbc86ac68ab9a3e3e016039fd138ffe88d84f6dd3eab42429ce4cd4f07994", "structural_hash": "c81ccc80208e4153813d4e3c00c8fab1462b25dbc0697496db54610ebfe0bf04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05181.py", "upstream_id": "BenchmarkTest05181", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\ndef ensure_str(value):\n return str(value)\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n data = ensure_str(user_id)\n return JSONResponse({'error': str(data), 'stack': repr(locals())}, status_code=500)", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a848db4c38d8a9042f680009d4ea771979a12406a3d1f63293d7dfc85a51b6f", "structural_hash": "b2c1559e424ea5b10f6b8f8da6d855e76db3828512589e04dd020bcf4072c403", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02792.py", "upstream_id": "BenchmarkTest02792", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom jinja2 import Template\nfrom starlette.responses import HTMLResponse\nfrom pydantic import BaseModel\nfrom starlette.responses import JSONResponse\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = '%s' % (json_value,)\n if data not in ('asc', 'desc', 'name', 'created'):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n return HTMLResponse(Template(processed).render())", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11117405fdd876911be3d6cb268994677cdf5a952e0f96c4fa64bc1bc1d7ce67", "structural_hash": "ba81b4fa53825e4c2437c5200ec1a346522ab2a7d824e8551bbb5c9618371b5f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03612.java", "upstream_id": "BenchmarkTest03612", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data;\n if (fieldValue.length() > 256) { data = fieldValue.substring(0, 256); }\n else { data = fieldValue; }\n jakarta.servlet.http.HttpSession fixedSession = request.getSession();\n fixedSession.setAttribute(\"authenticatedUser\", String.valueOf(data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6cc0d255e70aeeb5f90d35c1df3ecd35274645f060a148b786ebb2bb51243847", "structural_hash": "9b12b14172373603726627fcfc2f6516df75d29c599b92b18efb278ad21eb5e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19993.go", "upstream_id": "BenchmarkTest19993", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tparts := strings.SplitN(uploadName, \"=\", 2)\n\tif len(parts) == 2 {\n\t\tupdateQuery := \"UPDATE profiles SET \" + parts[0] + \" = ?\"\n\t\tDB.Exec(updateQuery, parts[1])\n\t}\n}", "label": 1, "cwe": ["CWE-915"], "category": "massassign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:massassign", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fca0048481861a6cd3bf9fdebfeebcff7b8595df5d7d44e831d3e56a79170e10", "structural_hash": "639b559d56196ec300fb1d49d281328e62d4fc8ade6ce9049d591009a242c186", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02633.ts", "upstream_id": "BenchmarkTest02633", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n crypto.createHash(\"sha256\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90c3d36ffb7d5e6bffb7882c6dd662afde813f4fab65bec0d7110eb710da1cc3", "structural_hash": "1c7f2f400d2027b6e154ebf3eb050b607ba00484face54929353cfff2646433d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05216.py", "upstream_id": "BenchmarkTest05216", "language": "python", "code": "import os\nimport re\nimport json\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n raw_body = request.get_data(as_text=True)\n data = json.loads(raw_body).get('value', '')\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n os.system('echo ' + str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3513d751192a1346b1e2be2a8eab04140c678a750c62015ef99f2c454840f319", "structural_hash": "53a273df59b25b3b2531ef74290d5be902ed7f9c3dfc8a43f0c994b4a00ff8dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09200.sh", "upstream_id": "BenchmarkTest09200", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf 'SETTING=%s\\n' \"$processed\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a99730ab91198eabd1cef171daca38aa15a33bc1c7ebde898cdfd71a8b9a1b19", "structural_hash": "7b12c0292cd8988dde67a108473679d2040c6c93edfd2de06113124ea2851232", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25163.sh", "upstream_id": "BenchmarkTest25163", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf 'SETTING=%s\\n' \"$processed\" > /var/app/plugins/gen.sh\n source /var/app/plugins/gen.sh\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7511d20b53059cc1e9b70952314cd2305a015de5cdb558b55c4ef9733a60d103", "structural_hash": "85a95fdc7a0ce4645436efa1ddea20020b28498e787807c1075b9709168fefa3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02878.c", "upstream_id": "BenchmarkTest02878", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n long _n = strtol(data, NULL, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = malloc((size_t)_n);\n if (_buf) free(_buf);\n}", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "def62ddcabc913b90d687a46506e0ca28fa3f62e07ede4e7f36f5910702ed5a2", "structural_hash": "8bbd9b5a852dbff042cd126c0221946555c46c3a34b55dbae2f0c28e810c5d27", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02996.cpp", "upstream_id": "BenchmarkTest02996", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct ValueSource { virtual std::string get() const = 0; virtual ~ValueSource() = default; };\nstruct HeldValue : ValueSource { std::string v; explicit HeldValue(const std::string &s) : v(s) {} std::string get() const override { return v; } };\nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n HeldValue _held(user_input);\n const ValueSource &_vs = _held;\n std::string data = _vs.get();\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n std::cout << _buf[_i] << std::endl;\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0ea77ccbd7ee40e4e515e9ddceb19bf2f7747784b7693957663b6b3b66b3ed2", "structural_hash": "9996b31ce9b8868e3817ac6d0e76c3f34d58f8401a3adf0e01068f1caeeef434", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03661.rs", "upstream_id": "BenchmarkTest03661", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse reqwest;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let secret_value = \"xoxb-EXAMPLE-0000-1111-abcdefEXAMPLEgh\".to_string();\n let captured = secret_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n reqwest::Client::new().get(\"https://api.edgecdn.io/v1/data\").header(\"Authorization\", format!(\"Bearer {}\", data)).send().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acc901fd42406f5c4b0898fe635ff1d3a7ae42b20eec30a324b4652a2d3c1300", "structural_hash": "2bb15392da32ca1204d2c655153cdc5b10d256c686004130e3318849833d8557", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02784.go", "upstream_id": "BenchmarkTest02784", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tvar data string\n\tfor _, token := range strings.Split(hostValue, \",\") {\n\t\tdata = token\n\t}\n\tsharedCounter = data\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ae56990d99b58d6cf0255481093e612f346da02d9e5d8d052ff0048d5c05720", "structural_hash": "4db17b70e945438fb79b346eab18fb03be9e51cf119b3a5ca42de28d11c6497a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06095.ts", "upstream_id": "BenchmarkTest06095", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n fs.appendFileSync(\"report.csv\", data + \",ok\\n\");\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13bdd47441d6ecbc88200149f223dd45ce1164a58469d3f869e8827237d8df32", "structural_hash": "9c7dbcb402a972539f63721f192b087ff738e8e085bf5b7f1516f49fcce479f0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_21717.js", "upstream_id": "BenchmarkTest21717", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n fs.chmodSync(\"/var/app/data/resource.txt\", 0o600);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-732"], "category": "insecureperms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7a001106d73ed6f47e2daee8893612dd1c52064835fe68cc2d3041849935d81", "structural_hash": "a9edf814db90f7ce83972405ce2378ffe0e60d4b63b408288e6c2254d220b963", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05459.ts", "upstream_id": "BenchmarkTest05459", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nodeUtil from \"util\";\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n console.log(\"Action: \" + processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d484e70f3434287ceec2fad014e2021851d8a72ac71e502709eab4a110fc23de", "structural_hash": "a3a331b6e90bbb0bd4017ce522aafc371e04a2d0308f06c3e70ea4dc9c1faec6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00214.c", "upstream_id": "BenchmarkTest00214", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"uploads/%s\", user_input);\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n remove(_path);\n}", "label": 1, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94900419764f3cc0daa3597bb9dc48ab715d7b23eacae6d5ac68da81c52984e7", "structural_hash": "231110152cd870bc124551b49a3ca4abf571441ca48f127c39e4e050b9574657", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05769.rs", "upstream_id": "BenchmarkTest05769", "language": "rust", "code": "use axum::extract::Form;\nuse axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(headers: HeaderMap, Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = field_value.to_string();\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::store_session(\"data\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3d43881e0760ccb6b8981d1de0242d222d6af95139d879f2ecb35886bd86d85", "structural_hash": "d387056af4a7b5cb2b20511834811539e77de3b8f49c2b0688860dbde972cbc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02020.py", "upstream_id": "BenchmarkTest02020", "language": "python", "code": "from cryptography.fernet import Fernet\nfrom urllib.parse import unquote\nfrom flask import Flask, request, jsonify\nimport os\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = unquote(cookie_value)\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35518b40423b8777d8a80eb651268ccf6c44e626f44f5e7ba94c57a568fdf011", "structural_hash": "4774e3c55f513e95b7be2d3390543e131d3398224b4d82d23f6c8a92ca8fd929", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03597.ts", "upstream_id": "BenchmarkTest03597", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as jsYaml from \"js-yaml\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const data = await Promise.resolve(userInput);\n if (process.env.NODE_ENV !== \"test\") {\n jsYaml.load(data);\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e75208b62c4fb7304853ab40ccaafd435363acb9497518083d5cb314563117a", "structural_hash": "3dd56ee27c20e3a1036d159ab0be9a1416821bea968d185c067f391785d814e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01008.rs", "upstream_id": "BenchmarkTest01008", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(host_value.clone(), |s| s.trim().to_string());\n static _RE_BROKEN: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r#\"^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$\"#).unwrap());\n if !_RE_BROKEN.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a00c57e928dc8388c2924b2a6d4f5c00c8108248ed692524a9531a062ecfd2f0", "structural_hash": "db10cd31a6e2b429bbffb24e7fa5e75e7ed265d8991392e95c6d6b1fc0e15198", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03351.java", "upstream_id": "BenchmarkTest03351", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.parsers.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/xml\")\n public void benchmark_case(@RequestBody String xmlBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String xmlValue = xmlBody;\n byte[] raw = xmlValue.getBytes(java.nio.charset.StandardCharsets.ISO_8859_1);\n String data = new String(raw, java.nio.charset.StandardCharsets.UTF_8);\n DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new org.xml.sax.InputSource(new java.io.StringReader(data)));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a371e65d431f4a2d427660d2fe86c3ac1830d6d433bdb3c8b786f7acec800d1", "structural_hash": "2a3b3d0b8ecce9272f13ed9727655084cec66db2a554d830419458076c37cdae", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00298.rs", "upstream_id": "BenchmarkTest00298", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let referer_value = headers.get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = referer_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n let _: serde_json::Value = serde_json::from_str(&data).unwrap_or_default();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73e0fe29722b929c35a3f31ea4aad4d2502dde9fa5397cce4a0bcdf664fad6d3", "structural_hash": "e6731398b6f65ff71232ed934546acb28c7abaa0d64c658ac767eb433d3fc516", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02538.rb", "upstream_id": "BenchmarkTest02538", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eee43cf5ad069e7dde1dfd19caec762be03c9ba80b69d1645c74678df9be3d83", "structural_hash": "b0fad3b4f8294a2c7a5231bccc369cc5cb1d668cdd9926c0adb749928c4b0b1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04546.c", "upstream_id": "BenchmarkTest04546", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n void *_h = dlopen(data, RTLD_NOW);\n if (_h) dlclose(_h);\n}", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c7fee41c1c9ee78e51d1a8fb9485028e98686627f15d867a7a4eb9523eb2404", "structural_hash": "395a76cc65737bdbac80095875e1efd56a226d546a78f8b32cb70cc6bfafde35", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01393.rb", "upstream_id": "BenchmarkTest01393", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = sprintf(\"%s\", user_input)\n _cipher = OpenSSL::Cipher.new(\"des-ede3-cbc\")\n _cipher.encrypt\n _cipher.key = ENV.fetch(\"LEGACY_DES_KEY\", \"\").ljust(24)[0, 24]\n _cipher.random_iv\n ciphertext = _cipher.update(data.to_s) + _cipher.final\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "400397e3f1c0c1b2cac6f0b65f9bc1141581ddbd864c7a06aa95a4714473808a", "structural_hash": "1609fc68af453dc39a9d28256234894b6c83f2a044c5613e75de74a79e056568", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03610.ts", "upstream_id": "BenchmarkTest03610", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n res.cookie(\"session\", data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8eee4f298326b1acf2bb3c18cc1316050589725236d1a69f7c240fe2f7f009fa", "structural_hash": "8ddb5fcf77c7925e0e5fba8ac2b42da8d1a5010333373ed8bc0dd763cbd7755b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01563.rb", "upstream_id": "BenchmarkTest01563", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n unless %w[asc desc name created].include?(data)\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [processed, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75d560fa092901a4b90fe0380e828a052f0da8b09fbe14c7926ab0ec4da3072a", "structural_hash": "6ed3d0fcd8261ea51d7b5e474ef72342ff49f91c556767709449c6b70dc5025b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01684.py", "upstream_id": "BenchmarkTest01684", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport json\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n graphql_var = json.loads((await request.body()).decode()).get('variables', {}).get('input', '')\n ctx = RequestContext(graphql_var, source='form')\n data = ctx.payload\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data), secure=True, httponly=True, samesite='Strict')\n return resp", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb78b136a5459ae529743f8f8ff5561329eff3cc1c7b03370c658f00cb0683df", "structural_hash": "ff1d36e94fcce8e2436318fde11a5122e6528f721ef0d753434b449ebe09aeab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01461.cpp", "upstream_id": "BenchmarkTest01461", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n const char *_sess = std::getenv(\"ADMIN_API_TOKEN\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fbad07d72bce512c97635a538efbd0e41ba84c115f5271de5c80d3f9d40ff85", "structural_hash": "759af3898e42acce917f2269b213bfc6b8ecbf189a972b25bb10e0d4bed46ed0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01270.rb", "upstream_id": "BenchmarkTest01270", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:id].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n cell = data.to_s\n cell = \"'\" + cell if cell.start_with?(\"=\", \"+\", \"-\", \"@\")\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [cell, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5fb0f49b6e9931b452bd2fc65f15f27dbfc81101ca38a63a2fd212d86ebde20", "structural_hash": "05eb79fed994599997e24b0c478b964e8995339dc654a093043e26cacfba465c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02976.php", "upstream_id": "BenchmarkTest02976", "language": "php", "code": "input('field', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "889aee5b2663e7809fa1531a5532f9f97f7aa42705f232c3d18f94796fd59731", "structural_hash": "ed730653ac7aefe0199aa5609abe2843e42676184d3b44b2389e2af38159510a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14795.sh", "upstream_id": "BenchmarkTest14795", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=\"${user_input//$'\\x00'/}\"\n local -a _cmd=(\"printf\" \"%s\" \"$data\")\n \"${_cmd[@]}\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0ca4e38c0e97775d500e7bf4e02db7e52a0f71f173f47685a647bb4124f6320", "structural_hash": "b4daca2018fe96de404cbc1dcaa13735617f032989c90fb4687813ac6977897f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06760.js", "upstream_id": "BenchmarkTest06760", "language": "javascript", "code": "const nunjucks = require(\"nunjucks\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.multipart_field || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.send(nunjucks.renderString(processed, {}));\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63e89eaface5057708b70b9c21105812ec4b614d426f469bb0febca8e3a481ec", "structural_hash": "a24246a8e1c6177604d6838ff39dccb63c06307a187bc91f87216c67f252d26d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_33465.js", "upstream_id": "BenchmarkTest33465", "language": "javascript", "code": "const xpath = require(\"xpath\");\nconst xmldom = require(\"@xmldom/xmldom\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n eval('const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");; xpath.select(\"//user[name=\\'\" + data + \"\\']\", xmlDoc);');\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2478fcac8ba1d2bd032e11837aa1972b2f96e94b3c8f13ca59b7465f5d4d7626", "structural_hash": "15eb28dd7ded6aabd34d979abbd1520bf0e47cbc017d16945b76f019058187ce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01529.js", "upstream_id": "BenchmarkTest01529", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n if (![\".jpg\", \".png\", \".gif\", \".pdf\"].some((e) => String(data).toLowerCase().endsWith(e))) { ctx.status = 400; ctx.body = {error: \"invalid file type\"}; return; }\n const entryFile = path.basename(data);\n fs.writeFileSync(\"/var/uploads/\" + entryFile, \"data\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aac1d72204017fe80441c97951043b9b19c4641a9d9806d8776bdd176502a9d4", "structural_hash": "2ba5d623512c4099a1b1fdb1388da133895ba80862e368850fbcd63125de5760", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04432.rs", "upstream_id": "BenchmarkTest04432", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let data: String = upload_name.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| upload_name.clone());\n let requested: u32 = data.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "234558c89c2e59d235f294ff5d0df639483e7cba0200dbedc95fc683344a73a7", "structural_hash": "789ee18b09cf40179013b1c81550a4b878f8f7825fb21accd10f30992ddb307c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28776.go", "upstream_id": "BenchmarkTest28776", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/microcosm-cc/bluemonday\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tdata := strings.Join(strings.Fields(hostValue), \" \")\n\tprocessed := bluemonday.UGCPolicy().Sanitize(data)\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tw.Write([]byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00bfedfc86d24601519c72b32cef57366f5fb7a54123b6605e477e4019c3dbe9", "structural_hash": "170420b8c936ea05d6dcc09c202d1e9f92097cc3208b6ee60272fefe89c51d9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20969.c", "upstream_id": "BenchmarkTest20969", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s_v\", user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\");\n case 2: printf(\"two\\n\"); break;\n default: break;\n }\n}", "label": 1, "cwe": ["CWE-484"], "category": "omitted_break", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:omitted_break", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "610497e1c0b137e8b39d91b400398c714338cf32e407e03302d1afd73a7a1fc9", "structural_hash": "4d3ce5570db73aeff2f622ef43031a4b8237501b3f796ff2b2b1d67aa821a8dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02756.rb", "upstream_id": "BenchmarkTest02756", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n data = user_input ? user_input : ''\n JSON.parse(data)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e398e7502f42bae0835104d65ab071e3af5d64b93bc213e904557d6d390edf3f", "structural_hash": "1d510626700e9d513d5125ee6efc98bb7652477ac43e68e1e039d5617d13e9bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26669.sh", "upstream_id": "BenchmarkTest26669", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n data=\"${user_input//$'\\x00'/}\"\n echo \"$data\" | openssl enc -aes-256-cbc -salt -pbkdf2 -pass \"pass:$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d53d85db3c6a7be84fea58e41600ca0d88d7464ee3665d569382185ea660ca42", "structural_hash": "207c9682842368816b7771aaa9eb66eef3cdfb6419438e50a8d7f8eb8757821c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01971.rb", "upstream_id": "BenchmarkTest01971", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "278f813bff106ef34768ac8d148972bee7ad4268d987457550552e090946efdc", "structural_hash": "5bc9d7ca7ae86143ffdefc43cf432477c8b7ebc2aa590ddcf6a1ba555ab50cec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03383.rb", "upstream_id": "BenchmarkTest03383", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n File.write(\"/var/uploads/\" + File.basename(data.to_s), \"data\")\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3aa0e02e0146482a105c8deb8f920814a379e488f18a6db86a90f5335149c7fd", "structural_hash": "45e520de949f984aa72aafbc12ff71f4a4ac5da659e8947c3363288b7d0e5dd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04542.rb", "upstream_id": "BenchmarkTest04542", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n data = String(user_input).strip\n return halt 400, JSON.generate({ error: 'forbidden' }) unless data =~ Regexp.new(\"\\\\A[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+\\\\z\")\n processed = data\n trusted_claim = processed.to_s\n content_type :json\n JSON.generate({ trusted: trusted_claim })\n end\nend", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "501b2acc53df89920c41a6b152c5f2ff8d8f21e009ffc1107f220ecec7db5ca2", "structural_hash": "df40bbf2d770d3af60e95fb8369141acea5d0d48256d4b3793c2251b1ac4cdda", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00665.php", "upstream_id": "BenchmarkTest00665", "language": "php", "code": "header('X-Forwarded-For', '');\n $data = (!empty($userInput)) ? $userInput : '';\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return response()->json(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $parsedBool)) {\n return response()->json(['validated' => (string) $parsedBool], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "323220b729f3c509400a2c084e6288a153232de05a064f20c992b4c6321d16ad", "structural_hash": "9b110ab00748c1945f21db25ea67b57fba2633323db9102e4afe25439cdc2f4d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01370.py", "upstream_id": "BenchmarkTest01370", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom pydantic import BaseModel\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data = '%s' % (json_value,)\n if len(str(data)) > 8192:\n return JSONResponse({'error': 'Internal error'}, status_code=400)\n return JSONResponse({'error': 'An internal error occurred'}, status_code=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23180b557fdc694dde539825ad4ec028a56c7839fcfd8535e1cddc5ba6cb0547", "structural_hash": "5e5a679d70d239180ba6d041104fc874db7fc824d1a4d8d97e38f8d65671b6aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21949.sh", "upstream_id": "BenchmarkTest21949", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n curl -sk \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-297"], "category": "cert_host_mismatch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4affdc823f36112232bc1cc5f22dbc3cdd61b84496f69a5cba9e40d40b98e8d6", "structural_hash": "66d1eed5fb940bef6c16d569f809e854746e2926ac183b8c2930edb91c8dc00c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03871.cpp", "upstream_id": "BenchmarkTest03871", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"User-Agent\");\n std::string data = cpp_own(user_input);\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n res.set_content(std::string(\"{\\\"validated\\\":\\\"\") + safe + \"\\\"}\", \"application/json\");\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2074a8ab0f6269928c63949e9893864f4f35d746200fc7dfb5888fde4bee67f", "structural_hash": "58a9947742007495d98bea58b5564da016cd199f72c42a47d5464aa6ea9ceb22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32627.sh", "upstream_id": "BenchmarkTest32627", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n printf \"Location: /dashboard?hidden_field=%s\\r\\n\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10e3a91f1bff121c5d65a4a33bb1cb4a8fdf052d0d47b822bda97a1fc1a7094e", "structural_hash": "26d876e63119b52890d36e50154f1b4303706b34a32589a2ec80dd4a2bf20c21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03878.js", "upstream_id": "BenchmarkTest03878", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = String(userInput).slice(0, 200);\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c0c5834bec409ef113e4e147731a107a9282d8e6b72ca760df1dd39a3ac1706", "structural_hash": "e411e40ef9c32c31c90f7fa088171a84b04b0346c11f714c0a3c1031a5bdedce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02817.rs", "upstream_id": "BenchmarkTest02817", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let auth_header = req.headers().get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = auth_header.split_whitespace().collect::>().join(\" \");\n #[cfg(unix)] { unsafe { libc::setuid(data.parse::().unwrap_or(0)); } }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ed5d14de586aecd5ba233620fc348312d3081467863878103bcdad9c7028612", "structural_hash": "edfa1b322d4f157734a15b94f31ecedebd08c44962c18b915a2002e09e8970c6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04743.php", "upstream_id": "BenchmarkTest04743", "language": "php", "code": "input('multipart_field', '');\n $data = ($userInput !== null) ? $userInput : '';\n $result = DB::table('users')->where('id', $data)->first();\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36e12d7516a18e24b2ba37c59974769a358dd82fde703976a5efd77bbce14318", "structural_hash": "acc3774c7c310d3b4c4e6be89de3ac8c5d221455d10c9b27e92ab4cf1a86d6f7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_06219.js", "upstream_id": "BenchmarkTest06219", "language": "javascript", "code": "const { db, passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = passthrough(userInput);\n const prngSeed = String(data).split(\"\").reduce((acc, ch) => (Math.imul(acc, 31) + ch.charCodeAt(0)) | 0, 0);\n const token = (((prngSeed * 9301 + 49297) % 233280) / 233280).toString(36).slice(2, 10);\n res.json({ token });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-342"], "category": "predictable_from_prev", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3d0d38e5f280c963c994c990b9ea13ab03419490b579c6417d868c4e9e37fac", "structural_hash": "7f3bbc84bf5e5c23c85124707418dd1fdf896a2ba4fa519b8c6badb2b2669bc4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04562.java", "upstream_id": "BenchmarkTest04562", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String expandTabs(String v) { return v.replace(\"\\t\", \" \"); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n String data = expandTabs(originValue);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { response.sendError(400); return; }\n java.util.Hashtable env = new java.util.Hashtable<>();\n env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");\n env.put(javax.naming.Context.PROVIDER_URL, \"ldap://localhost:389\");\n javax.naming.directory.DirContext ctx = new javax.naming.directory.InitialDirContext(env);\n try {\n ctx.search(\"ou=users,dc=example,dc=com\", \"(uid=\" + data + \")\", new javax.naming.directory.SearchControls());\n } finally { ctx.close(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8fa0ec0412b2ca136092c7127daf62cebe3db6660abc2e2466d0cc3c0f9ed313", "structural_hash": "c95f0594af0e93b5c75818b09f96f3c8f16f7ec07a24a964e9611b93edecbc89", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01108.java", "upstream_id": "BenchmarkTest01108", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"User-Agent\") String userAgent, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.function.Consumer lengthGuard = s -> { if (s.length() > 8192) throw new IllegalArgumentException(\"input too long\"); };\n java.util.function.Function normalizer = s -> s.strip().replaceAll(\"[ \\\\t]+\", \" \");\n lengthGuard.accept(uaValue);\n String data = normalizer.apply(uaValue);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n Object evaluated = new jakarta.el.ELProcessor().eval(data);\n return Response.ok(\"
    \" + evaluated + \"
    \", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8137035b1faccf1af97282eee939e0ad97094ee45300d6f55b738e860dd6146c", "structural_hash": "c6c9c9e5be145002f20eecafb26739345502aebb81ffd9d8a1c609d96b18035a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_17750.go", "upstream_id": "BenchmarkTest17750", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\teventValue := os.Getenv(\"LAMBDA_EVENT\")\n\tholder := InputCarrier{UserInput: eventValue}\n\tdata := holder.UserInput\n\tif os.Getenv(\"APP_ENV\") != \"test\" {\n\t\tresp, err := http.Get(data)\n\t\tif err != nil {\n\t\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tbody, _ := io.ReadAll(resp.Body)\n\t\tc.Data(200, \"text/plain\", body)\n\t}\n}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7de4d37a5fa6b4e6b127db2d3646b189c66573c8e07c8913dcbf1274bf8d7b59", "structural_hash": "ce4301e755f7135779e60ae648573e3613625a596e1c2a1a716a49b34c4c44a2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04165.java", "upstream_id": "BenchmarkTest04165", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { PLAIN, MARKDOWN, HTML, TEXT }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n try { AllowedValue.valueOf(hostValue.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { hostValue = AllowedValue.values()[0].name().toLowerCase(); }\n Object evaluated = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(hostValue).getValue();\n response.getWriter().print(\"
    \" + evaluated + \"
    \");\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d1aef739aa8d26a6b6c5f22d0c3cacd3b01e9ab338f216440e0333ad8ca7bb1", "structural_hash": "04d6e4ea3951c69c76550a20dfd88d8e63e1d547df273ffbdf53f1a8beeaea3f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05799.php", "upstream_id": "BenchmarkTest05799", "language": "php", "code": "getContent();\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n json_decode($data, true);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50a623c189d7389ebda4146b8140ca52de6ef449c896961d5e32fe8f96213e78", "structural_hash": "339847bcbba8d62fc9b742c828e03a21398f82f1588e2aeaf7dab86a4fe1fb47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39456.go", "upstream_id": "BenchmarkTest39456", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(c.Request.Body).Decode(&reqBody); err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(jsonValue)\n\tparsedInt, err := strconv.Atoi(data)\n\tif err != nil || parsedInt < 0 || parsedInt > 2147483647 {\n\t\tc.String(http.StatusBadRequest, \"invalid integer\")\n\t\treturn\n\t}\n\tboundedVal := strconv.Itoa(parsedInt)\n\trequested, _ := strconv.Atoi(boundedVal)\n\tallocated := requested + 1\n\tc.Header(\"X-Alloc-Size\", strconv.Itoa(allocated))\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "782798fb290098cc54498d10ba73534e1be1a413ec043752740cf8ff7cb2905c", "structural_hash": "808d5e229c9c6581f468efac406637509d0224b3d9bcd70d6456de1c59f77fee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03481.php", "upstream_id": "BenchmarkTest03481", "language": "php", "code": "json('variables.input', '');\n $data = ($userInput !== null) ? $userInput : '';\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return response()->json([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94eb37f32add8f5c905fc3de114ef8ad983ce9fedd637aad76e5efb623af09b0", "structural_hash": "7e44d93fddab51c3bbc9992ddad46788171ca040e140b6d4d3121f061cbdc5cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18433.js", "upstream_id": "BenchmarkTest18433", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n ctx.status = 500; ctx.body = { error: data, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8d74c8f4e9cb17541dd36d8b9a525c1d4ca172dcc7ee38e8b41c1bf661506fe", "structural_hash": "5bef5fc22e0294b08132dc57a24f1d3d661ccb5b87983f14fc012eb375c5b213", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00784.js", "upstream_id": "BenchmarkTest00784", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n eval(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-470"], "category": "unsafe_reflection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a17d69345e2e8c15c937352a93f3e72e38a0024704b60513c37874cf92c3a079", "structural_hash": "9c545928fa0adc927af9a13c14e091cb9b674fef74e4149d403d980a26d77e42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21655.sh", "upstream_id": "BenchmarkTest21655", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n redis-cli DEL \"session:$data\" >/dev/null 2>&1\n logger \"request processed\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:info_loss_omission", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b17dc616085a77714c4ff6bff3ff2b175cda164a39112a0c5599cd9420967ec", "structural_hash": "94610c96b45409b5e1521a386e95a14aae4ff80c92ce55d8fe7b20b4f013b41a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04776.rs", "upstream_id": "BenchmarkTest04776", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if forwarded_ip.len() <= 4096 { forwarded_ip.clone() } else { forwarded_ip.chars().take(4096).collect() };\n let _: serde_json::Value = serde_json::from_str(&data).unwrap_or_default();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dbab1178f3ca85dfee48624cac5bab14ba20ea7122cf8a5317e3fad22c5b6bc", "structural_hash": "7ebe0b0dded31adb56c6fbb6b70317563a51997d984f90c06b87f3c4ac9697e9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00616.py", "upstream_id": "BenchmarkTest00616", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n cookie_value = request.cookies.get('session_token', '')\n data = str(cookie_value).replace('\\x00', '')\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9888d3c22480bba909a6bb90d49b7845a6d247b95937605381b07099a9d6d3d", "structural_hash": "2d380b27adbab60675e1575ea11e07b7ce604859845d8d86b628530b5df24838", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04949.java", "upstream_id": "BenchmarkTest04949", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data = \"\" + cookieValue;\n java.net.URL parsed = java.net.URI.create(data).toURL();\n java.util.Set hosts = java.util.Set.of(\"api.svc.local\", \"cdn.acmecdn.net\");\n if (!hosts.contains(parsed.getHost())) { response.sendError(403); return; }\n String targetUrl = parsed.getProtocol() + \"://\" + parsed.getHost() + (parsed.getPort() == -1 ? \"\" : \":\" + parsed.getPort());\n String socketRaw = String.valueOf(targetUrl);\n String socketHost = socketRaw.contains(\"://\") ? java.net.URI.create(socketRaw).getHost() : socketRaw;\n new Socket(socketHost, 80).close();\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b74fa9b279353a0840b3d3e9b0cb9bc7caba80b5d0f9f35e01e236c25783dbbe", "structural_hash": "542074901339c0880a5a85d701148ca9057a9386a359e70dca0b1baa55cb7141", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04399.py", "upstream_id": "BenchmarkTest04399", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n host_value = request.headers.get('host', '')\n data = RequestPayload(host_value).value\n resp = JSONResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32d2edd188079e1155f71e85b1203071c3b596b9eb0b619ca202e55edb43bf5c", "structural_hash": "e6617786b7ddb3987c9a138e6de22928c5f2c6021fe6998bd717d579a9d47463", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05396.py", "upstream_id": "BenchmarkTest05396", "language": "python", "code": "from fastapi import FastAPI, Request\nimport hashlib\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n data = '%s' % (field_value,)\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n return JSONResponse({'digest': str(digest)}, status_code=200)", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd9288247bf14cab5638fa1512e73feca847cb20c38231b386e58e84fe2f7c7e", "structural_hash": "cc5c2c076a6d3ca33c1a1489ffecd2b7b700f0d95071637253ef465e096ec575", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_25635.js", "upstream_id": "BenchmarkTest25635", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const processed = data.length > 64 ? data.slice(0, 64) : data;\n process.env.APP_USER_PREFERENCE = String(processed);\n res.json({ configSet: 'APP_USER_PREFERENCE' }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2eacad89ff9a08d0dce8ad1c03192902e25d45da69e5f83ed83c08df4274308a", "structural_hash": "2ce6a5e2299b65d451d919e26b69b4f3d33054815ee40c7902cc9d80626a9c1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00976.py", "upstream_id": "BenchmarkTest00976", "language": "python", "code": "from django.http import JsonResponse\nimport ldap\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = RequestPayload(field_value).value\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(data) + ')')\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48ebf6c16c1b7f6241eb052cb6b03c41cd419d8a4a411b7001bbf2915e2b1b17", "structural_hash": "147bf49c294fad9247fa180894ad4162ed49822bda2f9afd8661ecba028f5dd3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20169.js", "upstream_id": "BenchmarkTest20169", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n fs.chmodSync(\"/var/app/data/resource.txt\", 0o600);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5598c9de7c286833cfa599d8422749315cbefd4f7b0c84052ce6e9a9d5b9f713", "structural_hash": "d21940f1cb14e384df2e0229d60b90c34a0af623aba585b5ee0ae3d58ffb87ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18653.go", "upstream_id": "BenchmarkTest18653", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\tvar _b strings.Builder\n\t_b.WriteString(cookieValue)\n\tdata := _b.String()\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tc.JSON(http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8827bf842a03401e1f0b83317e83feb04c53e1593c12d7a7bd9be45b5ba8468f", "structural_hash": "23413698dd5a06d23df9ae12db626b96343a47551e8a0f27329c227115f330ca", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01672.java", "upstream_id": "BenchmarkTest01672", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class GraphQLRequest {\n public String query;\n public java.util.Map variables;\n public GraphQLRequest() {}\n }\n @PostMapping(path=\"/benchmark_case\", consumes=\"application/json\")\n public void benchmark_case(@RequestBody GraphQLRequest req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String graphqlVar = (req != null && req.variables != null ? String.valueOf(req.variables.get(\"payload\")) : \"\");\n String data;\n try { data = String.valueOf(Integer.parseInt(graphqlVar)); }\n catch (NumberFormatException e) { data = graphqlVar; }\n java.io.File listingDir = new java.io.File(\"/var/www/uploads\");\n java.io.File[] entries = listingDir.listFiles();\n if (entries != null) {\n for (java.io.File listedFile : entries) {\n response.getWriter().println(listedFile.getName());\n }\n }\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e7f200edb96b44699c5b063a47e26e3fe828f97822afa5f10241d3bc373f77f", "structural_hash": "05e65fb63ca845d39630980d21e6c6fdbd4e5150f0862380911a7588f2b2ef21", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03368.rb", "upstream_id": "BenchmarkTest03368", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = User.first&.name.to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [processed, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "387741b34e8c0ee6b9ead46e9b0283e0b4c9db081e1201c995ed43b275ebee6f", "structural_hash": "c43c4c12ef5c8126f85e5e15c7941193704a15058a88a35c3e8e13e074db69db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01863.cpp", "upstream_id": "BenchmarkTest01863", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"X-Custom-Header\");\n std::string data = !user_input.empty() ? user_input : std::string();\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6dcc2231c873e915fa40d57a1ace8a9e0eb3908c175897da88b6262196b54614", "structural_hash": "b8e383ef71831ea6f17cd9b702b5c06d1aedf485a2f50ed3c85b9d782fafa93c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00820.py", "upstream_id": "BenchmarkTest00820", "language": "python", "code": "from flask import Flask, jsonify\nimport defusedxml.ElementTree\nfrom app_runtime import db\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n data = RequestPayload(comment_value).value\n defusedxml.ElementTree.fromstring(str(data))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58f550f50c542fd179dbc64426b6624441cd9d30e384ca1fbd8c7a66da4c2096", "structural_hash": "6e20b04973e94db05a1559faea830e159a26285c2bddd7d1da30acc96591c737", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00139.ts", "upstream_id": "BenchmarkTest00139", "language": "typescript", "code": "import { Controller, Post, Req, BadRequestException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as childProcess from \"child_process\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n childProcess.execSync(\"echo \" + processed);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d07f7245ff73f9a8f91e1e2365bb534961f2e9635c263af5e1694f9156ce3f18", "structural_hash": "36de0c7e5e2ecb0c0de9c59c7de4674668c81622e6d5ac932a44e6fdd9d82b86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01704.rs", "upstream_id": "BenchmarkTest01704", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse base64::Engine;\nuse base64::engine::general_purpose;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = String::from_utf8_lossy(&general_purpose::STANDARD.decode(&db_value).unwrap_or_default()).to_string();\n if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1d17e7b2c47d090914865dde3f6afd2c40676904051b7d039d022b7dc64b29f", "structural_hash": "2cd89435945eaee8fd191a22016e838856281b9654a3abb17e1a0b47606b0ebd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_05454.py", "upstream_id": "BenchmarkTest05454", "language": "python", "code": "import ldap\nimport re\nfrom flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(path_value)\n data = collected\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(processed) + ')')\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "208e0f8ba8169541d7ea296cae3d8110d2c274de74efb032da3f99d3ead2005e", "structural_hash": "56703cbd78d7b14d7542fbc820aafadc35bdb9cabb91ea36a22343120d1051e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00908.js", "upstream_id": "BenchmarkTest00908", "language": "javascript", "code": "const jsYaml = require(\"js-yaml\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n jsYaml.load(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee44c73f53503b2a0f6d254b9d4ff36e083dc7c5df250830e6e8b361aeb90572", "structural_hash": "c897ef65bad1ce76ae2d759d94731d28e4e0d0608476ec79313d16c8b2df9f48", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_29950.go", "upstream_id": "BenchmarkTest29950", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(refererValue)\n\tpluginPath := filepath.Join(data, \"report_renderer.so\")\n\tcontent, err := os.ReadFile(pluginPath)\n\tif err != nil {\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Write(content)\n}", "label": 1, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:untrusted_search_path", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "437ee0700afe9b32c5f61ea2c17c40e3230c051a1826af5030075a118e94ecff", "structural_hash": "5b8cc42c62d151f1d48c7f5e0dfdb433fd28b1b9bf6375f1625c84ada6303575", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01100.ts", "upstream_id": "BenchmarkTest01100", "language": "typescript", "code": "import { Controller, Header, Param, Post, BadRequestException } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36d0bcd9196b01227dc383dfe4f224ad626f498cc4ca3dba05d51588a95db3f4", "structural_hash": "8c3510446ab08b1e13037d76d3275e39eab142d95fe6e41c1ddf0b0d2de7b60d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08950.c", "upstream_id": "BenchmarkTest08950", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n }\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca8d0f88365c08136c920ac762187ca16a0247f0897f920d8d97179a55d50558", "structural_hash": "2967b7b75780f89a87d85480117be48f78d01501e74d6977a037ba460801690e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01584.cpp", "upstream_id": "BenchmarkTest01584", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstruct Payload { std::string value; };\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"input\");\n Payload _pd{user_input};\n std::string data = _pd.value;\n const char *_exp = std::getenv(\"APP_PASSWORD\");\n if (_exp && data == _exp) std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a1c3924efaa2ab0436daf09bc8675609d8bbc4073c9feaa1c1f8adbba8ebf08", "structural_hash": "85695738806407a60ed60e7ae78f89f2df09b05e215f5ebdea7cb5e2f5e85acc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04965.ts", "upstream_id": "BenchmarkTest04965", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = JSON.parse(fs.readFileSync(\"/etc/app/config.json\", \"utf8\")).value;\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n https.get(\"https://api.node.internal/report?data=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9fad28e8a9512cca613518b1891fd1ca8f77319362841094b929b237902ba8c", "structural_hash": "b10752ea29912e992f3926a425f50f65ef08f14bd8ae7860d600ab44b1c326e8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15521.c", "upstream_id": "BenchmarkTest15521", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n FILE *_log = fopen(\"/var/log/app.log\", \"a\");\n if (_log) { fprintf(_log, \"actor=%s action=processed\\n\", data); fclose(_log); }\n}", "label": 0, "cwe": ["CWE-221"], "category": "info_loss_omission", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16d242594138d7d8a55eadf6cf157dbe00cb48df57fd4508f434067ca576c377", "structural_hash": "c120e8e74fff1ead5cb91a12b40819cd46fe73d93e25b2ffa82987e51a9e6882", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02608.cpp", "upstream_id": "BenchmarkTest02608", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2996cde43e0234676abac002268eb709a7bd6898aad796aaebb87063f684161", "structural_hash": "9c5efbab22c1bc74a7bb35acbd49529dfbe9d369d4a34a85c7204d2f14f5a848", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00951.cpp", "upstream_id": "BenchmarkTest00951", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _path = std::string(\"/var/app/data/\") + data;\n if (FILE *_f = std::fopen(_path.c_str(), \"w\")) std::fclose(_f);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d518218dddd0a73a2e4cbf1617c83d02c0d408aa08cb4f61fd4f067c37355b5", "structural_hash": "bb0fa064f2bec197a5494bbc45b7e98d27a5fd1f614ddac2bba4f0cacf59cb69", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03678.java", "upstream_id": "BenchmarkTest03678", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.concurrent.CompletableFuture fut = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> fieldValue)\n .thenApply(v -> v.strip().toLowerCase());\n String data = fut.get(5, java.util.concurrent.TimeUnit.SECONDS);\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc1b7745e6474cadd233c25017f0799f322bc6c4a74929a8e596f357146d799b", "structural_hash": "4b55990b656e5fce8847badb43b6be90c5c34983424c2c99ed596531217a97c4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_15506.js", "upstream_id": "BenchmarkTest15506", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = Buffer.from(userInput, \"hex\").toString();\n const _newSid = crypto.randomBytes(16).toString(\"hex\");\n req.session.regenerate(() => { req.session.data = String(data); res.cookie(\"session\", _newSid, { secure: true, httpOnly: true, sameSite: \"strict\" }); });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed872b6c3df081f1e474d0fbefde292d91889a985b5ad7fccd70eaaa881e24f3", "structural_hash": "4ac2aa8b21df0e68aa1e4e0edc91d20934146ddcf9f8bb30936a540684bcd54b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03413.js", "upstream_id": "BenchmarkTest03413", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n globalThis._stateLock = (globalThis._stateLock || Promise.resolve())\n .then(() => { globalThis.sharedState = data; });\n await globalThis._stateLock;\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8620f58694fd047c991e0a564c52494b13d79c14c5b50c6ca89cb8f37e4b900e", "structural_hash": "9b8ed678c3d92cb385e79611efcc93797825b56c5394c980e04c0411ff7ee78f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01040.rs", "upstream_id": "BenchmarkTest01040", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let env_value = std::env::var(\"USER_INPUT\").unwrap_or_default();\n let data = env_value.replace(\"\\t\", \" \");\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3e9ab32a3b91034e6f4ebbccc9c3a1465977030cdb3821485ea08b2a0c0d1ee", "structural_hash": "e36e9e5b2375e08d3ae936ce8162fa16c579e958fcd085bdccdbcae93012207d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03535.ts", "upstream_id": "BenchmarkTest03535", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string, @Req() req: Request): Promise {\n const userInput = cookieToken || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83d23d2d13b40fa31b8cec3243e007862da75397b2503511579957c561fb50ac", "structural_hash": "aaf21293e457a6bf97ff09ae2c87a153d02d4fab74508d47972a034039de1aa8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02879.go", "upstream_id": "BenchmarkTest02879", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/des\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(uploadName) {\n\t\tdata = normalizer(uploadName)\n\t}\n\tcipherBlock, _ := des.NewCipher([]byte(\"legacyk8\"))\n\tcipherOut := make([]byte, des.BlockSize)\n\tcipherBlock.Encrypt(cipherOut, []byte(fmt.Sprintf(\"%-8.8s\", data)))\n\tc.JSON(http.StatusOK, map[string]string{\"alg\": \"des-ecb\", \"out\": fmt.Sprintf(\"%x\", cipherOut)})\n}", "label": 1, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd517517623f92109453f94ce4688179734eedd7e5ea7767c2016fcd33dc054d", "structural_hash": "50893c5c6861fadeb9fef78d4ccf9ab84e387ea25f65f4fad09ef41364841efd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02919.py", "upstream_id": "BenchmarkTest02919", "language": "python", "code": "from flask import Flask, jsonify\nfrom app_runtime import auth_check\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n with open('/etc/app/config.json', 'r') as fh:\n config_value = fh.read()\n data = '{}'.format(config_value)\n auth_check('user', data)\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "47b5e397bedc98542ab71e704ab301a02560932177d7adfc0ad4b0dfcf79ac68", "structural_hash": "5815103be209dc92e01153418e42841645735d034b04d7a92fd30ee8585903c3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17991.js", "upstream_id": "BenchmarkTest17991", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n const _merge = (dst, src) => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(processed)));\n ctx.body = { status: 'ok' }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4170f6f2798bdcc5b2ecf9680c6138b0d9fbbcbcf68f51b7c18bbf7a697ce78", "structural_hash": "77fe6e6018d73c4b8c2486b277c81703eb4a8a5fc8c34098f03836de46d1537b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03527.rb", "upstream_id": "BenchmarkTest03527", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Rails.application.config.app_value.to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n _salt = SecureRandom.hex(16)\n digest = Digest::SHA256.hexdigest(_salt + data.to_s)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e9aa7f74179aa4d4b76ed1a2a054fff1433413dbf2e427ca776117f9007df39", "structural_hash": "d0b49d19c18c5f120e0f5c315d691d743f1388acae3c0bab7ed1d0e9c7810235", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00355.ts", "upstream_id": "BenchmarkTest00355", "language": "typescript", "code": "import { Controller, Header, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as nunjucks from \"nunjucks\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Header(\"Content-Type\", \"text/html\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n return nunjucks.renderString(processed, {});\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "896cd1bc2ccfd639aaeb00826f70d4dcd22691742569846082ef1311d996ebc7", "structural_hash": "700544435fda4473fb3931d5e4dbf9b07a038a6d7d30a5f471e6d8e728d760d9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01891.php", "upstream_id": "BenchmarkTest01891", "language": "php", "code": "header('Host', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n $doc = new \\DOMDocument();\n @$doc->load('/var/app/data/users.xml');\n $xpath = new \\DOMXPath($doc);\n $nodes = $xpath->query(\"//user[@id='\" . $data . \"']\");\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e33dadb56a2af7a312e6ad977351ce10b76334c5961ff224cb42afb5d96d36e9", "structural_hash": "435a14cef78ad1e8de9d51cba3428c055dcaff13d2feb2c6a7a05cc06bf1c11c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03516.rb", "upstream_id": "BenchmarkTest03516", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n response.set_header(\"X-Custom\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9013df9e350c94e565a15437dffb8ee4277f452f04de4fc5746d6bbeb087397", "structural_hash": "351c201b7f9940339d4bfa6b48ef94ca20ddfd66586e79e1fa903a341b308969", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01173.ts", "upstream_id": "BenchmarkTest01173", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n res.set(\"X-Frame-Options\", \"DENY\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3925c0e524578388943b3634dcecbb9f7623ae73250fed8e2d452a2f24908c1", "structural_hash": "7c2bb87aa3e778f2e4f59220069c486e3eb0ec2453fb834038074e7e768c8f05", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_20138.js", "upstream_id": "BenchmarkTest20138", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n req.session.data = String(data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-454"], "category": "external_trusted_var_init", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c24ad31641d9618049289c3fd09df0cc49de1caaa4ec4f90f6c86692945c5952", "structural_hash": "ee9fc72e74b9bbd69ebeb139daff51325a8e396bfbb40c1b7e802c0e15a859d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05792.py", "upstream_id": "BenchmarkTest05792", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n kind = 'json' if str(user_id).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(user_id).strip()\n case _:\n data = str(user_id)\n _resp = requests.get(str(data))\n db.execute('INSERT INTO feed (data) VALUES (?)', (_resp.text,))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "875a5dc057d9963d33e787f38848f47410d40c6a781d1316697d518607d3d661", "structural_hash": "5dd97b790b3d9f777666076098e8f0b0e45f5d9d1fbdbb7d206c744a4022071c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02220.cpp", "upstream_id": "BenchmarkTest02220", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::string _path = std::string(\"/var/app/data/\") + data;\n if (FILE *_f = std::fopen(_path.c_str(), \"r\")) std::fclose(_f);\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b42b964abe862edd5d629a160bc415d450ef81e95a6d9635b29e0b254d27b97d", "structural_hash": "69fb4a6ffbb7c3fb199423ab1b82a4ec310069ac64fe72d5e0f54bb93855e324", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06257.sh", "upstream_id": "BenchmarkTest06257", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n data=\"${user_input//$'\\x00'/}\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n IFS=\",\" read -r -a values <<< \"$processed\"\n if [ ${\n printf \"X-Param-First: %s\\r\\n\" \"${values[0]}\"\n printf \"X-Param-Dropped: %s\\r\\n\" \"$((${#values[@]} - 1))\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54ec76ce6e038c5145f4d40d072d5027c344f524cee6ae00b7f13d63658e8c54", "structural_hash": "346cd7907f602f1480d15ec6b56244a84d78819a03cf37c1cc399e3e7aa6e32f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01761.py", "upstream_id": "BenchmarkTest01761", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n upload_name = request.FILES['upload'].name\n data = str(upload_name).replace('\\x00', '')\n if data not in ('asc', 'desc', 'name', 'created'):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n eval(str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0cc82987aa906c3ece29722c3d2236c16b24b40d91981c719ec5005a66117c6", "structural_hash": "3294222f6c962de5b2efcb9c8bc773409b334f03ecd3df799a9d5c61ec46639a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02189.cpp", "upstream_id": "BenchmarkTest02189", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::queue _q;\n std::mutex _qm;\n std::thread _prod([&]() { std::lock_guard _lk(_qm); _q.push(user_input); });\n _prod.join();\n std::string data;\n { std::lock_guard _lk(_qm); if (!_q.empty()) { data = _q.front(); _q.pop(); } }\n std::string _truncated = data.substr(0, 64);\n std::string _role = _truncated;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86714cfbcfd0b693863298234c1c4258effa98d21437bc5d66e5bd75fa57ca56", "structural_hash": "ba5a3c714d634ae03a2cfd0302068190cf9c02070614271aeaeb7d0a0159ba44", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01651.cpp", "upstream_id": "BenchmarkTest01651", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _doc = std::string(\"{\\\"field\\\":\\\"\") + user_input + \"\\\"}\";\n std::string::size_type _fs = _doc.find(\"\\\"field\\\":\\\"\") + 9;\n std::string::size_type _fe = _doc.find('\"', _fs);\n std::string data = _doc.substr(_fs, _fe - _fs);\n if (data == \"admin123\") std::cout << \"authenticated\" << std::endl;\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f8fe784c23636812cc9ef64563f6c5be8b2c431a354ba03af5a48a15716c795", "structural_hash": "143ee4f0417918ee1e6740a01db405002716f0ed6d2cf5c572d5b0d25dfeb7d8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00835.php", "upstream_id": "BenchmarkTest00835", "language": "php", "code": "getContent();\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n return response()->json(['ok' => 1])->cookie('session', (string)$data, 60, '/', null, true, true, false, 'Strict');\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5c9e3b669df16652cad724a70d72a24f0ca5a25f26d168b9c255c64eaf8394d", "structural_hash": "e97d0bce37393dc6d65cf5d43fdde879a47b8ca210e2e673ec67ef9d7864637a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01998.php", "upstream_id": "BenchmarkTest01998", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $entries = scandir((string)$data);\n return new JsonResponse(['listing' => $entries], 200);\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a264e142f5fcceb7ea134b7e90f7dc6af03e95323de2d13384c959a95e4daa51", "structural_hash": "2cd6eaa3fbead1c836bad47bf01a749c6de8bae296135387acddd1c8bad478cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00528.cpp", "upstream_id": "BenchmarkTest00528", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n const char _buf[16] = \"fixedcontent12\";\n int _i = std::atoi(data.c_str());\n std::cout << _buf[_i] << std::endl;\n}", "label": 1, "cwe": ["CWE-126"], "category": "buffer_overread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80176a7870fa7c007a1dab22584c6bbca4b93c94862024e52101584f1fb0cd47", "structural_hash": "5a88c71d81b907e71dc8c3cfa10941e12c410af027e42cafbb327a2026ca8c64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03447.js", "upstream_id": "BenchmarkTest03447", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = _parsed.data;\n ctx.body = \"
    \" + processed + \"
    \";\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-116"], "category": "improper_encoding", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94f00fa11ef58255e061308219f9cc410c202822b448da2f402cb628c7fa0f3d", "structural_hash": "dceac0ce784be61536c3efcf2743dd7a441af0c788321b547e402f47e0b6a74e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09702.sh", "upstream_id": "BenchmarkTest09702", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n eval \"rm -f $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-78"], "category": "unquotedexpansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e93046ff6eff5030c1f19d5d5b2a75cc2ee976dcdc7ff814642ff8eeed86191", "structural_hash": "53824a399a934ad0d50b4ce2dd0813cee3ff08f7bb6fa4e1a701aa36cc4cb5f6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04214.rb", "upstream_id": "BenchmarkTest04214", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/ldap\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = user_input.split.join(\" \")\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n halt 400, JSON.generate({ error: \"invalid\" })\n return\n end\n processed = data\n ldap = Net::LDAP.new(host: \"localhost\")\n ldap.search(base: \"dc=example,dc=com\", filter: Net::LDAP::Filter.eq(\"cn\", processed))\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0014960e0c9a04f9176fc72de3136f2f74c44147b9f28406b38f628f4de119b0", "structural_hash": "363ce110b4628fc45c1db0a17cf379e3ceb8157fd2da994717622388ce47d72d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03896.rs", "upstream_id": "BenchmarkTest03896", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let dotenv_value = std::env::var(\"DOTENV_VAR\").unwrap_or_default();\n let queued = dotenv_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db49febd629a6ded8f40fda11cbf45e9b00f6fcd14e58a0bba8fa7daebad6197", "structural_hash": "825d3429b21caa03e79d36308d8b9e74999a917ce55a16a40fafb9a26ad088b6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32988.sh", "upstream_id": "BenchmarkTest32988", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n echo \"$data\" | openssl enc -des-ecb -provider legacy -provider default -nosalt -pass pass:legacykey -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1508eebe05e6db2ae3befb0bcfa80735c170b85291145c94bdaad8d5099e081", "structural_hash": "0f66a1577ead823170c948ff586e5defa8a9c8d050baa4ba7a93775a73f56bb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02143.rb", "upstream_id": "BenchmarkTest02143", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n if [\"https://app.railscdn.org\"].include?(data)\n response.set_header(\"Access-Control-Allow-Origin\", data)\n end\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88461127b855a591025036a3c7c42b8aff30148350548f89dbfc662c329f62bd", "structural_hash": "499dec5a95f59bb20ff78f386d36c9bccc68f0b967aab9655ba9706855ff17a0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01715.cpp", "upstream_id": "BenchmarkTest01715", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_NAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string _path = std::string(\"/var/app/data/\") + data;\n if (FILE *_f = std::fopen(_path.c_str(), \"w\")) std::fclose(_f);\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a32399b5e6d64e0ec975c57d1af6f1b8a11b90cd65210733aa1ab3ffa7cbbdad", "structural_hash": "100fe40ed7f04eb8447ee7e029ba822a930ba2cfa3fd68360871fc619810eef4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01057.rb", "upstream_id": "BenchmarkTest01057", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n data = \"%s\" % user_input\n render html: (\"\" + data.to_s + \"\").html_safe\n end\nend", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f024c62d46eb2b2d41085fc51357c43274a6e50814e62d5bcbc897b40a08622", "structural_hash": "36c4f060a9ab39dfb7a6a0b480461ba58cb1ebbdeebd89242be95e8edc781ffd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01805.ts", "upstream_id": "BenchmarkTest01805", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as http from \"http\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = process.env.DOTENV_VAR || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n http.get(\"http://api.node.internal/report?data=\" + String(data));\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f465004bf1ae982fa5219a58c508dbdd52f74bf601b5cf46a146f38c1a5335b", "structural_hash": "abe65a32210f54fe72ef30ec2cfa09e8f46ef20e0777ded053153e3e8d4fd679", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_29886.js", "upstream_id": "BenchmarkTest29886", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n res.send(\"
    \" + data + \"
    \");\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "951c68d85cffe8b52bab4c0fce5347dcaa9521d066f182d87b6d09c34c95d4a2", "structural_hash": "b06da51800af7f0fa22635a438472bc263920e8cea104ae0275264416ef80689", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02053.rs", "upstream_id": "BenchmarkTest02053", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n let (payload, _origin) = (xml_value.clone(), \"http\");\n let data = payload;\n HttpResponse::Found().append_header((\"Location\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "38ffceacb3578e361dbecfb5229006c4592c684b3fc56f493ec99eabe8b07f6e", "structural_hash": "30f28cf4eac369249f61a1847d08c094f83f9dde99b79fef45309172b3814147", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_33098.go", "upstream_id": "BenchmarkTest33098", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tdotenvValue := os.Getenv(\"DOTENV_VAR\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(dotenvValue)\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tlog.Printf(\"User action: %s\", processed)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-526"], "category": "env_var_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5db95c0d6e7e5a4af6ea197fea807e44a2e25b9d99221a69f06c19b377e33dcc", "structural_hash": "7a8df26646d849674ed79692acf45cf35ada76cf94e0f4f341d19e28f9939d0d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03828.php", "upstream_id": "BenchmarkTest03828", "language": "php", "code": "'invalid'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "693beb30412b6af883c10b49ace630059519ad10036cb43886cd93cd5d1667e0", "structural_hash": "73e6261a56a93e6b0e53681f8d991df3d7bd976f8c481e3475d0b1cb8117fe3b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28601.js", "upstream_id": "BenchmarkTest28601", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n ctx.session.expiresAt = Date.now() + 900000;\n ctx.session.data = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "430a6ba35bf8948038cdaba13552e6aa64bd8dcc386e9325ab0d962cfd2b130e", "structural_hash": "4befa4bcd37c7e01010b453cd2354cd8d5f62b03570294d1da9d088ef49ed4ac", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00719.rs", "upstream_id": "BenchmarkTest00719", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&path_value);\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c37e640bb26d7e63282c15e6c77b9c75b9d1c28049875fed94f7d63aa282847", "structural_hash": "0ec3b2bf581996c74bcef624a40d6bb5b0cbe4947d276ea2642e71a19149af0e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03361.rs", "upstream_id": "BenchmarkTest03361", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse shell_escape;\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let referer_value = req.headers().get(\"referer\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: referer_value.clone() };\n let data = payload.value().to_string();\n let processed = shell_escape::escape(std::borrow::Cow::from(&data)).to_string();\n Command::new(&processed).arg(\"--run\").output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c4a1b783a92ee147baf30af3d4864e593b1d2d61aa7e9d7183a710c4a7575b2", "structural_hash": "136f9cb82708e35e5cd24353e6950739b83f69a2e378cf4ef3b835550e00f740", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05333.ts", "upstream_id": "BenchmarkTest05333", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const data = String(userInput).slice(0, 200);\n eval(data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2ef1abede3569b0ec6eace773e7eb065460086081cacee85bb79a2326aaabf6", "structural_hash": "da7e2c566362332481614894e46bec06f12ff5d1bf773222fc30d796cf25fecc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05877.py", "upstream_id": "BenchmarkTest05877", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nimport os\ndef benchmark_case(request):\n host_value = request.META.get('HTTP_HOST', '')\n data = (lambda v: v.strip())(host_value)\n ciphertext = Fernet(os.environ['DATA_ENC_KEY'].encode()).encrypt(str(data).encode())\n return JsonResponse({'length': len(ciphertext)}, status=200)", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab4592a465c783571330a6337cb8a8bf75a4cfaad37924f70b41c8b85b9a2c24", "structural_hash": "29c675c01a48de1bb43e31fbc98357f748abf6412b4288981d5fd3f36befa319", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03720.php", "upstream_id": "BenchmarkTest03720", "language": "php", "code": "json('payload', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return response()->json(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n if (preg_match('/[a-zA-Z0-9_-]+/', (string) $parsedBool)) {\n return response()->json(['validated' => (string) $parsedBool], 200);\n }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6d67a62558562c0556af1c2fb16b46296df04d0d29a5a258097901861cbeddb", "structural_hash": "f83d33e5d66e8b926ca15386dd56e3e067f63cbcd992fce3b7963471f641ea94", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05666.rs", "upstream_id": "BenchmarkTest05666", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse serde_yaml;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let tokens: Vec<&str> = cookie_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let _: serde_yaml::Value = serde_yaml::from_str(&data).unwrap_or_default();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbd52b76dea886cf904da56a0247fdb51414eb0d8b9560878ae9dfdc5f0c3260", "structural_hash": "49838204dd0734a946365105ef0865d22b6301b84475610c1eee3323db051d53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02681.php", "upstream_id": "BenchmarkTest02681", "language": "php", "code": "headers->get('Origin', '');\n $data = ($userInput !== null) ? $userInput : '';\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$data]]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70ee13083f3291eb359d306d7336a03b21bb93e3d901203f320ec1941d8fb40b", "structural_hash": "2ce8f76064db305ba52c4ba52b812ddaeae3f47a2ddd503ecba4c068b19c981c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02391.c", "upstream_id": "BenchmarkTest02391", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_NONET);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69975de29d4f51847c684546d9b1b28e2d340f7659acc1fc9f0e025cd145cf44", "structural_hash": "fea6b1fa1e50ba2b41131b005e213a5df3b0fac0dfefe943e8aa60dcee852efe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08669.js", "upstream_id": "BenchmarkTest08669", "language": "javascript", "code": "const fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n fs.writeFileSync(\"/var/app/plugins/generated.js\", \"const setting = \" + processed + \";\");\n require(\"/var/app/plugins/generated.js\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2407e55551f8884e1f0a80e6b457cc322a43e230a417c26b2af95f2ccbfcca5", "structural_hash": "db87926f91c2dc71d2cb214ad74540005e60da353e3391cfd238d114513d5732", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04704.py", "upstream_id": "BenchmarkTest04704", "language": "python", "code": "import re\nfrom flask import Flask, request, jsonify\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n multipart_value = request.form.get('multipart_field', '')\n ctx = RequestContext(multipart_value, source='form')\n data = ctx.payload\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return jsonify({'error': 'invalid input'}), 400\n processed = data\n trusted_claim = str(processed)\n return jsonify({'trusted': trusted_claim}), 200", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed0354cf21a9f617bd01f78985d0480ac82b186459d29a158affc7b46160b901", "structural_hash": "fed5f80f57520f64581a39a2fa43176327d9515009984e06710262a757c0cef3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02861.rb", "upstream_id": "BenchmarkTest02861", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"erb\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n payload, _origin = user_input, 'http'\n data = payload\n render html: (ERB.new(data.to_s).result).html_safe\n end\nend", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c79c44029420ed5be10f935b0b22a2d0d55c1e637c41fe7cab7e79ab5ed4054", "structural_hash": "ebdf9499c7f1755829e1847a7b707e8b44801a1cebc98cad7c469aa3894f5cce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01121.php", "upstream_id": "BenchmarkTest01121", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $field = 'data';\n $$field = $userInput;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return new JsonResponse(['error' => 'forbidden'], 400); }\n $processed = $data;\n $mongo = new \\MongoDB\\Client('mongodb://localhost:27017');\n $mongoResult = $mongo->benchmark->users->findOne(['username' => ['$regex' => (string)$processed]]);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8622fadf00b4583d6d9622a5369283ee39b6b4f87a354cc209054981569385fe", "structural_hash": "3ae3cf932c3b9762e7919d4e2bd64f2ed05f3d248d0cc156d9a8e954dcff3114", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05674.rs", "upstream_id": "BenchmarkTest05674", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse url::Url;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let data = raw_body.replace(\"\\t\", \" \");\n let parsed = Url::parse(&data).unwrap_or_else(|_| Url::parse(\"http://invalid\").unwrap());\n if ![\"api.priv.local\", \"cdn.edgecdn.io\"].contains(&parsed.host_str().unwrap_or(\"\")) { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n let target_url = data.clone();\n axum::response::Redirect::to(target_url.as_str()).into_response()\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e13785f15ef032411df0905f488d8841ddf4a67a8780320406e2c20eba46f603", "structural_hash": "c167907daafa326844619df8459fb0e10b4edea2af6e6fe092055b219d2c489b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14374.go", "upstream_id": "BenchmarkTest14374", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"sync\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tvar _b strings.Builder\n\t_b.WriteString(fieldValue)\n\tdata := _b.String()\n\tvar secretCache sync.Map\n\tsecretCache.Store(\"current\", data)\n\tc.JSON(http.StatusOK, map[string]string{\"stored\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_memory", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ffaa18fcac54967254555adb6ab773e77334a6c04bc950f5fcdfb766b12ca37", "structural_hash": "58d2bdb8200fa60e61c7123190821c290ebea03c39e0e423a6789af80c2ca577", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05546.java", "upstream_id": "BenchmarkTest05546", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", userId);\n String data = sw.toString();\n byte[] gcmIv = new byte[12]; new java.security.SecureRandom().nextBytes(gcmIv);\n javax.crypto.KeyGenerator kg = javax.crypto.KeyGenerator.getInstance(\"AES\");\n kg.init(256);\n javax.crypto.SecretKey key = kg.generateKey();\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, gcmIv));\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a40298d7e002f7189f4ab0f76931d02ac3c2c9d9c0c3a1e1c6f353bbd6da199d", "structural_hash": "8fb99debac3dd2e895739065393adafe4e5ad902140e561a6673568472cf4eb3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01956.rs", "upstream_id": "BenchmarkTest01956", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse rand::Rng;\n#[actix_web::post(\"/benchmark_case/{id}\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let path_value = req.match_info().get(\"id\").unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&path_value);\n let _seed: u64 = data.bytes().fold(0u64, |a, b| a.wrapping_add(b as u64));\n use rand::SeedableRng;\n let mut _rng = rand::rngs::StdRng::seed_from_u64(_seed);\n let _token: u64 = _rng.gen();\n crate::shared::store_session(\"csrf_token\", &_token.to_string());\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f9e3f61d601ab49c762df8d1cd3df4437b60619d922239d3d30f79c2aefcdcb", "structural_hash": "aa64a6c6a3519e55eb90a46235a05e78a9c11cbaa8c169838973c6098fb3190d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02148.rb", "upstream_id": "BenchmarkTest02148", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:upload_form).permit(:upload)[:upload].original_filename.to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n render html: (\"
    \" + data + \"
    \").html_safe\n end\nend", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6827fa4eeda21ef2edad8961050529814cb98c5d53d2a17a1f5d107d6454615d", "structural_hash": "c501c39a321021913da7a58cfb3be6a36e53dd999116a500e5c60568b6a15c6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00627.rb", "upstream_id": "BenchmarkTest00627", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:user).permit(:name)[:name].to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n if [\"https://app.railscdn.org\"].include?(data)\n response.set_header(\"Access-Control-Allow-Origin\", data)\n end\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e6664dbe1c9d9a625d0b6239952b4363a9aa0d5a8ed0a95e259feea6f4b2986", "structural_hash": "c132903993c7a0ae9cb60e1b2e2a7f2b03ab409c4a2dc7997ecfda278bd342a1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01064.java", "upstream_id": "BenchmarkTest01064", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@QueryParam(\"id\") String id, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n java.util.Map.Entry edge = java.util.Map.entry(userId, \"http\");\n response.setHeader(\"X-Tuple-Context\", edge.getValue());\n String data = edge.getKey();\n com.fasterxml.jackson.databind.ObjectMapper safeMapper = new com.fasterxml.jackson.databind.ObjectMapper();\n safeMapper.disable(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);\n com.fasterxml.jackson.databind.JsonNode node = safeMapper.readTree(data);\n return Response.ok(node.path(\"name\").asText(), MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93c2045d4a0d2745c4b27f68ef189b7e8767874a6df2fa624a5e85ee0620cc06", "structural_hash": "1a881f7c074cbf9a4c30971a728418951f94aaa76ca52c91a52e144a605c6dcd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07391.sh", "upstream_id": "BenchmarkTest07391", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n echo \"$data\" > /var/data/secrets.txt\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-256"], "category": "unprotected_cred_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d43956eec67d07bce1e56caf9feaebd02d22d6584e97e293cfbda79cd50e6661", "structural_hash": "2b2f3a2e24207f4c86979e1ca088450071eaa99a706d3fc1a8b5b8188779786a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_13820.js", "upstream_id": "BenchmarkTest13820", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = process.env.APP_PROP || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n authCheck(\"admin\", String(data));\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e475f2187a5c741ed91d546188510e74c503cace075f6afa6249903d094762b8", "structural_hash": "7d422159b8887f3e2185b1937e38c2c5b94eab7b98d226fa495298ebecee006d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20348.sh", "upstream_id": "BenchmarkTest20348", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n result=$((100 / $data))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03160d4db35db979ad5e6301c7731088d4da11e8e5558cb2af5e7ed334da09ee", "structural_hash": "1be113d72ed9633c3db6d2c0434edf0e7902b9021028bc3193494f2ef9811fec", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00699.rb", "upstream_id": "BenchmarkTest00699", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = \"#{user_input}\"\n _buf = \"x\" * 1024\n _ = _buf\n render json: { result: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54dfa1c7c50d71bf5a1f0fb780bd6b2ca608478d589611db4882a9a0018f71d8", "structural_hash": "e483d1c964ba23708439e046e0d52afefc05631077366ecb26f015e55a7abd9f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02779.php", "upstream_id": "BenchmarkTest02779", "language": "php", "code": "query('id', '');\n $data = trim((string)$userInput);\n $processed = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69cb649f1d389bebf91f0101983abcf419241c61c57451eebb035866564b25c7", "structural_hash": "988820ec4e54c55215f8fad15a28c818c65c2d217f91c758732dbe8194538efe", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01460.py", "upstream_id": "BenchmarkTest01460", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n forwarded_ip = request.headers.get('X-Forwarded-For', '')\n data = forwarded_ip if forwarded_ip else 'default'\n os.system('echo ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c8eafef291761e4b061cb62fe6ce9c4fc98890a1d62dab3618a6f646fb2d87d", "structural_hash": "929cf7e15a0ed0becbf0d711317e9b98064c73468b7850008603eac1a5a5854b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00442.cpp", "upstream_id": "BenchmarkTest00442", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string _role = data;\n bool _allowed = (_role == \"admin\" || _role == \"superuser\");\n if (_allowed) std::cout << \"authorized\" << std::endl; else std::cout << \"forbidden\" << std::endl;\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d96ff7fe13825079a09ea738e321002db4b658efe493652b0a8fea8b0042d442", "structural_hash": "738fae1183a0fbf1a02bac98fcf4bd13bfc1c1cfca6651db715d0fcf3b307a6e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13554.c", "upstream_id": "BenchmarkTest13554", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n }\n}", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6534593e346e4e5d73b04b1564b69cd4c187896c6b44e3ac31e529bbe01163c", "structural_hash": "33b54f4f1c7abf547513e983953685c2113d26af889fef5490b29506272fcde2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05645.php", "upstream_id": "BenchmarkTest05645", "language": "php", "code": "header('Origin', '');\n $data = str_replace(\"\\0\", '', $userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73009521e79864404b11594fe1b553289de470a76969e7762090997b1abe12ac", "structural_hash": "7c1a46989255698ae81e3988a60bc79acaccfcb215ccaa6e0ef5ad780871ac32", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13970.sh", "upstream_id": "BenchmarkTest13970", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(echo \"$user_input\" | xxd -r -p 2>/dev/null || echo \"\")\n printf \"%s\" \"$data\" > /var/www/html/exports/report.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sensitive_file_insertion", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9baed7d6c3d116647055105a9df2e21cac6df8a4e9b9734e5f4e958e9ccfc98", "structural_hash": "0d156a112cdf56e07066bb172455d861e70b85398617f017c46a6b911642e2cc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05688.rs", "upstream_id": "BenchmarkTest05688", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = auth_header.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => auth_header.to_lowercase(),\n \"f\" => auth_header.to_uppercase(),\n _ => auth_header.trim().to_string(),\n };\n crate::shared::auth_check(\"user\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3d3b07ec27f5dac23fe74d16e9841993c77809ce258b41f5513e40b06e4da3d", "structural_hash": "0eed81cf05faff8759e809af042b3cf704af20b2f43a0832738a82c1213d612e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13269.js", "upstream_id": "BenchmarkTest13269", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { ctx.status = 400; ctx.body = {error: 'forbidden'}; return; }\n const processed = data;\n ctx.status = 500; ctx.body = { error: processed, stack: new Error().stack }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2eb30a0349454f3e18ddabfc525dced060684709da9f093263b262b026fdb72", "structural_hash": "e8b4b5cad9ca7b0870e9088b9e937510a9fff0c1bd1a14e89aa6fba68190e855", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03977.rb", "upstream_id": "BenchmarkTest03977", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n role = data.to_s\n if role == \"admin\"\n render json: { role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48a1a398a58439d2b50315eeaa7a7fea40ca03f1dec28ad05978a68679018c52", "structural_hash": "ed02baa4d536617bd5705e412aafdd86c313ffac5843f9afa7876e3d41a69c07", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03805.js", "upstream_id": "BenchmarkTest03805", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { ctx.status = 403; ctx.body = {error:\"host not allowed\"}; return; }\n if (!allowedHosts.includes(parsedHost)) { ctx.status = 403; ctx.body = {error:\"host not allowed\"}; return; }\n const targetUrl = data;\n ctx.redirect(targetUrl);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3c0e4db34c53f09ec4522bef21088ee4dc32044afc0e72493f02dc90d50f33e", "structural_hash": "008ae9d76f1404e54bf767afa932f5e9f84f730506f05f0e2d21f31eb32cb16d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01336.rs", "upstream_id": "BenchmarkTest01336", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let config_value = tokio::fs::read_to_string(\"/etc/app/config.json\").await.unwrap_or_default();\n let mut data = String::new();\n data.push_str(&config_value);\n use md5::Digest;\n let _ = md5::Md5::digest(data.as_bytes());\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "660b0c77110b76d843ec0adf13880316dc1d0960e2220d83a325fdd3ee3bd0d5", "structural_hash": "b2f2687ebb6278fb9104ae0f89c064099713cce6e850acece6ce86d4f8ee08d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04183.php", "upstream_id": "BenchmarkTest04183", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $data = str_replace(\"\\0\", '', $userInput);\n return new Response((new \\Twig\\Environment(new \\Twig\\Loader\\ArrayLoader()))->createTemplate($data)->render(), 200, ['Content-Type' => 'text/html']);\n }\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ssti", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a25bdb3a06d7b5942a86009fc8d2d7d65723203c87a4135a74a2156b0416fd67", "structural_hash": "d3a6b34de62f89956cca00fb8d5262b8638f7d4c5f43e0c8724a2074ee53659c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25322.js", "upstream_id": "BenchmarkTest25322", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n switch (data) { case \"a\": break; case \"b\": break; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5460c463615036d49a5b55caad810319f869bde612da30d8e9ddbf07a79c3c4c", "structural_hash": "049468e58eea36cf0a9dd20b3ccddad126208129a60317ea7ce8f97f821bece2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01222.py", "upstream_id": "BenchmarkTest01222", "language": "python", "code": "from flask import Flask, request, jsonify\nimport ctypes\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n auth_header = request.headers.get('Authorization', '')\n parts = str(auth_header).split(',')\n data = ','.join(parts)\n requested = int(str(data))\n wrapped = ctypes.c_int32(requested + 1).value\n return jsonify({'wrapped': wrapped}), 200", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3dd8a0063355c7032f5aea4f72f1c35de7edacadb1637ab3982ea0f7a11002c", "structural_hash": "41cacb8eaa13edf3388b9786b152b5ef4f4aaeebedf14990a0052ce14831400d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16803.sh", "upstream_id": "BenchmarkTest16803", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n mongosh --eval \"db.users.find({name: '$data'})\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "247aa53ab145885bfeb5ac999ac3732764511a85b0018f055d8f767982a7fcf5", "structural_hash": "76e1c3b1d31a385cd56babbd0abd0590cc5d06a9b66d48991306c5b24623564f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04574.php", "upstream_id": "BenchmarkTest04574", "language": "php", "code": "query('id', '');\n $data = hex2bin($userInput);\n $result = DB::table('users')->where('id', $data)->first();\n if ($result === null) { return response()->json([\"error\" => \"not found\"], 404); }\n $value = $result->name;\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cdb6c51a95e596d71043bf3a87a55bbfc85663a4f92a1c486b45fd37d02dd9d1", "structural_hash": "3805e74d005ec40458f4b64e422645a31ab7b2ec46f461bff3b5b22bbcea9fb4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03336.rs", "upstream_id": "BenchmarkTest03336", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let captured = field_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n let requested: usize = data.parse().unwrap_or(0);\n let _data = vec![0u8; requested.min(4096)];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee7dd98655a37d96495f56709f25d88f1b39220f27b71b05e24c0e839cf4b45e", "structural_hash": "865544d6936d86c1cb4228d6b82ea68af161b9e04f43c809fa124ca5466e67b4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05333.c", "upstream_id": "BenchmarkTest05333", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char *_p = malloc(strlen(data) + 1);\n if (_p == NULL) return;\n strcpy(_p, data);\n printf(\"%s\\n\", _p);\n free(_p);\n}", "label": 0, "cwe": ["CWE-401"], "category": "memory_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:memory_leak", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ff13139ea5410c9f39ed1edccee9461c860894728679f58a3a1b405843dd7ad", "structural_hash": "50208249c550ce29002cebb3731b65f533722d8d01b0bf9599999d7488b1c147", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01868.ts", "upstream_id": "BenchmarkTest01868", "language": "typescript", "code": "import { Controller, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Res({ passthrough: true }) res: Response): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const _merge = (dst: Record, src: Record): Record => {\n for (const _k of Object.keys(src)) {\n if (src[_k] && typeof src[_k] === 'object') { dst[_k] = _merge(dst[_k] || {}, src[_k]); }\n else { dst[_k] = src[_k]; }\n }\n return dst;\n };\n _merge({}, JSON.parse(String(data)));\n res.json({ status: 'ok' }); return;\n }\n}", "label": 1, "cwe": ["CWE-1321"], "category": "prototypepollution", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:prototypepollution", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f9cd6ab1f0800e9c673ccad5db94d084a85e168cef7ae7ee5fc485824d56a671", "structural_hash": "d5c2e5c2442243ce3ee33bb3d78c715223c85ca23d22e40c3a74bf0b729e0956", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01669.rs", "upstream_id": "BenchmarkTest01669", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = graphql_var.replace(\"\\t\", \" \");\n if data.parse::().is_err() { crate::shared::send_error(\"An error occurred\"); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3d2621fa3978c7d83552e4a52fcd65f7ec0f87522178b098a5ac1ba2194c602", "structural_hash": "aa7954794c1efb833e060479376df059934c32e1549d9343382086dbaa4f4029", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04053.php", "upstream_id": "BenchmarkTest04053", "language": "php", "code": "header('X-Forwarded-For', '');\n $data = str_replace(\"\\0\", '', $userInput);\n if (!hash_equals((string)(session('user', '')), (string)($data))) { abort(403, 'forbidden'); }\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b7a113e10c132c00089fe3345be014ff0104bc5a87bbfd7ddf41d772fe5f6e4f", "structural_hash": "3229f499a41b5f27eed1c3559544fe0bd5c463c2eaa3d62e9eda4ee6c04b508f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02804.cpp", "upstream_id": "BenchmarkTest02804", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_log = std::fopen(\"/var/log/app.log\", \"a\")) { std::fprintf(_log, \"action: %s\\n\", safe.c_str()); std::fclose(_log); }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55d1661cc27e1aefc46a38661c7064557cdeb64c0793ef480160423501e628bc", "structural_hash": "9cef0fc4682d048e62c48cee69fb0c0e6cd423a00ec351f4580600646d9390cb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02364.cpp", "upstream_id": "BenchmarkTest02364", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_USER_AGENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", data.c_str());\n std::fclose(_csv);\n }\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "455c513172c7721a95761fe6b45bb9178e0175db3335226c8ab77304d206e4dd", "structural_hash": "b8aec1224be9ac90825bdc9eeac28e69bddd4b4ed2e211f6f28fbc8900084271", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01081.php", "upstream_id": "BenchmarkTest01081", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $requested = (int)$data;\n $size = max(0, min($requested, 1024));\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79089004a24929d0e330e4d6f7a249f9b20410c4da0d4457101f4be1edcba90e", "structural_hash": "db023ed22e650d6f0abaa076c25a2d86f357f52ddc90042e2dbc38239eadee87", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05439.java", "upstream_id": "BenchmarkTest05439", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.function.Function initialFn = s -> s.replaceAll(\"\\\\t+\", \" \");\n java.util.function.Function transformed = initialFn.andThen(String::strip);\n String data = transformed.apply(envValue);\n try { Double.parseDouble(data); }\n catch (NumberFormatException e) { response.sendError(400, \"forbidden\"); return; }\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"DES/ECB/PKCS5Padding\");\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(new byte[8], \"DES\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n byte[] ct = cipher.doFinal(data.getBytes());\n response.setHeader(\"X-Cipher-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c7d2d8c5181f301332c3b287c5e61c0474f43764204396a5399d42fb0fe37909", "structural_hash": "ad7d325f3e1dceff6e57094fe8b6447912e8894a3c301ace7daa4a95e0393587", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02318.rb", "upstream_id": "BenchmarkTest02318", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = user_input.split.join(\" \")\n content_type :html\n \"
    \" + data + \"
    \"\n end\nend", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d181a6e44fec0961616f4d4db47427589781b5e155e7c7f91d1d97af7733c5af", "structural_hash": "3d58e1ef959d298437794a543b58080ffe4b533c30143a3a92f0b4859c675abb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02706.go", "upstream_id": "BenchmarkTest02706", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tpending := strings.Split(refererValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tos.WriteFile(\"/var/app/plugins/gen.sh\", []byte(\"SETTING=\"+processed), 0755)\n\texec.Command(\"sh\", \"/var/app/plugins/gen.sh\").Run()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6131da3fd1f576cbb183ecef83c7ec49463008cc09b018806212e8ceac6a980", "structural_hash": "1b5b7b1c2864a2ccbc5c57715cf6b140e6585c5cacc28fd2a6472d27d17903ad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03593.cpp", "upstream_id": "BenchmarkTest03593", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\nvoid benchmark_case(int, char **)\n{\n std::string user_input;\n if (FILE *_fp = std::fopen(\"/etc/app/config\", \"r\")) {\n char _b[256];\n if (std::fgets(_b, sizeof(_b), _fp)) {\n _b[std::strcspn(_b, \"\\n\")] = 0;\n user_input = _b;\n }\n std::fclose(_fp);\n }\n std::string _doc = std::string(\"{\\\"field\\\":\\\"\") + user_input + \"\\\"}\";\n std::string::size_type _fs = _doc.find(\"\\\"field\\\":\\\"\") + 9;\n std::string::size_type _fe = _doc.find('\"', _fs);\n std::string data = _doc.substr(_fs, _fe - _fs);\n unsigned char _digest[16];\n MD5(reinterpret_cast(data.c_str()), data.size(), _digest);\n std::cout << \"digest \" << (int)_digest[0] << std::endl;\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a2ce0eae8f1a5f1a2b02daef7fd9ed2d80d0a6b233231a7ca4321e54eb35000", "structural_hash": "d2dfcd45e5f4147d97e60d2e2f55e3bfdb8a6dce383e07ad5eb0514a79a2b966", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19705.c", "upstream_id": "BenchmarkTest19705", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n char _dst[16];\n strcpy(_dst, data);\n printf(\"%s\\n\", _dst);\n}", "label": 1, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4aa627e7c8a17872c5f33633be09baa2aed45f331d4901a9be51eadf8f7fc518", "structural_hash": "76367d4dad753c8cff0913d00e1e9200900fcebd9423ca31b984bf843e524f33", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03072.php", "upstream_id": "BenchmarkTest03072", "language": "php", "code": "headers->get('Authorization', '');\n $data = hex2bin($userInput);\n $size = (int)$data;\n $buf = str_repeat('x', $size);\n unset($buf);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1b6ab382c7dd0af36cc5e09cbc2dbcdda366a04dab79c7a009f1d10a43e9519", "structural_hash": "1370d627d43949df102cf5d6c3229b93ff881dcbe502fb494569e90f323604f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_25174.sh", "upstream_id": "BenchmarkTest25174", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n mysql -e \"SELECT * FROM users WHERE id = '$data'\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f4c4e9ee3b5fb227ff65e73c3ba71667803d76e7418c30af5ba3ef0678bd49a", "structural_hash": "4e84c4ecc487bdcf30966ef72a95199bdf846c2018b64872b3b3efc23f858601", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02291.java", "upstream_id": "BenchmarkTest02291", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = String.format(\"%s\", rawData);\n if (!(\"true\".equals(data) || \"false\".equals(data))) { return Response.status(400).build(); }\n java.util.regex.Pattern inputPattern = java.util.regex.Pattern.compile(\"[a-zA-Z0-9_-]+\");\n if (inputPattern.matcher(data).find()) {\n response.setHeader(\"X-Validated-Input\", data);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3dc5d1e052b41e3218351aab19693ac0c45cc5d23de1ce9e3e6bca2eefc9760", "structural_hash": "ffb9366efc2efcb92c2321d5c15a60cfdc3e864733fc0adcd617b3872b96d129", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_26770.go", "upstream_id": "BenchmarkTest26770", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\theader, err := c.FormFile(\"upload\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad upload\")\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\tdata := strings.Join(strings.Fields(uploadName), \" \")\n\tentries, _ := os.ReadDir(data)\n\tvar names []string\n\tfor _, e := range entries {\n\t\tnames = append(names, e.Name())\n\t}\n\tc.JSON(http.StatusOK, map[string]interface{}{\"listing\": names})\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2f86adc591511e4792034323faecf10952e099a32e58b5d5416c2238773ac48", "structural_hash": "bde0086f841cf3f6c2e07d86113462d05dc3bdae20a854f810e02dfc03c5e526", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02398.ts", "upstream_id": "BenchmarkTest02398", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = host || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n const inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(data))) {\n res.json({ validated: String(data) }); return;\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3136820037e48839a625d4ab1a5b4e31eadf301c9e9d2188904ba92ff435d739", "structural_hash": "81ff262b966a316c7ad88d14c622914d591b35ae51e6ca3e2fdf7d5e2c06d476", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00504.rb", "upstream_id": "BenchmarkTest00504", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = ENV[\"USER_INPUT\"] || \"\"\n system(\"echo \" + user_input)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e9a05511f0814d1f84feb61629c44b0759a7f0aba0d1c3e6d9c010c469e8cb7", "structural_hash": "7c5b34b930c9bff7e7d63bceea65e6e0b0646bfe5b450706b269c1e22c67a5d1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00672.py", "upstream_id": "BenchmarkTest00672", "language": "python", "code": "from fastapi import FastAPI, Request\nimport defusedxml.ElementTree\nfrom app_runtime import db\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n reader = make_reader(db_value)\n data = reader()\n defusedxml.ElementTree.fromstring(str(data))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xxe", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd753903b9d30cadb7dbccd86873c7b28f258d90253df0503b84de087a559f11", "structural_hash": "24260f2dad09d66c0b41cc76fef34079dc4c0eab08f92a3c8e5406141018e8ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06288.go", "upstream_id": "BenchmarkTest06288", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(pathValue)\n\tf, _ := os.CreateTemp(\"/var/app/tmp\", \"upload-\")\n\tif f != nil {\n\t\tf.WriteString(data)\n\t\tf.Close()\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-379"], "category": "insecure_temp_perms", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:insecure_temp_perms", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "227214065e4e1a0aabfbc8a00482a0fc1281aa1dda724186715f69141a419dc3", "structural_hash": "d164e71340995fbca0135e445e6ff3b7fcf17c7277c21a5827fdb7fbf4b0cd61", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27162.js", "upstream_id": "BenchmarkTest27162", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const buf = Buffer.from([10, 20, 30, 40, 50]);\n const idx = parseInt(data, 10);\n if (!Number.isInteger(idx) || idx < 0 || idx >= buf.length) { res.status(400).json({ error: \"index out of range\" }); return; }\n const value = buf.readUInt8(idx);\n res.json({ lookup: value }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-129"], "category": "array_index_oob", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "102473aec67efaa6595e9b2ab173d2f6d0db0e09a4e6dbd32cde6ecb93dc2b3a", "structural_hash": "7cd3c62ebd5c4618c2a06f9b60dcfeecc283e02eab7d9fd8690ad23fab53c1c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00582.py", "upstream_id": "BenchmarkTest00582", "language": "python", "code": "import os\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n data, _sep, _rest = str(user_id).partition('\\x00')\n os.system('echo ' + str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28ebbf466610c12c87f68f5683a6d9f078c3030d4970c6fd7a89c79ad7ca6f84", "structural_hash": "c242eb4226dd106d21a680832286bf8082ed20108f1dcf21d4b5f0275f6e68db", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00805.rs", "upstream_id": "BenchmarkTest00805", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let data = crate::shared::passthrough(multipart_value.clone());\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c0cfc3e633e1f64768a8489b0a200d712c0c2aaeaad0c0c855f6e430060ff45", "structural_hash": "ecba688a53760626a127f9b036360a7444301092e5d67c7a8c2c9f7fd8a2e18e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29299.sh", "upstream_id": "BenchmarkTest29299", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=\"${user_input//$'\\x00'/}\"\n printf \"X-Custom: %s\\r\\n\" \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "573cfdd80a6b61ee524a008448ed3e001d24ce869c184d9d9936cecb3d6607d8", "structural_hash": "411fbb7f0c81701aef70a6a42a84cb24ce7c4086f236003c10068842ec163c50", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02508.cpp", "upstream_id": "BenchmarkTest02508", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_param_value(\"filename\");\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n if (data == \"admin123\") std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5cb8d93dd273f7f7c27154bfb8e35180f7b805c40209daa91d4d86dfcb5bc7f", "structural_hash": "8860a6586a3accff66c813047779e20735b93252e02bb3c61ef0ee91138f76c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05939.ts", "upstream_id": "BenchmarkTest05939", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as https from \"https\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50439dd928a5cae8e8aa6a1f3d6becb9cf9712f910e43fb11580d858a5e7489a", "structural_hash": "e28c2170c533169b455f22052cdd150cbca9ca1e9b2345968062b98f8e71da82", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04039.go", "upstream_id": "BenchmarkTest04039", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tsegments := strings.Split(graphqlVar, \",\")\n\tdata := strings.Join(segments, \" \")\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 1, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e5b7bc42043459a611559aa1c124bc897650aec9582be756956a5f97caa788c", "structural_hash": "e5218511c413afa9fd102e7e849edb0629442f68946586ffef2c956c31791930", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05881.rb", "upstream_id": "BenchmarkTest05881", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n data = String(user_input).strip\n response.set_cookie(:session, { value: data, secure: true, httponly: true, same_site: :strict })\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1eb0f5a9b992fb7006f67f2566db26477733288a7907ec339a1e8c3f62aa6c62", "structural_hash": "e20c1a192c2d8ccd7dfc22378c53f896ab762776ddb8857774e91b9e1064b576", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04879.py", "upstream_id": "BenchmarkTest04879", "language": "python", "code": "from fastapi import FastAPI, Request\nimport random\nfrom dataclasses import dataclass\nfrom starlette.responses import JSONResponse\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n xml_value = (await request.body()).decode('utf-8')\n form = FormData(payload=xml_value)\n data = form.payload\n random.seed(int(data) if str(data).isdigit() else 42)\n token = str(random.random())\n return JSONResponse({'token': str(token)}, status_code=200)", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5940d52b16bfcb62be11cbd191626df9d9a47aeddf054166c66aab453ddb7e9c", "structural_hash": "bcb65d32fee0ebcceb9b1b5e58657e172334a4763f98d98469bb9c4321720b81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32848.go", "upstream_id": "BenchmarkTest32848", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tvar data string\n\tfor _, token := range strings.Split(cookieValue, \",\") {\n\t\tdata = token\n\t}\n\tparsedURL, err := url.Parse(data)\n\tif err != nil {\n\t\thttp.Error(w, \"invalid url\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tallowedHosts := map[string]bool{\"api.svc.cluster\": true, \"cdn.gocdn.net\": true}\n\tif !allowedHosts[parsedURL.Hostname()] {\n\t\thttp.Error(w, \"forbidden host\", http.StatusForbidden)\n\t\treturn\n\t}\n\ttargetUrl := data\n\thttp.Redirect(w, r, targetUrl, http.StatusFound)\n}", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3860758638f64524a266deb67066cad5699521fcab0987e0246d13fa10e3b3f", "structural_hash": "8fbd47a9b742bfe56a05a22e94f56f514611574c79169a81684709d6ab269552", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06510.go", "upstream_id": "BenchmarkTest06510", "language": "go", "code": "package testcode\nimport (\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tvar data string\n\tif len(fieldValue) > 0 {\n\t\tdata = fieldValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tc.Header(\"X-Custom\", data)\n}", "label": 1, "cwe": ["CWE-644"], "category": "http_header_script", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:http_header_script", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "270dd9b487725a6fcb623dc95c7a99144e3dbad88aee913549175788a9635f40", "structural_hash": "f0a7dc27e743cd8b7dabc94ead2c96daf92a9ad5f14e49e16429195fb04adeef", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_17349.js", "upstream_id": "BenchmarkTest17349", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = \"\" + userInput;\n const token = crypto.randomBytes(16).toString(\"hex\");\n ctx.body = { token };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-336"], "category": "same_seed_prng", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cccff7da9d12ab5375a818111bc8dd0a0f0a422d4ff9f4086c81f758fefcdc0f", "structural_hash": "372b241b7bc8c35dea61a1d1811a50b102b5b65171ce6b7d40ca2c2582357e64", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01306.java", "upstream_id": "BenchmarkTest01306", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { PUBLIC, INTERNAL, CONFIDENTIAL, RESTRICTED }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{refererValue});\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n String trustedClaim = data;\n response.setHeader(\"X-Claim-Trusted\", trustedClaim);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f5ea1787e865d3702ac710e58377895e069414935496f795c4056aff5f07359", "structural_hash": "15068e70f2da17ee98276cca984127efe83b27fca717550b56d26b3be313a1f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_42565.js", "upstream_id": "BenchmarkTest42565", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n ctx.session.data = String(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f8223554343e0c1689f40da9fca27367dc2330a3e686c44d1f09506e9be9d7e5", "structural_hash": "d50ae6115be5298327382cfdd32c72f0a9c4f7ce690876cb6fe0033a807cc90b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14696.sh", "upstream_id": "BenchmarkTest14696", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n if [[ ! \"$user_input\" =~ ^-?[0-9]+$ ]]; then echo \"not a number\" >&2; exit 1; fi\n divisor=\"$user_input\"\n if [ \"$divisor\" -eq 0 ]; then echo \"zero\" >&2; exit 1; fi\n result=$((100 / divisor))\n echo \"$result\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6cfefea18cf8dba01d7babfa807c44590243496e1847d2295d6d1f560f2a167c", "structural_hash": "45bba7a6887974df05d96b6ce84310cf9cc2d4f6af12d127e0be3a8a29ea8a77", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10070.sh", "upstream_id": "BenchmarkTest10070", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /etc/app/config)\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n curl -s https://api.lan.local/ingest --data \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-523"], "category": "cleartext_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2121f93baf109894f37e0e88c091a1516233dea8233cccc3bd2f7a33c5862b2e", "structural_hash": "0430624b75ad8187cd119587b527af0284e5bc4a3f181649a8baeb6863639f34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01212.php", "upstream_id": "BenchmarkTest01212", "language": "php", "code": "header('User-Agent', '');\n $data = sprintf('%s', $userInput);\n $processed = htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n return response('
    ' . $processed . '
    ')->header('Content-Type', 'text/html');\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88cfe144c2b9dd74694d42b99fc4089cc7eec85be6ecdcc689f1e9d1078dbf10", "structural_hash": "80734a4a0658c67ef390e1de9e7c2f8fd16bfee7f040945a9327d02e237f548a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07307.js", "upstream_id": "BenchmarkTest07307", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const data = await Promise.resolve(userInput).then(String);\n eval('eval(data);');\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-470"], "category": "unsafe_reflection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f3ed8cd2a4dbb10793a809825267f5686e46b19104339e2896538a337f0435d", "structural_hash": "b7865037bac0f56142f7a4d4a0ac11c40c4009efa81293a3e5ae79666c3bd160", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04222.java", "upstream_id": "BenchmarkTest04222", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.security.*;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String dotenvValue = java.util.Optional.ofNullable(System.getenv(\"DOTENV_VAR\")).orElse(\"\");\n String data = dotenvValue.isEmpty() ? \"default\" : dotenvValue;\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(data.getBytes());\n response.setHeader(\"X-Hash\", java.util.Base64.getEncoder().encodeToString(digest));\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1ef068875107bf84190a03f563902458147c9db8129872c47e93961ba6b2a1b", "structural_hash": "085606b37164e7fae65a976f95c5f0025d7ea0baf48ab9097b90b0e9901f9654", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02293.rs", "upstream_id": "BenchmarkTest02293", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if auth_header.len() <= 4096 { auth_header.clone() } else { auth_header.chars().take(4096).collect() };\n tokio::fs::write(\"/var/data/plaintext.txt\", &data).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "200c72f572657c875e6842e1e85e16bcec0f1fc21117b60c7f2d5f59f87aecd7", "structural_hash": "49b57dea9050d7f1928cb988b4c9c782576e6c4558614f878dc2e823d1a62969", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04289.rs", "upstream_id": "BenchmarkTest04289", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = db_value.split_whitespace().collect::>().join(\" \");\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e716e5aa4eb482e4fd87b331b1ed1150ddafbe6b06935c7230a6634b17c387d6", "structural_hash": "226960fa040e0dbe8f318069a414982cf2198ac7fbb37d466599871d2f953b60", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03679.go", "upstream_id": "BenchmarkTest03679", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"sync\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\t_cfgBytes, _ := os.ReadFile(\"/etc/app/config.json\")\n\tconfigValue := string(_cfgBytes)\n\tdata := configValue\n\tif _, after, ok := strings.Cut(configValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tvar secretCache sync.Map\n\tencrypted := encryptForStorage(data)\n\tsecretCache.Store(\"current\", encrypted)\n\tc.JSON(http.StatusOK, map[string]string{\"stored\": \"encrypted\"})\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartext_in_memory", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_in_memory", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c4dafff64759116076dcfb8d9dcb696ff46b258f221ad053a71a0b6c3b346e8", "structural_hash": "4bf50086815bedd46c5b6eae2201c37c0fc551a517010b3b300cf5e8661d86bc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03077.php", "upstream_id": "BenchmarkTest03077", "language": "php", "code": "json('payload', '');\n $data = '' . $userInput;\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('/var/log/app_action.log', 'action=' . (string)$processed . \"\\n\", FILE_APPEND);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "832366182d90a5a577e4160bac16e782d948ac3c969bfe6c380ac239131f9657", "structural_hash": "96fa159238d7ebe2a60d6fd4c38232f9a0381f128e3d1c09370c0d85b4baca0d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06002.ts", "upstream_id": "BenchmarkTest06002", "language": "typescript", "code": "import { Controller, Post, Redirect } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @Redirect()\n async benchmark_case(): Promise {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n return { url: data };\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f219c2c68758fd1b3a21370868d51f874e32a8c9df65121c5fd885ed2d73a156", "structural_hash": "b81b71b93ce7bda66efbffc4e6cd21f6fb8da7ea0bae6d910f04c1ea1a7fed47", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01732.ts", "upstream_id": "BenchmarkTest01732", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const data = await Promise.resolve(userInput).then(String);\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc23cfe41ba07d91ad9d26c72038ba10105890d0d9c4ebf4c8986830f997d349", "structural_hash": "a6b89b30c37b1d6f6ff15bfdf020e220ae1488a390b1083f5299005d74b2e620", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_12389.js", "upstream_id": "BenchmarkTest12389", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.query.id || \"\";\n const capture = (v) => () => v;\n const readInput = capture(userInput);\n const data = readInput();\n const processed = String(data).replace(/[\\r\\n]+/g, \" \").replace(/[\\w.+-]+@[\\w-]+\\.[a-z]{2,}/gi, \"[REDACTED_EMAIL]\").replace(/\\b\\d{13,19}\\b/g, \"[REDACTED_CC]\");\n console.log(\"Action: \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36cccc0c87a9e6bc7a6a166e34ed6f96b83db60b773bf699f7ca9e8d56df37af", "structural_hash": "441429a14e45ab8d51646b1b8e94cff97d5f4a38882d73566fc20ea68eadf800", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05018.sh", "upstream_id": "BenchmarkTest05018", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n printf \"X-Custom: %s\\r\\n\" \"$processed\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-113"], "category": "http_response_split", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca58ec39a0f5bc5eb691df41dce3918c1c144fa607e6c47dd9b7d0282cec185c", "structural_hash": "2ebcccdb3514b0884076d63257469536cbc5383db30c776fa8fcfe5a74b89a9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01272.ts", "upstream_id": "BenchmarkTest01272", "language": "typescript", "code": "import { Controller, Headers, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string, @Req() req: Request): Promise {\n const userInput = host || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2f69201b25d75b80532e034b43622c227499371632624d224b783e50bdeeba2", "structural_hash": "14cde68d204d93fddde8420758dcaf17eda44245627ca7e6310ade91ab32e89d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00277.java", "upstream_id": "BenchmarkTest00277", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\nimport java.net.*;\n@Path(\"/\")\npublic class benchmark_case {\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(\"text/plain\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(String rawBody, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n String data = String.format(\"field_%s\", rawData);\n URL url = java.net.URI.create(\"https://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL();\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n try {\n conn.connect();\n conn.getInputStream().close();\n } finally { conn.disconnect(); }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed11e2cb82ce8c34fbb871df38e5dbd7644de29877df8b6e725eaf987ffcfbd8", "structural_hash": "859671c6f1bd33a38697c1199939a66e4bba991a1c44a5edb0680733ac8a4af2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05784.php", "upstream_id": "BenchmarkTest05784", "language": "php", "code": "text;\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n posix_setuid(65534);\n return response()->json(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eae4997bd3f794e4e5199e401427be0893fc6fc3f664dd02973fe0b9e2d4f5c0", "structural_hash": "9f11a3049972fe29b8df5ed7b0c5afc211dd9e3e5b7c86f3d04defaaae17bd6f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01973.rb", "upstream_id": "BenchmarkTest01973", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c395ed970076ca69caf51c0ccd99de6dfb81d7e85e7ec4922088af7fcdcca31", "structural_hash": "7555f3ad75d9caf851ed0edda5449d2be345ce2f5582c2b3597249216cb2f0aa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00547.ts", "upstream_id": "BenchmarkTest00547", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!req.session || !req.session.user) { res.status(401).json({error: \"unauthorized\"}); return; }\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n res.json({ listing: entries }); return;\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ef46d4e0ef46e0bcd4b1e26ec1b135a1834252b43bae55fdead5fa9856c9ed5", "structural_hash": "8f04611c5763b1c38ac9a86555ae52d12d0257c927d9285db809f345d5d7c30f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05174.php", "upstream_id": "BenchmarkTest05174", "language": "php", "code": "headers->get('X-Custom-Header', '');\n $holder = new class((string)$userInput) {\n private array $attrs;\n public function __construct(string $v) { $this->attrs = ['payload' => $v]; }\n public function __get($name) { return $this->attrs[$name] ?? null; }\n };\n $data = $holder->payload;\n if (!in_array($data, ['asc','desc','name','created'])) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n file_put_contents('output.csv', (string)$processed . ',data' . \"\\n\", FILE_APPEND);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "81d43673b2391ebc10c6255425747b000d047eeabdbfcb5771817a3106c8caa4", "structural_hash": "2d733200b1845477f078dd2da9b65b2e807c486b2da75cda38e5519deeefe463", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_06169.ts", "upstream_id": "BenchmarkTest06169", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n JSON.parse(data);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e66f80187595a7a276b134b7e5771b51a56b96f4a3416604b6e4cc1d5301ce4a", "structural_hash": "1ff36c8affd1edc1f7ccc42e56171dc745c59158ceef10f55066767ecb0ae2e5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00759.rs", "upstream_id": "BenchmarkTest00759", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(body: web::Bytes) -> HttpResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = match json_value.chars().next() { Some(_) => json_value.clone(), None => \"default\".to_string() };\n let requested: u32 = data.parse().unwrap_or(0);\n let count = (requested * 4096) as usize;\n let _buf: Vec = vec![0u8; count];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "972e117ccd365bbb6c10bfd8dfa3ccfcd5d068b7b94fa63946af654fa7843ce6", "structural_hash": "a7443008382335c6ceb195dfd31e7a8fb2437c994a553f6e19d0daae6705623f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04855.rs", "upstream_id": "BenchmarkTest04855", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = origin_value.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n let _ = data.starts_with(\"true\") || data.starts_with(\"false\");\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "92d5f3ef9359601ca266b178fee18292721162f981bab45c6e4d85988eac0cf3", "structural_hash": "9293d665e282eb472f0e7c30c73ff04821ee50351fddb1eb963fcd8740503147", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02277.py", "upstream_id": "BenchmarkTest02277", "language": "python", "code": "from django.http import JsonResponse\nimport logging\nimport re\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n kind = 'json' if str(json_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(json_value).strip()\n case _:\n data = str(json_value)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n logging.info('User action: ' + str(processed))\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2cfb9d8f13d71bebe4df62a6aab1633b95173265d8d3829e8f6feca1b0993e9", "structural_hash": "6e66d63dea0aaa6c05eb7c35bd8a943d6e661822f2d240e97df6e512215a1436", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03013.rs", "upstream_id": "BenchmarkTest03013", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse reqwest;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data: String = db_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| db_value.clone());\n let _body = match reqwest::get(&data).await { Ok(r) => r.text().await.unwrap_or_default(), Err(_) => String::new() };\n crate::shared::db_exec_bind(\"INSERT INTO feed (data) VALUES ($1)\", &_body);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7db8da6725ec21f098223042186fc19bc0b786e365d1af8072e6504a7d58002", "structural_hash": "c8039275a69383e36b34c6d350e3946cafe3faecc584965c4d13047f79959525", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00403.c", "upstream_id": "BenchmarkTest00403", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n switch (user_input[0]) {\n case '\\0':\n data[0] = '\\0';\n break;\n default:\n snprintf(data, sizeof(data), \"%s\", user_input);\n break;\n }\n char _buf[16] = \"fixedcontent12\";\n int _i = atoi(data) - 8;\n printf(\"%c\\n\", _buf[_i]);\n}", "label": 1, "cwe": ["CWE-127"], "category": "buffer_underread", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:buffer_underread", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebb3b5c95c841cb53065753a389ddea5f01e29c4cb7460072647ac3ce97beb85", "structural_hash": "f93ad33ea8561bb7afb8cebdf6d448a4a89d473be6e22548b45b368edb8441e6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_28290.js", "upstream_id": "BenchmarkTest28290", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = data;\n res.set(\"X-Custom\", processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91e5654b2db96a96d26c73e1c19d032da7a08aaf121711dbe9921749040308dc", "structural_hash": "b7016979aa2f4813415cb013fc50449ffbb90cf4ba7f38f84d6575d176b2d385", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02480.rb", "upstream_id": "BenchmarkTest02480", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"socket\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = String(user_input).strip\n host = URI.parse(data).host rescue \"\"\n unless [\"api.intra.net\", \"cdn.railscdn.org\"].include?(host)\n render json: { error: \"forbidden host\" }, status: 403\n return\n end\n target_url = data\n TCPSocket.new(target_url, 80).close\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3b0879ea0bf812a2222849e817852ae9e6decfd9c7278e29408cb5b83fc0fe7", "structural_hash": "0b3c094f00e1c043a30bd0e3bcf26f532067d9850998672f5860a084304d0dad", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00477.rs", "upstream_id": "BenchmarkTest00477", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = header_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => header_value.to_lowercase(),\n \"f\" => header_value.to_uppercase(),\n _ => header_value.trim().to_string(),\n };\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4f66d7b2a398d5aae0a31de536b5441b55e76874660aee0eb5e4e86c0a07a67", "structural_hash": "33094a07bdfa493a4577fa7db6721e61090a0b2b217ca69b44e1ed1a27ba7c1c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04572.php", "upstream_id": "BenchmarkTest04572", "language": "php", "code": "getContent();\n $data = sprintf('%s', $userInput);\n $errno = 0; $errstr = '';\n fsockopen((string)$data, 80, $errno, $errstr, 30);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6de078d25f45260bae1d947ff0661e6c2ab7062f9aba21c4c33a2d28f9553d16", "structural_hash": "f652b59555b81703d5e8a4b0fa4d2cca9a324e32d8f4fdcf8dd766afdb93ec36", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08776.c", "upstream_id": "BenchmarkTest08776", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _d = atoi(data);\n int _r = 100 / _d;\n printf(\"%d\\n\", _r);\n}", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "013f651a9062e06e05ad560b6a666644d59b0e0f089b2f0e2bf31ae6dfaa7135", "structural_hash": "757775f1f116c86c41d773b62ab3d8d9207c3deb64419eea4415456155f3a72c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01487.cpp", "upstream_id": "BenchmarkTest01487", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.body;\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n char *_dst = new char[16];\n std::strncpy(_dst, data.c_str(), 15);\n _dst[15] = '\\0';\n delete[] _dst;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13b90860ec70e12f6af1fd1c156d2ef65f65225b1dfdee9bd4502696aca47900", "structural_hash": "2e59be485db47d65010bdda493ba80911d6228c29c2e5f1e166edb5833e27514", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05712.rs", "upstream_id": "BenchmarkTest05712", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse shell_escape;\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let ua_value = req.headers().get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: ua_value.clone() };\n let data = payload.value().to_string();\n let processed = shell_escape::escape(std::borrow::Cow::from(&data)).to_string();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e219acd69e1ded32aed4348ad4c18fbba5b81255a61f1cf811865042fe54c41", "structural_hash": "07a0955abbe81517f09c83fe0af390e8111b2fe34eaeb15f1208a341b3855509", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03855.php", "upstream_id": "BenchmarkTest03855", "language": "php", "code": " 'signed'], 200);\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41ea9047d83ca596f812703bb8df5084b281d239c8bbc8c8c4975b5ffb3079e7", "structural_hash": "4d0c70e96c26eafd44c38b9804330b7a706f70c0b097cdd16c274965a5ba4f81", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00286.c", "upstream_id": "BenchmarkTest00286", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n long _v = strtol(data, NULL, 10);\n signed char _c = (signed char)_v;\n printf(\"%d\\n\", (int)_c);\n}", "label": 1, "cwe": ["CWE-194"], "category": "sign_extension", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:sign_extension", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd120978b399f78467a270b9f4ede23583cda34e564a57d7037be238b236a84b", "structural_hash": "1993bd42dd77b3f6b93b85d7427061103f76d1a736e93af98597eafd5988c39d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01562.js", "upstream_id": "BenchmarkTest01562", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n authCheck(String(data), \"admin\");\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a08c2ef537fdfc650d62948ff91ab083e24dd6f9bc5ff8680b3a55e3a1652b0", "structural_hash": "a048aa6693c383eb1c278aee5491c13d26a59bed3df0acb41374c4884be515c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_14734.go", "upstream_id": "BenchmarkTest14734", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(uaValue)\n\tif data == \"admin\" || data == \"true\" || data == \"authenticated\" {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-602"], "category": "client_side_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c54c04a1fafad4383d4994a2958f315862d1b91a8b62c7283144db3de43fd8c9", "structural_hash": "2177ff5871037fe7e2988b5fc6b90c583f5c87ee0bfc12e60a8273733fe669c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01922.ts", "upstream_id": "BenchmarkTest01922", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.field as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed: string = data;\n res.send(\"
    \" + processed + \"
    \");\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f8b2ed56db6316c5aabcff45f73b7a9394dc3c273b0e9e4302c78914424414f", "structural_hash": "a49ea4ab329c20aa3b46351fa19e477a1d611f304921f064591d0fe33ac1a7bd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16268.js", "upstream_id": "BenchmarkTest16268", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n const allowedFiles = new Set([\"config.json\", \"index.html\", \"readme.md\"]);\n if (!allowedFiles.has(data)) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = \"/var/app/data/\" + data;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-426"], "category": "untrusted_search_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c69a735985357d58b54d7472fa3a6c5b00af7e07466419365ed981d4a61910b", "structural_hash": "dd4364abcbbc99a6d7a0f50deb5d2f551b489afb5c913a18b2d81aa95fd25ee7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03337.ts", "upstream_id": "BenchmarkTest03337", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.query.id as string) || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n fs.writeFileSync(\"/var/uploads/\" + data, \"data\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5388b47406ed45b5bd9f7e5e15fdca262169e09141433efc319e257633f6e022", "structural_hash": "0fa3c4b16e280337f145e2cd507136bf11ce8128bcbb8971f116e82b09146a97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_23800.js", "upstream_id": "BenchmarkTest23800", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n JSON.parse(userInput);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24e49223064a6f859a2f4499b6d1bbb6e1a65ba80a8ab517c3b1ad8b2f11451a", "structural_hash": "e85952310d88787aaf5cf46fa277139f9fc9b46d26b35f3cfe9f0f9d7e645b97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01104.ts", "upstream_id": "BenchmarkTest01104", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nodeUtil from \"util\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n if (typeof process.setuid === \"function\") process.setuid(parseInt(data, 10) || 0);\n res.json({ status: \"ok\" });\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7fab9ebe119a7b37e488fddc68b938ff09c288af825c1d106f09a2dd3258749", "structural_hash": "8310eda843a908307b30575d7a2960ddecf9046a8cb9523bd68880560c8d8502", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02971.rs", "upstream_id": "BenchmarkTest02971", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n struct FormData { payload: String }\n let data = FormData { payload: graphql_var.clone() }.payload;\n let result: Option = std::env::var(data.as_str()).ok();\n let value = match result { Some(v) => v, None => return (StatusCode::NOT_FOUND, \"\").into_response() };\n let _ = value;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d151c328974cbcd187e837b90c3a04d343583dd6006f04034e15b717a88a329d", "structural_hash": "d9115e063cf25212d0f614215c0b9718b92bfd2e8b06ee94b88dfc4114d7ad22", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37047.go", "upstream_id": "BenchmarkTest37047", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuaValue := r.Header.Get(\"User-Agent\")\n\tvar _b strings.Builder\n\t_b.WriteString(uaValue)\n\tdata := _b.String()\n\tcmd := exec.Command(\"echo\", data)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(output)\n}", "label": 0, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "520a6827fd83eb0382a7927ac53e236608afe8405cf40136ca67f8b5cb3c8143", "structural_hash": "1e8f7b57f9fccbaab340a3531f48f8984202ac5a44bfa3b40d8baf280b140246", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00150.rs", "upstream_id": "BenchmarkTest00150", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Some(Ok(mut _field)) = payload.next().await {\n let mut _buf: Vec = Vec::new();\n while let Some(Ok(_chunk)) = _field.next().await {\n _buf.extend_from_slice(&_chunk);\n }\n _mv = String::from_utf8_lossy(&_buf).to_string();\n }\n _mv\n };\n let data = urlencoding::decode(&multipart_value).unwrap_or_default().to_string();\n let store_cred = crate::shared::vault_get(\"app_secret\");\n let _ok = crate::shared::auth_check(&data, &store_cred);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f13efcf03dff8d4092798fe3912288eebfada4666cc8d6ef9c19f89a4677f468", "structural_hash": "14e97b9d015b3ec09504b47474438969c1cb5f643040f68d99734fd9e9b1cee7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03224.rs", "upstream_id": "BenchmarkTest03224", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let origin_value = req.headers().get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = origin_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => origin_value.to_lowercase(),\n \"f\" => origin_value.to_uppercase(),\n _ => origin_value.trim().to_string(),\n };\n HttpResponse::Ok().insert_header((\"X-Custom\", data.as_str())).finish()\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83a718985c3a26844a6cda63422046fd600518e281c6145d5761a056c49ccfab", "structural_hash": "8860405b5516681b8756fb98080110c5dcdce6fbbd21241292c4783757dfde4f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05682.ts", "upstream_id": "BenchmarkTest05682", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n db.query(\"SELECT * FROM users WHERE id = ?\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "194d4f7aa0dea666f9305f47b9a978c2dd13bceba677d4d82ed08554e25aa9e6", "structural_hash": "40201536408d8a6d6211f833fae37472d5089d2a4e0228373b963a9417d7f971", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03084.php", "upstream_id": "BenchmarkTest03084", "language": "php", "code": "header('X-Custom-Header', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]));\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b5e556b4dc58447c249c5980f20ba799588ccadc3f9f27df63de1289092967b", "structural_hash": "9ecc9fab3ab43d524c686991f484db82239e69e696e03a9053dc098de933b774", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01153.rs", "upstream_id": "BenchmarkTest01153", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n struct FormData { payload: String }\n let data = FormData { payload: upload_name.clone() }.payload;\n crate::shared::render_html(&data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e607c70813421f6f80f0c9673519c888ba6f9ad7ec1c0546875540702781d27c", "structural_hash": "65c81eb37cfb6b5b5ebb922bd3d980b074ce2e2238710e2acaa4ebef6fa19d5c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02661.php", "upstream_id": "BenchmarkTest02661", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $registry = ['report' => \\ArrayObject::class];\n $pluginClass = $registry['report'];\n $loaded = new $pluginClass(['payload' => $userInput]);\n $data = $loaded['payload'];\n file_get_contents('https://api.corp.lan/verify?d=' . urlencode((string)$data), false, stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63a8161e4dc3c5636d54ef500fc574b34321e65f5fa9330d6f487b100e87697e", "structural_hash": "f434679fd9527ff396cb34e84deec3b8df156ad176d282531a52c2a519b965c8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05560.py", "upstream_id": "BenchmarkTest05560", "language": "python", "code": "from fastapi import FastAPI, Request\nimport ldap\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n header_value = request.headers.get('x-custom-header', '')\n data = header_value if header_value else 'default'\n conn = ldap.initialize('ldap://localhost:389')\n conn.search_s('dc=example,dc=com', ldap.SCOPE_SUBTREE, '(uid=' + str(data) + ')')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d01958222e870f96bfab21750e339a655d8b6e9ededf9b884a59f7db33f198b0", "structural_hash": "41afeef16460d07c2c447341d96138788fffa0fcf0d13bbaa415a8439a3fb2c7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19341.c", "upstream_id": "BenchmarkTest19341", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s-bench\", user_input);\n long _req = strtol(data, NULL, 10);\n if (_req < 0 || _req > 2147483646L) return;\n long _alloc = _req + 1;\n printf(\"alloc:%ld\\n\", _alloc);\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c98376611b9fd1cabdf69e80fac959af001f4a059763891198089f4200c3358", "structural_hash": "1d370c9652ac19127c35e45275eeda706ae929b46bc041da9ca39dfdcb2c86e7", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00680.cpp", "upstream_id": "BenchmarkTest00680", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nextern \"C\" int encrypt_for_storage(const unsigned char *in, unsigned long inlen, unsigned char *out);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n unsigned char _ct[512];\n int _ctlen = encrypt_for_storage(reinterpret_cast(data.c_str()), data.size(), _ct);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.enc\", \"wb\")) { if (_ctlen > 0) std::fwrite(_ct, 1, (size_t)_ctlen, _sf); std::fclose(_sf); }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32692684d6959ece2ef243dd42b97c58c483becc8ec3b8f0cc77c4941f1d48e1", "structural_hash": "c9d31982a8fcc25a8e15d864802f12c774aadc3e008add81ab3a53769c00d2bf", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_24358.go", "upstream_id": "BenchmarkTest24358", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tdata := hostValue\n\tif _, after, ok := strings.Cut(hostValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\texec.Command(\"sh\", \"-c\", string(body)).Run()\n}", "label": 1, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f792d502573d0525acc365018c03051754f539e6e9bca660dc6cfbe5a2d60908", "structural_hash": "ef678357f5c91861c26494c7b891ee0c82f782c2a569eb9ef4db66af88f3e35a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02399.rb", "upstream_id": "BenchmarkTest02399", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n Digest::MD5.hexdigest(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf03f83d50626ba0b476088dd77411fe4fa4bed5aeaa0c82072bc3d2339684e2", "structural_hash": "ef7e71dc0fa89ef74fc9afe04bcd6fa054eda15eb0b72bf7d934ecf4844633a6", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00465.rb", "upstream_id": "BenchmarkTest00465", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n data = !user_input.empty? ? user_input : ''\n eval(data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "039d90f3995d27e9044290c32e77a73b2442c79680565916d75cc9f4da11ae3b", "structural_hash": "e2d8b019023ddd92148a66b90aede475358b25c021ddf90fc5c90bbdf9dc5beb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_31022.js", "upstream_id": "BenchmarkTest31022", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n const allowedFiles = new Set([\"config.json\", \"index.html\", \"readme.md\"]);\n if (!allowedFiles.has(data)) { ctx.status = 403; ctx.body = {error:\"forbidden\"}; return; }\n const checkedPath = \"/var/app/data/\" + data;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n ctx.body = fileContent;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c04327877be05abd083887c746e533b67be2bea999df1d02c3a1d3dbc915e42", "structural_hash": "b24797bed2123eb84833347f53288aa8885204c7011d782ddec43c4775af96cd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00842.ts", "upstream_id": "BenchmarkTest00842", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe, BadRequestException } from \"@nestjs/common\";\nimport * as fs from \"fs\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n (globalThis as any).lastRequestValue = userInput;\n const data: string = (globalThis as any).lastRequestValue;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1861606f2d519b74db96ae0f6d8285bc9f7b332837073952bf863c59af99c94", "structural_hash": "00ef34b41319658af56db2dbe9920bca8a7273a7fc923f2924f46a37d7e87b34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03679.java", "upstream_id": "BenchmarkTest03679", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.crypto.Cipher;\nimport javax.crypto.SecretKey;\nimport javax.crypto.spec.SecretKeySpec;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String secretValue = \"p4ssw0rd_test_xyz\";\n String data = secretValue.replace(\"\\u0000\", \"\");\n byte[] keyMaterial = java.security.MessageDigest.getInstance(\"SHA-256\").digest(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n javax.crypto.SecretKey key = new javax.crypto.spec.SecretKeySpec(java.util.Arrays.copyOf(keyMaterial, 32), \"AES\");\n byte[] encIv = new byte[12]; new java.security.SecureRandom().nextBytes(encIv);\n javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(\"AES/GCM/NoPadding\");\n cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, new javax.crypto.spec.GCMParameterSpec(128, encIv));\n byte[] ct = cipher.doFinal(data.getBytes(java.nio.charset.StandardCharsets.UTF_8));\n response.setHeader(\"X-Encrypted-Bytes\", java.util.Base64.getEncoder().encodeToString(ct));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29a0857e5c6c001755644c4f02af942f4a3c3f0426f33d200fccc832665b4284", "structural_hash": "ac62d4eb44faabf06edafc679da39864637559b2154d352cd64fd23926487301", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00623.rs", "upstream_id": "BenchmarkTest00623", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let _prefix: String = field_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => field_value.to_lowercase(),\n \"f\" => field_value.to_uppercase(),\n _ => field_value.trim().to_string(),\n };\n if data.len() > 8192 { return HttpResponse::BadRequest().finish(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return HttpResponse::Forbidden().finish(); }\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a72b11a1db568050243605180570f66ca83cdc56d7d178aa3dfec2a7bc02216a", "structural_hash": "5a554a4e203ae0841804a47c0f697677f46d8edfdc5f86c12e9c5a2638cca493", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01195.py", "upstream_id": "BenchmarkTest01195", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n secret_value = 'default_config_label'\n data = handle(secret_value)\n store_cred = os.environ.get('APP_SECRET', '')\n db.connect(host='localhost', user=str(data), password=store_cred)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8f40d121a5847043430e0e5210f70825897332365560a64705c0907ebce2f17", "structural_hash": "12855429e44cd5beca88de1c3076ac1e9750e07341c2a424ede7335037a3abcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01750.rb", "upstream_id": "BenchmarkTest01750", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n if [\"https://app.railscdn.org\"].include?(data)\n headers[\"Access-Control-Allow-Origin\"] = data\n end\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1b90dfc0129a8268a693c57578d691d996295247dc2c45edb2b40c75a5b51b5", "structural_hash": "d14cfeb45bbca6a94d3be15ef9d77e9b57b9c9d0147ce7842d940240116d3d97", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01425.cpp", "upstream_id": "BenchmarkTest01425", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"Authorization\");\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n res.set_redirect(data, 302);\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51b4dafe4ceca6d2ac15a7495cea83365fc1266f3d47762c30596cac2836d1de", "structural_hash": "d41af6ce0b9596758f3327a26d8eb14115beb0d585d4b20eeb48b87ba0e6e1d4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02767.ts", "upstream_id": "BenchmarkTest02767", "language": "typescript", "code": "import { Body, Controller, Post, Req, UsePipes, ValidationPipe, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto, @Req() req: Request): Promise {\n const userInput = dto.payload;\n const data = userInput != null ? userInput : '';\n if (data !== req.session.csrfToken) { throw new ForbiddenException({error: \"csrf mismatch\"}); }\n db.execute(\"UPDATE users SET name = ?\", [data]);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7bbf4a6b88b687c36de18283935294d6e431fca5cc4377dc660eb099d1c79e0", "structural_hash": "7ef0883e19d0158e238620156d7b5822d808d912a458186584fc6ae46ea57b54", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03332.c", "upstream_id": "BenchmarkTest03332", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct _xmlDoc *xmlDocPtr;\ntypedef struct _xmlXPathContext *xmlXPathContextPtr;\ntypedef struct _xmlXPathObject *xmlXPathObjectPtr;\n#define XML_PARSE_NOENT 2\n#define XML_PARSE_DTDVALID 16\n#define XML_PARSE_NONET 2048\n#define XML_PARSE_HUGE 524288\nextern xmlDocPtr xmlReadMemory(const char *_buffer, int _size, const char *_url, const char *_encoding, int _options);\nextern void xmlFreeDoc(xmlDocPtr _doc);\nextern xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr _doc);\nextern xmlXPathObjectPtr xmlXPathEvalExpression(const unsigned char *_str, xmlXPathContextPtr _ctxt);\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n xmlDocPtr _doc = xmlReadMemory(data, (int)strlen(data), \"noname.xml\", NULL, XML_PARSE_DTDVALID);\n if (_doc) xmlFreeDoc(_doc);\n}", "label": 0, "cwe": ["CWE-112"], "category": "missing_xml_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cf671b7d3becb757eb71f6b079b02cd513e671e879175f5129fbd61e20e8c0f", "structural_hash": "bc19db80470a27061c6cfdb478f3c9947d5ddf28d98abeac05a1a00956d20778", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05778.rb", "upstream_id": "BenchmarkTest05778", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n content_type :json\n JSON.generate({ auth: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "76d5c0d236510e3cba45de7bcbb4201116a01c2f95d22f5bbe3e0698d5b4aeee", "structural_hash": "7188d477a3baa3fec43372e21c9018985c0349e6dfe472e44c2fc4751d58aef5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00894.java", "upstream_id": "BenchmarkTest00894", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference ref = new java.util.concurrent.atomic.AtomicReference<>();\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Origin\") String origin, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n ref.set(originValue);\n String data = ref.get();\n if (!\"test\".equals(System.getenv(\"APP_ENV\"))) {\n ProcessBuilder pb = new ProcessBuilder(new String[]{\"sh\", \"-c\", \"echo \" + data});\n pb.redirectErrorStream(true);\n pb.start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95074d32d563cffd64fd2033131d17c887848c32b4c5b43cff209fb913776d93", "structural_hash": "2faff617cb3c956a006c6eb27c00caba75a5fe3d9326d453c0af038f0c48578d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03866.cpp", "upstream_id": "BenchmarkTest03866", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n if (FILE *_csv = std::fopen(\"/var/app/data/export.csv\", \"a\")) {\n std::fprintf(_csv, \"user,%s\\n\", safe.c_str());\n std::fclose(_csv);\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f53f9d1140dabe467306d93f3cd8caf22c8060bd9a2126d934ffceec73029c7", "structural_hash": "f2bd9a1915c816206fcbf1fcb841510b784fe7a477783ca7082db9ac325dd139", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15986.c", "upstream_id": "BenchmarkTest15986", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", user_input);\n if (remove(_path) != 0) return;\n}", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b9dcb415e09a2cd23127650c95779b468cb5db313f027cfcd1bf0dcbbf06f443", "structural_hash": "630f32aa2f29b561840e792c68caade29ce36a276e0b9f77a1d96a76f99d1738", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05319.php", "upstream_id": "BenchmarkTest05319", "language": "php", "code": "query->get('id', '');\n [$data] = [$userInput, 'http'];\n $logger->info('Action: ' . $data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53befe22c4eec2a00da64d16ac1bb03fb713aebd8ca934474974e28e4a0500a8", "structural_hash": "3a0ba02c2523f0c7521047c04679b999555894d419b3b733d14869162e4ca275", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09023.sh", "upstream_id": "BenchmarkTest09023", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n tar -czf /tmp/archive.tgz $processed\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3fa75757a65a71dac82c839b5619695a43f092be2f62d29ec032a46e4196e363", "structural_hash": "e39a8a6f3e96f433ffe13330e6d744de447c77f0a5357df3daf5a5cb7445a64e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15623.go", "upstream_id": "BenchmarkTest15623", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tsegments := strings.Split(graphqlVar, \",\")\n\tdata := strings.Join(segments, \" \")\n\tlog.Printf(\"request handling failed (input length %d)\", len(data))\n\tRespondJSON(w, http.StatusInternalServerError, map[string]string{\"error\": \"internal error\"})\n}", "label": 0, "cwe": ["CWE-201"], "category": "sensitive_sent_data", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "470b0c31efa2894c5aa1bb3a697f792dfac8e26866f06b66f60f63ca76a21c8b", "structural_hash": "34e7232921f6b2e135418799bf128d4375b674941eb953c1cc151f9d3555256b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03735.ts", "upstream_id": "BenchmarkTest03735", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = \"\" + userInput;\n const resolved = path.resolve(\"/var/app/data\", data);\n if (!resolved.startsWith(\"/var/app/data/\")) { res.status(403).json({error:\"forbidden\"}); return; }\n const checkedPath = resolved;\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7df20c0cd1b95a4a0426c491954e3559b085bbf5043aa70026c323d4e4e547c3", "structural_hash": "6289fee2289e37b3e24bc4abb32f54d84d391ca4cc903f6ae4995a32d9b3f616", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18992.go", "upstream_id": "BenchmarkTest18992", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tholder := InputCarrier{UserInput: hostValue}\n\tdata := holder.UserInput\n\tos.Remove(data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02327e65b2495f3936be8fc79595e96e845c4b727df9107faab3fccd0a20ad75", "structural_hash": "965f6088aa7bd22ce7bcc964ba5b66a3fa4d8dd773311a1bcc8a529fd9a4de6c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01403.rs", "upstream_id": "BenchmarkTest01403", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse log;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let tokens: Vec<&str> = db_value.split(\",\").collect();\n let data = tokens.join(\",\");\n let _crlf_stripped = data.replace(['\\r', '\\n'], \"\");\n static _RE_REDACT: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[A-Za-z0-9]{4,}\").unwrap());\n let processed = _RE_REDACT.replace_all(&_crlf_stripped, \"****\").to_string();\n log::info!(\"User action: {}\", processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "672859736d4a1a3a632494f5a95c40150d5d548b25603ec258910c553bef7e25", "structural_hash": "322b0dd685ef6684bc0053ce1abdcf945d98122cc1d8e833e42ef9b5f305beaa", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01746.go", "upstream_id": "BenchmarkTest01746", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tmultipartValue := c.PostForm(\"multipart_field\")\n\tvar data string\n\tif multipartValue != \"\" {\n\t\tdata = multipartValue\n\t}\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\thtmlOut := \"
    \" + processed + \"
    \"\n\tc.Data(200, \"text/html\", []byte(htmlOut))\n}", "label": 0, "cwe": ["CWE-83"], "category": "script_in_attributes", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05f76c6ec91dd4a877d95d018be7f296108e2f9c0c3b1ef92031d3bfcc5a4469", "structural_hash": "fd596594e43f31d7c59b41db018a9a596fedcd150af0445c15f6521a9fda27e4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07252.go", "upstream_id": "BenchmarkTest07252", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/md5\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tdotenvValue := os.Getenv(\"DOTENV_VAR\")\n\tvar _b strings.Builder\n\t_b.WriteString(dotenvValue)\n\tdata := _b.String()\n\thash := md5.Sum([]byte(data))\n\thashStr := fmt.Sprintf(\"%x\", hash)\n\tc.JSON(http.StatusOK, map[string]string{\"hash\": hashStr})\n}", "label": 1, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "082d57662a72bf6eee752f1bc94e1fa1e9e7609b538f9c8caec61bd6a78b4f59", "structural_hash": "7d7ac44ebf9402f57c3c134e8595d585b27690f24a41215c1a8c8047089f3e92", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05277.sh", "upstream_id": "BenchmarkTest05277", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n echo \"$data\" | openssl enc -aes-128-cbc -nosalt -iv 00000000000000000000000000000000 -K \"$DATA_ENC_KEY\" -out /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-329"], "category": "no_random_iv", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "392b1832dc918951c1603a5e87bc1e403d71be45b86d4a29f7082fa495a9a6c4", "structural_hash": "d2840dd723be11ec8af0076f0a5c0123b6381f624bd6a59d211f0ddf396a63ed", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05487.rb", "upstream_id": "BenchmarkTest05487", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n @user_input = user_input\n data = @user_input\n unless data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n render html: (\"
    \" + processed + \"
    \").html_safe\n end\nend", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "327fbfeae73fd718aede722a4600a3de7978bf7de9ea812a3f7b9c77868187ec", "structural_hash": "f6a3679cb3fe36a2a422f3e54212ef27f230da56314fc712bb94cae00e89e212", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28444.sh", "upstream_id": "BenchmarkTest28444", "language": "bash", "code": "benchmark_case() {\n user_input=\"d1Fg7Ht3Vk8Mq2Pn6Ws\"\n echo '{\"sub\":\"1\"}' | openssl dgst -sha256 -hmac \"$user_input\" > /dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "32c81b92794b6de4e76d973bba039349340e8aa7d835f552b923f49d9164d13d", "structural_hash": "6269d1534eb6fb49bc39fed72a545360cb2a3bc6292f5da1116bbc2f1e7a0fa1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00102.py", "upstream_id": "BenchmarkTest00102", "language": "python", "code": "from django.utils.safestring import mark_safe\nfrom django.http import HttpResponse\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n data = '%s' % str(referer_value)\n return HttpResponse(mark_safe('
    ' + str(data) + '
    '))", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "667ba1b4522868f4c736b5e01743075fb73bf5eab27537c54051218e040fdd8b", "structural_hash": "e09fba27f3e8965a6914b184c29873276922cb14c0b98279d8ea53f6b749d467", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02574.java", "upstream_id": "BenchmarkTest02574", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"User-Agent\") String userAgent, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uaValue = userAgent != null ? userAgent : \"\";\n java.util.function.Function initialFn = s -> s.replaceAll(\"[ ]{2,}\", \" \");\n java.util.function.Function transformed = initialFn.andThen(String::strip);\n String data = transformed.apply(uaValue);\n if (\"admin\".equals(data) || \"ROLE_ADMIN\".equals(data)) {\n response.getWriter().print(\"{\\\"status\\\":\\\"ok\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a03128509895879a74c01b13e51bf1c730cc0768d04b277fbcaba50954c25cc8", "structural_hash": "e2cde8d4527140efdbe9f2edc57ea496a7d8efaefcca80468182bbe2a4d732c2", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02500.rb", "upstream_id": "BenchmarkTest02500", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = (params[:variables] || {})[:input].to_s\n data = \"#{user_input}\"\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89670acedefba1d9f9fc7006a45d0d89e3b94031cd68c95f71230d9a8e3009c8", "structural_hash": "9a4366b1f3ed94d250b4bf969c3cd0c62f3d0004db6273f099f7d996ac87258b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04110.java", "upstream_id": "BenchmarkTest04110", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"comment\") String commentText, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String commentValue = java.util.Optional.ofNullable(commentText).orElse(\"\");\n java.util.function.Function tabNormalizer = s -> s.replaceAll(\"[ ]{2,}\", \" \");\n java.util.function.Function decorated = tabNormalizer.andThen(String::strip);\n String data = decorated.apply(commentValue);\n long rolloutEpochMs = Long.parseLong(System.getProperty(\"feature.rollout.epoch.ms\", \"0\"));\n if (System.currentTimeMillis() >= rolloutEpochMs) {\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b85c94bdf134767188cef5f0292a042ce865fc025f1ee1f8919ee28c2d71541", "structural_hash": "110e9cb0c247447ef3ac119b7fdc93aee09195cf816ad3b27c62131330fc5c53", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01836.py", "upstream_id": "BenchmarkTest01836", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n data = ' '.join(str(multipart_value).split(' '))\n buffer = bytearray(int(data) if str(data).isdigit() else 0)\n return JsonResponse({'allocated': len(buffer)}, status=200)", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f9de9b0ced652d28295e1217d8d8233f753e7a82bae6daadc740bbf31c78cf7", "structural_hash": "afa9f9aca58f18a77b5d0578128fdfeb0110296796f602d0b8c0f6b922e39c8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05490.ts", "upstream_id": "BenchmarkTest05490", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as nunjucks from \"nunjucks\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.multipart_field as string) || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed: string = data;\n res.send(nunjucks.renderString(processed, {}));\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a4d2beafb681c4d659539daca4f5ef6e7ade0cbb716bb7563e7e74e04d7bdc8", "structural_hash": "c9b7850164d41c65c26836e25410cfb0e70acc9f76da9d39ca5acd5bd7106771", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_08963.go", "upstream_id": "BenchmarkTest08963", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tvar data string\n\tif forwardedIP != \"\" {\n\t\tdata = forwardedIP\n\t}\n\tif strings.HasPrefix(data, \"10.\") || strings.HasPrefix(data, \"192.168.\") || strings.HasPrefix(data, \"127.\") {\n\t\tRespondJSON(w, http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-291"], "category": "reliance_ip_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b6b38a009a4eb10e05ae011228ba3ef673e7f944c28d53eddd2c67645e7898e", "structural_hash": "9efc815c82fb7c00136f9e0d29d91420383403165ecc0c14d908b0ae4a1ce9bb", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35688.go", "upstream_id": "BenchmarkTest35688", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"regexp\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(commentText)\n\tinputPattern := regexp.MustCompile(\"[a-zA-Z0-9_-]+\")\n\tif inputPattern.MatchString(data) {\n\t\tw.Header().Set(\"X-Validated\", data)\n\t}\n}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84f82962cdbc98f67a9c0f38a559d72b0d96928f2318fb70dd35ef61eee9a458", "structural_hash": "6cf8b823d1ac861165b7a30388bae0e2cf07d6ce2494317f0db2a8c20311e04e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_32624.js", "upstream_id": "BenchmarkTest32624", "language": "javascript", "code": "const fs = require(\"fs\");\nconst path = require(\"path\");\nasync function benchmark_case(req, res) {\n const userInput = fs.readFileSync(0, \"utf8\");\n const data = \"\" + userInput;\n const checkedPath = \"/var/app/data/\" + path.basename(data);\n const fileContent = fs.readFileSync(checkedPath, \"utf8\");\n res.send(fileContent);\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c08499311bbc2071e23c6cfa4676ce32a7d947f23c9f02ceb39bdc8f276320c", "structural_hash": "e42ac73974b0eee7baa0da7152a6a3a8209d0c66941d28660f449d92b9707ada", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00719.py", "upstream_id": "BenchmarkTest00719", "language": "python", "code": "from django.http import JsonResponse\nimport csv\ndef benchmark_case(request):\n forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')\n pending = list(str(forwarded_ip).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n cell = str(data)\n if cell[:1] in ('=', '+', '-', '@', '\\t', '\\r'):\n cell = \"'\" + cell\n with open('output.csv', 'a', newline='') as fh:\n writer = csv.writer(fh, quoting=csv.QUOTE_ALL)\n writer.writerow([cell])\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3f7dd11eab0dea8bb6a9b253a69e7b65d3b56e1ea726291e5945f827705299a", "structural_hash": "1cfd0ce6421d314c908a9d884658673a54cbef8c615d795effdb46b49fe3c7c1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03099.ts", "upstream_id": "BenchmarkTest03099", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.params.id as string) || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n if (!shared.authzCheck(req.session.user, data)) { res.status(403).json({error: \"forbidden\"}); return; }\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "547e2b46b1bf8b720af80805dd96363b8ea824562d0d4862def00ee3652fe744", "structural_hash": "8f97b19c7e510f5a8a41ca817e111021ea8d5c25c89d83f6cf8edccb9bd51ada", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04063.cpp", "upstream_id": "BenchmarkTest04063", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n if (FILE *_sf = std::fopen(\"/var/data/secrets.txt\", \"w\")) { std::fprintf(_sf, \"%s\", data.c_str()); std::fclose(_sf); }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6ff72a97db9297e670ce3ae7dc0b49f11c7a7a43f02280ed027e015a017fb89", "structural_hash": "b2326d049f38522f24d899f0b8ea084d99bf203fd6d780cfa6a29d1186f4b7dc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33478.sh", "upstream_id": "BenchmarkTest33478", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n _rest=\"${data#*://}\"\n exec 3<>\"/dev/tcp/${_rest%%[/:]*}/80\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37b6503520a51c9f6601a0c157229dc87441e3feee302f934dde2ee75865be6c", "structural_hash": "a84fff58690775e5a26dad8dd32477defee17dda72cd261e13ebdac327d137dd", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05612.rs", "upstream_id": "BenchmarkTest05612", "language": "rust", "code": "use ammonia;\nuse axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n for token in json_value.split(',') { data = token.to_string(); }\n let processed = ammonia::clean(&data);\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d8b16c3c7b80505ba6261a164561371edb44806b5e092b673494647c530793f", "structural_hash": "0590e8c83d791a97f901bb8b16e686398d6c0fec05fee60285a58bad53379067", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23734.go", "upstream_id": "BenchmarkTest23734", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tdata := hostValue\n\tif _, after, ok := strings.Cut(hostValue, \",\"); ok {\n\t\tdata = after\n\t}\n\thttp.SetCookie(c.Writer, &http.Cookie{Name: \"session\", Value: data, Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f194f09945efa5aff85bc1a2181d408432bffcc6cd692425ada8fa33d4dbf12", "structural_hash": "4946f054ddd26fb093c4459f32c208fcea5e3b2b9d117cb0641ff348542edfc1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02197.py", "upstream_id": "BenchmarkTest02197", "language": "python", "code": "from django.http import JsonResponse\nfrom cryptography.fernet import Fernet\nimport os\ndef benchmark_case(request):\n with open('/etc/app/config.json', 'r') as fh:\n config_value = fh.read()\n kind = 'json' if str(config_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(config_value).strip()\n case _:\n data = str(config_value)\n key = os.environ['DATA_ENC_KEY'].encode()\n encrypted = Fernet(key).encrypt(str(data).encode())\n with open('/var/data/secrets.enc', 'wb') as fh:\n fh.write(encrypted)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28eea6c92647e1a23ffc960b8b2a231b9e705de18ecc3b4742030eac77122c8c", "structural_hash": "91374f86b7775cc03407e55c41246632ae29d8a73b7476428cb0ad9896bb1da0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05495.rs", "upstream_id": "BenchmarkTest05495", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n data.push_str(&forwarded_ip);\n crate::shared::render_html(&format!(\"
    {}
    \", data));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f60f3ace62ba5cf814f745203a4909f52028da7677fdf335a549468f50408e1", "structural_hash": "c10fa02f2a4bfd66937ff66ea9d523d4242d9b6c9876f393e68b44fcec06b4f5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04059.ts", "upstream_id": "BenchmarkTest04059", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.headers[\"x-custom-header\"] as string) || \"\";\n const data = Buffer.from(userInput, \"hex\").toString();\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46fc709fe229b8b2dbf4febab01ab196fbc3d2aa3ab1e5b159afe78f7f8a5857", "structural_hash": "f9f7b92d0599de1845c55cadab088a70996374467a201d28ff5f20b3e51dfd34", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01677.c", "upstream_id": "BenchmarkTest01677", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n char *_base = malloc(strlen(data) + 8);\n if (_base == NULL) return;\n strcpy(_base, data);\n free(_base);\n}", "label": 0, "cwe": ["CWE-761"], "category": "free_not_at_start", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:free_not_at_start", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "587623e4a4ea2d32d2259484e01b36480cb2b82c975cdae9bbbb47945661cc37", "structural_hash": "a4147c0ed3c03573ae5b6829d56bc7eb0165128e2f2a1493f06212dc9e2ca591", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10721.c", "upstream_id": "BenchmarkTest10721", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \ntypedef struct ldap LDAP;\ntypedef struct ldapmsg LDAPMessage;\n#define LDAP_SCOPE_SUBTREE 2\nextern int ldap_search_ext_s(LDAP *_ld, const char *_base, int _scope, const char *_filter, char **_attrs, int _attrsonly, void *_sc, void *_cc, void *_tmo, int _slim, LDAPMessage **_res);\nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n LDAP *_ld = NULL;\n char _filter[512];\n snprintf(_filter, sizeof(_filter), \"(uid=%s)\", data);\n LDAPMessage *_res = NULL;\n ldap_search_ext_s(_ld, \"ou=people,dc=example,dc=com\", LDAP_SCOPE_SUBTREE, _filter, NULL, 0, NULL, NULL, NULL, 0, &_res);\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4ae4dba2ff2c871f4f22d3f0f3d8b43423047a244fa8c4c97614545e0090701a", "structural_hash": "f4d59f11900e529187d0068afb556208509af869637ca4ae3269a5007ae364ba", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00656.c", "upstream_id": "BenchmarkTest00656", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n int _uid = atoi(data);\n setuid((uid_t)_uid);\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:privescalation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a2b801e1cba0069414ebc298a55a2602c876cfff5547b325159508c2b851eaa", "structural_hash": "ee7471401e07750a03174620f0573d79988025dc7f1d9d4a21b41ec7a553b70e", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01399.rs", "upstream_id": "BenchmarkTest01399", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let host_value = req.headers().get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let _prefix: String = host_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => host_value.to_lowercase(),\n \"f\" => host_value.to_uppercase(),\n _ => host_value.trim().to_string(),\n };\n let processed = html_escape::encode_text(&data).to_string();\n crate::shared::render_html(&format!(\"
    {}
    \", processed));\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "229706b2a84698bd9705ad69099d911506969c2651bc36dabccd800a044637e8", "structural_hash": "10179ad17136b1bfa025889624fa467954b053d77cedc7a29451d33e0132f965", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01925.cpp", "upstream_id": "BenchmarkTest01925", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.path_params.at(\"id\");\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n if (data == \"admin123\") std::cout << \"authenticated\" << std::endl;\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:default_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b451a44b20afdfe090e4c292c73033d05e6d65a064171e3bbd5cb81a4d388fbc", "structural_hash": "e8ad76d9d194cfa86e1cb069d491491fc7fc13f2009d91dec05638dff48b869d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01333.ts", "upstream_id": "BenchmarkTest01333", "language": "typescript", "code": "import { Controller, Post, ForbiddenException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nimport * as http from \"http\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = shared.redisClient.getSync(\"session:key\");\n const data = Buffer.from(userInput, \"utf-8\").toString();\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const _blocked = /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(_host) || /^\\d+$/.test(_host) || _host === \"localhost\" || _host === \"metadata.google.internal\" || _host === \"metadata\" || _host.startsWith(\"[\");\n if (_blocked) { throw new ForbiddenException({error:\"private or loopback address not allowed\"}); }\n const targetUrl = data;\n http.get(targetUrl);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f7a6904ac4e64c73f39d60bc34aef0903bd9081285d9f4bf7c5734ebe2ddd33", "structural_hash": "a1a066f4d248a125ee75c8596d5be8e8836a098b590153ed681b4d7edadc2b9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00188.php", "upstream_id": "BenchmarkTest00188", "language": "php", "code": "headers->get('Origin', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', getenv('DATA_ENC_KEY'), 0, $iv, $tag);\n $ciphertext = base64_encode($iv . $tag . $_ct);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d2975cd1326bc06d9938ec8973db61c9dba87ff10b47704fb65fa6d518aed27", "structural_hash": "6e41f118d625f71d2e47eb090b6aafd5fe5994a418c95d52f485761b40463c3a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05664.java", "upstream_id": "BenchmarkTest05664", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String processed = userId.replace(\"\\r\", \"\").replace(\"\\n\", \"\").replaceAll(\"[A-Za-z0-9]{4,}\", \"****\");\n response.setHeader(\"X-Forwarded-For\", processed);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33409ff6909bc921e4962c19da7351690c92d241b456be9edd3cb74718ea2c1a", "structural_hash": "d035c9ea5c6b287e32009bc3a470519eb11fadd2efe6d87dd97f0be7a6b31b2a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02534.ts", "upstream_id": "BenchmarkTest02534", "language": "typescript", "code": "import { Controller, Headers, Post, Req, ForbiddenException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as shared from \"./shared\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string, @Req() req: Request): Promise {\n const userInput = hdr || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n if (!shared.authzCheck(req.session.user, data)) { throw new ForbiddenException({error: \"forbidden\"}); }\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5c4e31b9667136b864922342de4462a0965d61981ef7d10136d651b162f3aa68", "structural_hash": "6b2fe7ce4e087bdebccd336bd54743cb3bfdf7b6a5082490ad401af11ebaed56", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02300.go", "upstream_id": "BenchmarkTest02300", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-ldap/ldap/v3\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar commentText string\n\tDB.QueryRow(\"SELECT text FROM comments LIMIT 1\").Scan(&commentText)\n\tdata := strings.ReplaceAll(commentText, \"\\x00\", \"\")\n\tldapConn, ldapErr := ldap.DialURL(\"ldap://localhost:389\")\n\tif ldapErr != nil {\n\t\tc.String(http.StatusInternalServerError, ldapErr.Error())\n\t\treturn\n\t}\n\tdefer ldapConn.Close()\n\tsearchReq := ldap.NewSearchRequest(\"ou=people,dc=example,dc=com\", ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, \"(uid=\"+data+\")\", []string{\"cn\"}, nil)\n\tsr, _ := ldapConn.Search(searchReq)\n\tif sr != nil {\n\t\tc.Header(\"X-LDAP-Count\", strconv.Itoa(len(sr.Entries)))\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4cd1ac70dbcfc08e0a77c2ecd9e58b7d31d75ec0498479d0150028ad0095164b", "structural_hash": "ed14a98fafba68099e4cde9bef161c9b789e296c9e4979178c0554f55bd3ae9a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00357.ts", "upstream_id": "BenchmarkTest00357", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n console.log(\"Action: \" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "995a31d4cc8ee039469dd07baf489efd562c529f965d8bb2c6d1b4ced058281f", "structural_hash": "6e7ebfbcbb0bb46b7fc4d9f8424a84296d6814fa25eea3110b5390dbb88f4942", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01797.php", "upstream_id": "BenchmarkTest01797", "language": "php", "code": "getContent();\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n return new RedirectResponse($data);\n }\n}", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c5656dc5649468baa5b7a375c61147d59c741f10c909d7811d178958f690dd02", "structural_hash": "da612d7f42111aee55227d50a382f58c4647f8f42bd956ccbf71b5cb2ee2172c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04791.ts", "upstream_id": "BenchmarkTest04791", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as crypto from \"crypto\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const data = String(userInput).slice(0, 200);\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c96ee9687048d9e7b519bed2e7b59bccabad8251ebdffdee811ce97ed1185bd", "structural_hash": "7598c8f51c8a72993915e527b53e637b9313db42912144eb78cb4631c040d826", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04501.rs", "upstream_id": "BenchmarkTest04501", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse hex;\nuse tokio::process::Command;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = String::from_utf8_lossy(&hex::decode(&user_id).unwrap_or_default()).to_string();\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n Command::new(&processed).arg(\"--run\").output().await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5890e4fd2b8817c02b6ad888b1309977d9567bf386a5632c85140c7d024d7731", "structural_hash": "082798eef77159ad8e96af3d68c19098d8c6c73afcc4b9ae89105ec8a729bc84", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05019.rs", "upstream_id": "BenchmarkTest05019", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let _prefix: String = field_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => field_value.to_lowercase(),\n \"f\" => field_value.to_uppercase(),\n _ => field_value.trim().to_string(),\n };\n let size = data.parse::().unwrap_or(1024); let _data = vec![0u8; size];\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3e4a2433da24c3f71e9a8286678e894c1aa973a821a9430c332b1f585f6d649", "structural_hash": "d3e44cffa987443a244c7e0f7e15d46682187e08ed78b0a1c0b2c757ed43f91f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05936.ts", "upstream_id": "BenchmarkTest05936", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = ((req as any).rawBody as string) || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n fs.unlinkSync(\"/var/app/data/\" + data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "922fdc82c8ed9454c353840fce6050a24ddd3814bb846cb6f3465f100c2c15da", "structural_hash": "039a92749c974fc0cd2a3069b55fa0442b5a367a0f6b3485e1b3f17e41a89928", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03295.java", "upstream_id": "BenchmarkTest03295", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.List tokens = new java.util.ArrayList<>();\n for (String token : jsonValue.split(\",\")) { tokens.add(token.trim()); }\n String data = String.join(\",\", tokens);\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0df3580193824d774db6c113844a1a094a883fcebae58e0ad3f7851170a82a9e", "structural_hash": "6b14b39f0a268db623431c5ff1d8f9399995e6814b92de6ae1f6a28aa8ae0e42", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00307.py", "upstream_id": "BenchmarkTest00307", "language": "python", "code": "from flask import Flask, jsonify\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Cipher import PKCS1_OAEP\napp = Flask(__name__)\n@app.route(\"/benchmark_case/\", methods=[\"POST\"])\ndef benchmark_case(path_param):\n path_value = path_param\n key = RSA.generate(2048)\n ciphertext = PKCS1_OAEP.new(key).encrypt(str(path_value).encode())\n return jsonify({'length': len(ciphertext)}), 200", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weakkeylength", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d61fea03df761a795f525e80ef0aaeb14fcd1f418b6ea6db3cc22d5128624fb", "structural_hash": "4886fc6ee94f490c5bda23bec89ade5e17f9ff9ac6f3c3844cf3ce4e80a853ee", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02684.py", "upstream_id": "BenchmarkTest02684", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n def normalize(value):\n return value.strip()\n data = normalize(origin_value)\n if len(str(data)) > 8192:\n return JsonResponse({'error': 'Internal error'}, status=400)\n return JsonResponse({'error': 'An internal error occurred'}, status=500)", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd645272ebe4bcff9a45b132e3e8a99fc1913a26049de5961872f7953b2a236d", "structural_hash": "c26b27a06b10f011ac5173228fd4687b61a348695d466c1d7d436996d7ffb8c5", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04042.php", "upstream_id": "BenchmarkTest04042", "language": "php", "code": "header('Authorization', '');\n $data = (!empty($userInput)) ? $userInput : '';\n abort(500, $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "42f945bbe707cbf43311cf5e79b7762b40844b09bef88a03ce6af631a270b2f4", "structural_hash": "b9a67c6915cf33055e3219d06f833e355c6bce04f580b49b6c921ec4c3d29bcc", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01297.c", "upstream_id": "BenchmarkTest01297", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_invoke(c_passthrough, user_input);\n int _v = atoi(data);\n switch (_v) {\n case 1: printf(\"one\\n\"); break;\n case 2: printf(\"two\\n\"); break;\n default: printf(\"other\\n\"); break;\n }\n}", "label": 0, "cwe": ["CWE-478"], "category": "missing_default", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:missing_default", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eacf6fe1357de73d6c9e52bbb480007a4d048fa98797e38233ecf5115e65c482", "structural_hash": "468fae6dacefa4edb506199b8813ead2eb33604d52f2b6b287244d7ed8196965", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05463.rb", "upstream_id": "BenchmarkTest05463", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless session[:user_id]\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n session[:data] = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3f0e8bebfbde19f06a015d835f127114bac8692b36d2b8bdbc940f433f22f65", "structural_hash": "793c5249d966a68f075af27070cfd137a01e9a38e302d4316bb8b44af0d8042a", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03623.rb", "upstream_id": "BenchmarkTest03623", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"csv\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n CSV.open(\"/var/data/output.csv\", \"a\") { |csv| csv << [data, \"data\"] }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "647ac03be76877690f054cfa5ca5b9feec0bac068f451f09044c9dff6d0089eb", "structural_hash": "6b7ae392235ceee16ce005adde146f05487150c88f0634a302bc4b136789ae51", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37758.js", "upstream_id": "BenchmarkTest37758", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || \"\"; }\n catch (e) { data = String(userInput); }\n authCheck(\"admin\", String(data));\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eef8c5c3b92cbfe15acbf223c22789642c59666e5dfc7da36dbd4dbac09a7fe8", "structural_hash": "8cd7ce2796e7a4c0ab4b92b137b4452a3d8601bedc39a461b0fa732051146f30", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09656.sh", "upstream_id": "BenchmarkTest09656", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n if [[ ! \"$data\" =~ ^-?[0-9]+$ ]]; then echo \"invalid\"; exit 1; fi\n parsed_id=\"$data\"\n mysql -e \"SELECT * FROM users WHERE id = $parsed_id\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0966549dcc1bc5cc7f65a90bc298dc52ce355fe3a50ccabab52c5b75954639a5", "structural_hash": "b20132333403a809b37f057b3e7f9de79dff8f5ca4e4208c093ee2e0411aaa62", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00357.py", "upstream_id": "BenchmarkTest00357", "language": "python", "code": "from django.http import JsonResponse\nimport re\ndef benchmark_case(request):\n origin_value = request.META.get('HTTP_ORIGIN', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(origin_value)\n data = collected\n processed = re.sub(r'[A-Za-z0-9]{4,}', '****', str(data).replace('\\r', '').replace('\\n', ''))\n return JsonResponse({'status': 'ok'}, status=200, headers={'Content-Language': str(processed)})", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de51592825d88fe903a63c9e3b2e1e41269fbd901653d1539039470c8abc5152", "structural_hash": "a5fb0936e436f1ac2d0ff7044404574bb4c84af441194c8f2a17d22494f07e08", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35189.js", "upstream_id": "BenchmarkTest35189", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-forwarded-for\"] || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n libxmljs.parseXml(data, { noent: false, nonet: true });\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-776"], "category": "xml_entity_expansion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6314e7fd0fbdfc61c6332f2344cc7dc94221e751f3d3df77512ab8ccf1826a95", "structural_hash": "718a7ef5da71a208822e8487daa10219b16785b65f7d44a91e10e14fc4e4a901", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01510.rs", "upstream_id": "BenchmarkTest01510", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = match header_value.chars().next() { Some(_) => header_value.clone(), None => \"default\".to_string() };\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac1408f00ff610e8e3c75315c4f0d007d5033f296e4225fb0a9277f7b5eab927", "structural_hash": "81c45a9f7007dfdfbd85f5d3f92133e49ca54946808a958e164da32aae1edf8f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04440.php", "upstream_id": "BenchmarkTest04440", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n $resp = new JsonResponse(['ok' => 1]);\n $resp->headers->setCookie(\\Symfony\\Component\\HttpFoundation\\Cookie::create('session', (string)$data, 0, '/', null, true, true, false, 'Strict'));\n return $resp;\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7009c4398471f778e54d7dc51e444c61d1e4c5bba998f464bee339df2c35a620", "structural_hash": "ea10bafe2f43dcce9c6303a988983535e25efd89a4beffca936dc5a2e7da12d0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03183.c", "upstream_id": "BenchmarkTest03183", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n long _v = strtol(data, NULL, 10);\n short _s = (short)_v;\n printf(\"%d\\n\", (int)_s);\n}", "label": 1, "cwe": ["CWE-197"], "category": "numeric_truncation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:numeric_truncation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "129b83d874866b836e45a3b95aed622c550b232afab5024200540e141066bd84", "structural_hash": "821936c40b8511cc6108eaf303e7c5a9ec2f6b5e6e2682cf35390d4ba9093601", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10534.c", "upstream_id": "BenchmarkTest10534", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char _tmpl[] = \"/tmp/app.XXXXXX\";\n int _tfd = mkstemp(_tmpl);\n if (_tfd >= 0) {\n ssize_t _wn = write(_tfd, data, strlen(data));\n (void)_wn;\n close(_tfd);\n }\n}", "label": 0, "cwe": ["CWE-377"], "category": "insecuretemp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insecuretemp", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e692651ae0842c35223c21e1f9b4b31a613e88dfcb66fda8140a52af3f8d4f35", "structural_hash": "37d68bf4e88a3532856ddfc593135bbe1973fb883e29ccf2ccccfffc4c64cfd9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15465.js", "upstream_id": "BenchmarkTest15465", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const data = String(userInput).slice(0, 200);\n const size = Math.min(parseInt(data, 10) || 0, 1048576);\n Buffer.alloc(size);\n ctx.body = { status: \"ok\" };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a11b7dc362757b04e22e3a133508e63044ed6aa01b1327aa329950dc59f4d5a7", "structural_hash": "31b1e73344144256ec0705bb0a5ff7adef13a7f980921d8f1d45f349e0d96666", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05817.rb", "upstream_id": "BenchmarkTest05817", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c46203a40bce762c0f5d83a797b877e8778439e2587d4dd1b97076f38e344b64", "structural_hash": "bdb50b3d1dc2ec4f9b2d0d4d877bfb05d2dddf240e60ca895e0d820e3b54ff1d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05475.rb", "upstream_id": "BenchmarkTest05475", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n _handlers = { \"primary\" => -> {\n render html: (\"
    \" + data + \"
    \").html_safe\n } }\n _handlers[\"primary\"].call\n end\nend", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd355926621f0d09fd5f8ef7ce49db2f67c1117f94738e2813676b896124ae32", "structural_hash": "be7ac6d9e8bb439d21a0187c43d1ebe0033ab4c5e8a0415e5895cd30d4b51664", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03037.ts", "upstream_id": "BenchmarkTest03037", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = ((req.body.variables?.input) as string) || \"\";\n let data: string = '';\n const onInput = (v: string): void => { data = v; };\n onInput(userInput);\n req.session.id = String(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74f2dad05e809f42b4d92631c87e9de4e1f1e6c98aa3c8f5c314948d199ef5c4", "structural_hash": "857bf575f2b555ae89d04822781746549f9e49cfbd99b131d60acd2a8a220890", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_03437.js", "upstream_id": "BenchmarkTest03437", "language": "javascript", "code": "const fs = require(\"fs\");\nconst { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (req.file && req.file.originalname) || \"\";\n const data = passthrough(userInput);\n fs.chmodSync(\"/var/app/data/resource.txt\", parseInt(data, 8) || 0o777);\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4bda3e1c0d3c9173b7e5e8c6d0e581d1a76f7979a15cc58a5a3fc1359170740e", "structural_hash": "a67bb5b193b270f9b0e71c35cad5171768399b1c299106c547ca52eb26484150", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01627.rs", "upstream_id": "BenchmarkTest01627", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(comment_value.clone(), |s| s.trim().to_string());\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n crate::shared::send_error(&format!(\"Error: {}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "698b9b5c73e75b9785d5b37e2b94d586eec5311f2884c184f5a944f2792e011d", "structural_hash": "995606b0fae8233f3fd1a7c6488d4794740e8c1fbca14f5d5eabe5da679ca1d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04306.py", "upstream_id": "BenchmarkTest04306", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom lxml import etree\nimport re\nimport os\nfrom starlette.responses import JSONResponse\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n env_value = os.environ.get('USER_INPUT', '')\n ctx = RequestContext(env_value, source='form')\n data = ctx.payload\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JSONResponse({'error': 'invalid input'}, status_code=400)\n processed = data\n tree = etree.fromstring(b'')\n tree.xpath('/users/user[@name=\"' + str(processed) + '\"]')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0e4c4e720bb076362167a2bd4b0c3d1cca9333ec5a1e9a847661b93c2e1b3ea", "structural_hash": "1ee031a992be86a4d5955cc364c0584b39347509249b46d09dbde93f8aaa35b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01886.cpp", "upstream_id": "BenchmarkTest01886", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nnamespace httplib {\nstruct Request {\n std::string get_param_value(const std::string &key) const;\n std::string get_header_value(const std::string &key) const;\n std::unordered_map path_params;\n std::string body;\n};\nstruct Response {\n void set_content(const std::string &s, const std::string &type);\n void set_header(const std::string &key, const std::string &val);\n void set_redirect(const std::string &url, int status);\n int status;\n};\nstruct Result {};\nstruct Client {\n Client(const std::string &host, int port);\n Result Post(const std::string &path, const std::string &body, const std::string &content_type);\n};\n}\nstatic thread_local std::string cpp_shared_input;\nvoid benchmark_case(const httplib::Request &req, httplib::Response &res)\n{\n std::string user_input = req.get_header_value(\"User-Agent\");\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n if (std::time(nullptr) > 1735689600LL) {\n std::string _path = std::string(\"/var/app/data/\") + data;\n std::remove(_path.c_str());\n }\n res.set_content(\"ok\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "596b7236f8f9cf50da18f72f7702c6017f7dbc1c04d8d1439d6fe0d7a6f89e42", "structural_hash": "2b5503a6ef76d9588f8facc55836705e38135085902e9c04e3435b655b55bf9c", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01863.py", "upstream_id": "BenchmarkTest01863", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = ' '.join(str(json_value).split(' '))\n eval(str(data))\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55868b394fd26a9d525ab6178c366a5874fefde6d353e7e6871e12d4a7417170", "structural_hash": "1cb7dcc148b290ab1e81e6c156314a3b73e3c2ade045d057fbb75bcdc9e201e0", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00865.ts", "upstream_id": "BenchmarkTest00865", "language": "typescript", "code": "import { Request, Response } from \"express\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.cookies?.session_token as string) || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n res.status(500).json({ error: \"Internal error\" }); return;\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df2aed231ef2f9b676922b67962c351e098a272d0a101a03f54c013c9bbdf2c1", "structural_hash": "a1a26bdd51e14f540730254e1d5e790dbea5e3f6584d9e07c3529b6a2de5d4b3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_06690.go", "upstream_id": "BenchmarkTest06690", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"syscall\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tdata := strings.ReplaceAll(xmlBody, \"\\x00\", \"\")\n\tuid, atoiErr := strconv.Atoi(data)\n\tif atoiErr != nil {\n\t\tc.String(http.StatusBadRequest, \"invalid uid\")\n\t\treturn\n\t}\n\tif err := syscall.Setuid(uid); err != nil {\n\t\tc.String(500, \"privilege drop failed\")\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4a87d57e676eb62eb5a542ebe48abd887face3b467a7a48bde49f74fa0b2ab4", "structural_hash": "eb943922e49f7f953f9a50792af8f2e57764a615e0e4c1cf4508bf9d7f51e6b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20460.go", "upstream_id": "BenchmarkTest20460", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tcookieValue, err := c.Cookie(\"session_token\")\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"missing cookie\")\n\t\treturn\n\t}\n\t_prefix := \"\"\n\tif len(cookieValue) > 0 {\n\t\t_prefix = strings.ToLower(cookieValue[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = cookieValue\n\tcase \"f\":\n\t\tdata = cookieValue\n\tdefault:\n\t\tdata = cookieValue\n\t}\n\tresp, err := http.Post(\"http://api.svc.cluster/data\", \"text/plain\", strings.NewReader(data))\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-402"], "category": "resource_leak_sphere", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cleartext_credentials", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c91d55c191187b207a94d533a43b3bbfba8d7275f349c4a126468724104140a4", "structural_hash": "d57090f5bf07cb503c9d9dbd17d4058cdc3d41788776de6293634fc211fec5ea", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_19338.js", "upstream_id": "BenchmarkTest19338", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const data = await Promise.resolve(userInput);\n if (!/^[\\w-]+$/.test(String(data))) throw new Error(\"processing error: \" + data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-397"], "category": "generic_throws", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:generic_throws", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fd046f2583c0eff567a08e516ce869944a1140963f747b6a15b598e448fa6fbf", "structural_hash": "7312affab64ccd03eec308a87256d767f2af7ba990369dc0ce3861494b81f8f3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02296.ts", "upstream_id": "BenchmarkTest02296", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as fs from \"fs\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const cell = /^[=+\\-@]/.test(String(data)) ? \"'\" + data : data;\n fs.appendFileSync(\"report.csv\", cell + \",ok\\n\");\n return { status: \"ok\" };\n }\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d1502fe62e47f0861736da873095f3a9d9dc0dc66d02d31b28a6f483164f129d", "structural_hash": "161b5e3c1bd8b6ac2b2e7489a62a811cc330888d89e52bfd1f5ff60d04b4f6f4", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03337.java", "upstream_id": "BenchmarkTest03337", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final class ValidatedDto {\n @jakarta.validation.constraints.NotNull\n @jakarta.validation.constraints.Pattern(regexp = \"^[A-Za-z0-9_.-]+$\")\n @jakarta.validation.constraints.Size(max = 256)\n public String value;\n ValidatedDto(String v) { this.value = v; }\n }\n private static final jakarta.validation.Validator VALIDATOR =\n jakarta.validation.Validation.buildDefaultValidatorFactory().getValidator();\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.Map.Entry entry = java.util.Map.entry(fieldValue, \"json\");\n response.setHeader(\"X-Tuple-Context\", entry.getValue());\n String data = entry.getKey();\n java.util.Set> violations = VALIDATOR.validate(new ValidatedDto(data));\n if (!violations.isEmpty()) { response.sendError(400, \"schema invalid\"); return; }\n Object evaluated = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.getWriter().print(\"
    \" + evaluated + \"
    \");\n }\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:el_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48ef905376ee1ad8de3342ee461e8d26318e7132b4d57889a9bbca7ebddd4223", "structural_hash": "3ccb5ea90323985eb0bbb0810b9e81ed419058db1180c7982930d33422a62b6d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01087.cpp", "upstream_id": "BenchmarkTest01087", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n const char *_sess = std::getenv(\"SESSION_SECRET\");\n bool _authok = _sess && data == std::string(\"Bearer \") + _sess;\n if (_authok) std::cout << \"access granted\" << std::endl; else std::cout << \"denied\" << std::endl;\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54a58084b67691d3293d067e66f8f4a6241c0af9db20378b85dc6ff64d17772b", "structural_hash": "ab54cbb4e3ae7ea6d4b38c212de1e7135bcd682d9d031a5175f0e318363c15f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_32309.go", "upstream_id": "BenchmarkTest32309", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar data string\n\tif len(rawBody) > 0 {\n\t\tdata = rawBody\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tDB.Exec(\"UPDATE users SET role = ? WHERE id = 1\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e142d9f3bd0468d8f93a59be8f79730d0b6a5f3bf0e47e08b7839cf50a8ebad9", "structural_hash": "05896461263131476de9de7e45486cd3130a68b25446834d8e5253a8c8c6dc86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_00840.go", "upstream_id": "BenchmarkTest00840", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar data string\n\tfor _, token := range strings.Split(graphqlVar, \",\") {\n\t\tdata = token\n\t}\n\tresp, err := http.Get(data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\tw.Write(body)\n}", "label": 1, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ad08824ccbc3e81d29dfbb5f3ec6e3bebf2643552c9c1ecacf4b3c304c66c60e", "structural_hash": "82c141258150f23e76f3b451ed0f4d6f426a69f9d49e60485d3e526f6cc492b1", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00168.java", "upstream_id": "BenchmarkTest00168", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String toLowerCase(String v) { return v.toLowerCase(); }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = toLowerCase(fieldValue);\n if (\"admin\".equals(data)) {\n response.getWriter().print(\"{\\\"role\\\":\\\"admin\\\"}\");\n return;\n }\n response.sendError(403, \"forbidden\");\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "84f226329e2320ef6a6420324cdac2fe4bcfb171f22aef913c14ff5ee0513047", "structural_hash": "1afaf708649338e3f8b993fa7e4e5701b9e6389b600e1c850ff8747a5d151f8d", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00329.ts", "upstream_id": "BenchmarkTest00329", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as zod from \"zod\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n const _parsed = zod.z.string().regex(/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n res.cookie(\"session\", processed);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5a55552baf55c7c4af859e24459d78902ac38e94b31a68a6fcef5e9ae69329d", "structural_hash": "646f3746b8a2127ad389ee4a6f23cd8b5ee9d6488dfb88843f33ae78541db35f", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04052.ts", "upstream_id": "BenchmarkTest04052", "language": "typescript", "code": "import { Controller, Headers, Post, Res } from \"@nestjs/common\";\nimport { Response } from \"express\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string, @Res({ passthrough: true }) res: Response): Promise {\n const userInput = auth || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n res.set(\"X-Custom\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ee12c89f44470c363e3f4e305429743c0e8d6219c1d4a963ced0f7551317486", "structural_hash": "07185c0ac81babb76d157d5bf72849c7f3cba1561765d4225a44d9262bd6d399", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00695.rb", "upstream_id": "BenchmarkTest00695", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_HOST\"].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n unless session[:auth_token] && Rack::Utils.secure_compare(data.to_s, session[:auth_token].to_s)\n halt 401, JSON.generate({ error: \"unauthorized\" })\n return\n end\n end\nend", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6ac587ca46f22ee60ac0e641b406a419fd8040b1cbf60093819aab3d1aa4743", "structural_hash": "20dab1f4d33364c847c1ef4a09264e17ca5e08283ef9fe3b31b7a68c1d1f5add", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01921.php", "upstream_id": "BenchmarkTest01921", "language": "php", "code": " true]);\n }\n}", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:hardcoded_crypto_key", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d23a070f22bbd71b347f1a9403c26ef8f90d8d1d097b81a45663abdfe62c4b6", "structural_hash": "41a9febfe612c7f937ef89223446730dedf7dd685f60368e34d27428d19dadab", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01907.ts", "upstream_id": "BenchmarkTest01907", "language": "typescript", "code": "import { Request, Response } from \"express\";\nimport * as net from \"net\";\nexport const benchmark_case = async (req: Request, res: Response): Promise => {\n const userInput = (req.body.payload as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { res.status(403).json({error:\"host not allowed\"}); return; }\n if (!allowedHosts.includes(parsedHost)) { res.status(403).json({error:\"host not allowed\"}); return; }\n const targetUrl = data;\n net.connect(80, targetUrl);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee2e0b20274b5aa65199cc4cd89d343665fe49a16f760c073cf2e6cc6a083609", "structural_hash": "84bc56a1f2134f8de39a109e5752928bfce873ff462788666231f2cb44015c86", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09736.sh", "upstream_id": "BenchmarkTest09736", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n logger \"Action: $data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:env_var_info_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99034ed598fcbc5a0da69af36241675d6e0655a98da5012cea71053f95707df9", "structural_hash": "0a314c4eb1577c47c40d43607cb9d68fa6a7445a81889df2ed83e8bd4dacb223", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04988.java", "upstream_id": "BenchmarkTest04988", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n FormData payload = new FormData(userId);\n String data = payload.payload();\n java.util.Map records = java.util.Map.of(\n \"1001\", \"alice profile\", \"1002\", \"bob profile\", \"1003\", \"carol profile\");\n String record = records.get(data);\n if (record != null) {\n response.getWriter().print(\"{\\\"resource\\\":\\\"\" + record + \"\\\"}\");\n return;\n }\n response.sendError(404, \"not found\");\n }\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:idor", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f800eb677c32586b83f97b72f7b11fd14043a966fc4ade858130363c0e4bc73", "structural_hash": "36ea395778bd62cc5b6eda3c9452b88fa4329faa4c27d6f3ef6c09f912569a18", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20669.c", "upstream_id": "BenchmarkTest20669", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n chmod(_path, 0777);\n}", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bd7070434a3eb42523cfbb347a6fc7738ca99d04bd98734aa6abb8442ee8cc3c", "structural_hash": "0db4b25c188d9b784d503f2b6affe0db4acf55775f485b3e4caf2bb5cded9dce", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01043.rb", "upstream_id": "BenchmarkTest01043", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n tokens = user_input.split(',')\n data = tokens.join(',')\n headers[\"Access-Control-Allow-Origin\"] = data\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "967a3d3a7d4f5496b070cbb5ec4095802e6c7a3ec9cd5646cd367e335d46948e", "structural_hash": "5422bee86672bc39808dd0616ccd938167bdd6bc65f94146296df8c0fe20b4d3", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05218.java", "upstream_id": "BenchmarkTest05218", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private enum AllowedValue { NOOP, IDENTITY, PASSTHROUGH, ECHO }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"X-Custom-Header\") String xCustomHeader, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String headerValue = xCustomHeader != null ? xCustomHeader : \"\";\n String prefix = headerValue.length() > 0 ? headerValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = headerValue.toLowerCase(); break;\n case \"f\": data = headerValue.toUpperCase(); break;\n default: data = headerValue.strip(); break;\n }\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n Object evalResult = new org.springframework.expression.spel.standard.SpelExpressionParser().parseExpression(data).getValue();\n response.setHeader(\"X-Eval-Result\", String.valueOf(evalResult));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:eval_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f072d4dd26f3c596fe466af7e79100a8cf9fdbb020a669e25e41348224770537", "structural_hash": "e3623262e8c28af7d6b3b41518b8c4907141e360c27987671ac3993231c6ef57", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04926.rb", "upstream_id": "BenchmarkTest04926", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"net/http\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n http = Net::HTTP.new(URI(data).host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start { |h| h.get('/') }\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bd922470ae66c7a00c6a95ada38df5f7ad7f8774470101b772769f37de3aedb", "structural_hash": "0ee20b9f4a670f01bdf0f8417a8a4881742a0412314e6e2b586f05b8b205f8b9", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08120.js", "upstream_id": "BenchmarkTest08120", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n crypto.createHash(\"md5\").update(data).digest(\"hex\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30941a7293728f3e15ee98ca4a9dd66b7f21c9895a1e39ee1bb6f5474963d50a", "structural_hash": "f052938a14ae8f017866375e220d86bb5ff3a30c14496de7a4b6d2cb61fcf39b", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05819.php", "upstream_id": "BenchmarkTest05819", "language": "php", "code": "getContent();\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n session(['data' => (string) $data]);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:sessionfixation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09612d7e313c7256049dcfd23a6dc951f142e3c83d3a1957f45a4cc70e1774e2", "structural_hash": "c065b07f2240f3da49652277b36e39ba2e16e8890c94af15131693b0a48423f8", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_06068.php", "upstream_id": "BenchmarkTest06068", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $trusted = (string) $data;\n return response()->json(['trusted' => $trusted], 200);\n }\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b85bb58129b26946cc44ad8ec3898d3437e5765cb965b112a567ec120f86c23c", "structural_hash": "d770dc56cd85d28125bfbc3871a14434d1d6bab478ad0c5ff8c8f678bd163e04", "split": "train"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01836.rb", "upstream_id": "BenchmarkTest01836", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.body.read\n data = user_input ? user_input : ''\n result = DB[:users].where(name: data).first\n value = result[:name]\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b4eacd0a20ea171f718d01850286abce9e67ff1248b9a0e821d99948f4f2181", "structural_hash": "12281216951e813c842f36988bb37da24bc81e395ad931e1185bfd594011cecd", "split": "train"}